From 8487ee1e1f4e18b35cdcbad4f866dacd2df8f35a Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Sat, 10 Nov 2007 15:09:05 +0000 Subject: #4796 Ignore failure to chmod files in usb sticks. --- diff --git a/NEWS b/NEWS index 9e7b4c1..acff56f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +* #4796 Ignore failure to chmod files in usb sticks. (tomeu) + Snapshot 62a5c30d81 * Copy files to the profile dir when asked by an out-of-container process. (tomeu) diff --git a/src/olpc/datastore/backingstore.py b/src/olpc/datastore/backingstore.py index 4445e40..c9ef05a 100644 --- a/src/olpc/datastore/backingstore.py +++ b/src/olpc/datastore/backingstore.py @@ -395,7 +395,16 @@ class FileBackingStore(BackingStore): targetpath = "%s(%s)%s" % (targetpath, attempt, ext) - os.chmod(path, 0604) + # Try to make the original file readable. This can fail if the file is + # in FAT filesystem. + try: + os.chmod(path, 0604) + except OSError, e: + if e.errno != errno.EPERM: + raise + + # Try to link from the original file to the targetpath. This can work if + # the file is in a different filesystem. Do a copy instead. try: os.link(path, targetpath) except OSError, e: -- cgit v0.9.1