4838: Add --set-executable-bit option to make all files from mounted collections...
authorPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 16 Jan 2015 18:30:13 +0000 (13:30 -0500)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 16 Jan 2015 18:30:13 +0000 (13:30 -0500)
services/fuse/arvados_fuse/__init__.py
services/fuse/bin/arv-mount

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
 
index 68cd09c1e83fa443978a11650d505d5aa519bc60..c0472054a5a90591cc8489f898d0a03d6eb2c9ef 100755 (executable)
@@ -47,6 +47,7 @@ with "--".
     parser.add_argument('--exec', type=str, nargs=argparse.REMAINDER,
                         dest="exec_args", metavar=('command', 'args', '...', '--'),
                         help="""Mount, run a command, then unmount and exit""")
+    parser.add_argument('--set-executable-bit', action='store_true', help="""Set executable bit on collection files""")
 
     args = parser.parse_args()
     args.mountpoint = os.path.realpath(args.mountpoint)
@@ -80,7 +81,7 @@ with "--".
 
     try:
         # Create the request handler
-        operations = Operations(os.getuid(), os.getgid(), args.encoding)
+        operations = Operations(os.getuid(), os.getgid(), args.encoding, args.set_executable_bit)
         api = SafeApi(arvados.config)
 
         usr = api.users().current().execute(num_retries=args.retries)