summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin David <valentin.david@gmail.com>2018-08-09 14:06:50 +0000
committerValentin David <valentin.david@gmail.com>2018-08-09 14:06:50 +0000
commitef7810f37bff2a85ad8d874b068121ac50b77801 (patch)
tree30840ce12ce9de5d1e2765891d50d008cbc73030
parent35ab0335d710d0bec1521d4e2496384a8526b50e (diff)
parent8aa33e23d4e1b1675f9fbc5937e576105183c2ae (diff)
downloadbuildstream-ef7810f37bff2a85ad8d874b068121ac50b77801.tar.gz
Merge branch 'valentindavid/fuse-create-flags' into 'master'
Keep original flags for create in SafeHardlinks. Closes #143 See merge request BuildStream/buildstream!624
-rw-r--r--buildstream/_fuse/fuse.py6
-rw-r--r--buildstream/_fuse/hardlinks.py4
2 files changed, 7 insertions, 3 deletions
diff --git a/buildstream/_fuse/fuse.py b/buildstream/_fuse/fuse.py
index 58febcba0..4ff6b9903 100644
--- a/buildstream/_fuse/fuse.py
+++ b/buildstream/_fuse/fuse.py
@@ -757,7 +757,11 @@ class FUSE(object):
if self.raw_fi:
return self.operations('create', path, mode, fi)
else:
- fi.fh = self.operations('create', path, mode)
+ # This line is different from upstream to fix issues
+ # reading file opened with O_CREAT|O_RDWR.
+ # See issue #143.
+ fi.fh = self.operations('create', path, mode, fi.flags)
+ # END OF MODIFICATION
return 0
def ftruncate(self, path, length, fip):
diff --git a/buildstream/_fuse/hardlinks.py b/buildstream/_fuse/hardlinks.py
index 4da51bb22..1386f14cf 100644
--- a/buildstream/_fuse/hardlinks.py
+++ b/buildstream/_fuse/hardlinks.py
@@ -185,12 +185,12 @@ class SafeHardlinkOps(Operations):
return os.open(full_path, flags)
- def create(self, path, mode, fi=None):
+ def create(self, path, mode, flags):
full_path = self._full_path(path)
# If it already exists, ensure it's a copy first
self._ensure_copy(full_path)
- return os.open(full_path, os.O_WRONLY | os.O_CREAT, mode)
+ return os.open(full_path, flags, mode)
def read(self, path, length, offset, fh):
os.lseek(fh, offset, os.SEEK_SET)