aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2009-11-04 00:28:34 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2009-11-04 00:28:34 (GMT)
commit0fa8bcc144320f7b37c0f3363e1e178e5935d2b2 (patch)
treeef5222a1303ddba74cf056e29203a0b66b65c773
parentf43d183be8cfafa3c14fafa2b3de887db368fb53 (diff)
downloadfusearchive-0fa8bcc144320f7b37c0f3363e1e178e5935d2b2.zip
fusearchive-0fa8bcc144320f7b37c0f3363e1e178e5935d2b2.tar.gz
fusearchive-0fa8bcc144320f7b37c0f3363e1e178e5935d2b2.tar.bz2
Fix for o_rdonly and getattr delegation
-rw-r--r--FuseArchive/ChunkFile.py16
-rw-r--r--FuseArchive/FileSystem.py2
2 files changed, 16 insertions, 2 deletions
diff --git a/FuseArchive/ChunkFile.py b/FuseArchive/ChunkFile.py
index 8e4f2eb..62d2c1e 100644
--- a/FuseArchive/ChunkFile.py
+++ b/FuseArchive/ChunkFile.py
@@ -116,11 +116,25 @@ class ChunkFile(object):
# files works (in the create a read-only file for writing case)
src = "./tree" + path
logging.debug( "Saving fh for " + src )
- nflags = os.O_RDWR | os.O_APPEND
+
+ if flags == 0:
+ # o_rdonly
+ nflags = flags
+ else:
+ # We need rw to cp -a on r/o files, actually we need rw on
+ # almost any write only operation to read out our chunks list
+ nflags = os.O_RDWR | os.O_APPEND
+
if flags & os.O_CREAT:
logging.debug( "Adding O_CREAT" )
nflags = nflags | os.O_CREAT
+ logging.debug( "Flags & O_RDONLY %d" % (flags & os.O_RDONLY) );
+ logging.debug( "Flags & O_RDWR %d" % (flags & os.O_RDWR) );
+ logging.debug( "Flags & O_WRONLY %d" % (flags & os.O_WRONLY) );
+ logging.debug( "Flags & O_APPEND %d" % (flags & os.O_APPEND) );
+ logging.debug( "Flags & O_CREAT %d" % (flags & os.O_CREAT) );
+
self.file = os.fdopen( os.open( src, nflags, *mode ),
flag2mode( nflags ) )
diff --git a/FuseArchive/FileSystem.py b/FuseArchive/FileSystem.py
index 31470c5..64eae86 100644
--- a/FuseArchive/FileSystem.py
+++ b/FuseArchive/FileSystem.py
@@ -19,7 +19,7 @@ class FileSystem(fuse.Fuse):
def getattr(self, path):
treefile = "./tree" + path
- if os.path.isfile( treefile ):
+ if os.path.isfile( treefile ) and not os.path.islink( treefile ):
logging.debug( "Delegating getattr to File for " + path )
# Check in the dirty cache first (to handle lseek and the