From: Peter Amstutz Date: Fri, 16 Jan 2015 18:30:13 +0000 (-0500) Subject: 4838: Add --set-executable-bit option to make all files from mounted collections... X-Git-Tag: 1.1.0~1814^2~18 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/b97ac7f96234cbbb491bdbaade840ab50802f357 4838: Add --set-executable-bit option to make all files from mounted collections be executable. --- diff --git a/services/fuse/arvados_fuse/__init__.py b/services/fuse/arvados_fuse/__init__.py index 148a9a654b..dfdd3127fd 100644 --- a/services/fuse/arvados_fuse/__init__.py +++ b/services/fuse/arvados_fuse/__init__.py @@ -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 diff --git a/services/fuse/bin/arv-mount b/services/fuse/bin/arv-mount index 68cd09c1e8..c0472054a5 100755 --- a/services/fuse/bin/arv-mount +++ b/services/fuse/bin/arv-mount @@ -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)