4838: Add --set-executable-bit option to make all files from mounted collections...
[arvados.git] / services / fuse / arvados_fuse / __init__.py
index 148a9a654b1cb3aa4e4627548a11b0c42e5005b6..dfdd3127fdd49c07e4ade5c5f3655ebaf1928886 100644 (file)
@@ -729,13 +729,14 @@ class Operations(llfuse.Operations):
     so request handlers do not run concurrently unless the lock is explicitly released
     using "with llfuse.lock_released:"'''
 
-    def __init__(self, uid, gid, encoding="utf-8"):
+    def __init__(self, uid, gid, encoding="utf-8", set_executable_bit=False):
         super(Operations, self).__init__()
 
         self.inodes = Inodes()
         self.uid = uid
         self.gid = gid
         self.encoding = encoding
+        self.set_executable_bit = set_executable_bit
 
         # dict of inode to filehandle
         self._filehandles = {}
@@ -768,6 +769,8 @@ class Operations(llfuse.Operations):
         entry.st_mode = stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
         if isinstance(e, Directory):
             entry.st_mode |= stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH | stat.S_IFDIR
+        elif isinstance(e, StreamReaderFile) and self.set_executable_bit:
+            entry.st_mode |= stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH | stat.S_IFREG
         else:
             entry.st_mode |= stat.S_IFREG