[ARVADOS] updated: 9756d91f6f1e2472184be0dc45e8849c2c9ab35b

git at public.curoverse.com git at public.curoverse.com
Fri Sep 26 16:06:42 EDT 2014


Summary of changes:
 services/fuse/arvados_fuse/__init__.py | 10 +++++++---
 services/fuse/bin/arv-mount            |  3 ++-
 2 files changed, 9 insertions(+), 4 deletions(-)

       via  9756d91f6f1e2472184be0dc45e8849c2c9ab35b (commit)
      from  b27fe91e18bec8df031e4c8bf87f4da293d7b733 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 9756d91f6f1e2472184be0dc45e8849c2c9ab35b
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Sep 26 16:06:28 2014 -0400

    3871: Pass on UnicodeEncodeError.  Don't return those entries in the directory
    listing because the user won't be able to access them anyway.  Add --encoding
    parameter to command line to allow the user to specify desired filesystem
    encoding.

diff --git a/services/fuse/arvados_fuse/__init__.py b/services/fuse/arvados_fuse/__init__.py
index e11d25f..c261bc3 100644
--- a/services/fuse/arvados_fuse/__init__.py
+++ b/services/fuse/arvados_fuse/__init__.py
@@ -728,12 +728,13 @@ 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):
+    def __init__(self, uid, gid, encoding="utf-8"):
         super(Operations, self).__init__()
 
         self.inodes = Inodes()
         self.uid = uid
         self.gid = gid
+        self.encoding = encoding
 
         # dict of inode to filehandle
         self._filehandles = {}
@@ -785,7 +786,7 @@ class Operations(llfuse.Operations):
         return entry
 
     def lookup(self, parent_inode, name):
-        name = unicode(name, 'utf-8')
+        name = unicode(name, self.encoding)
         _logger.debug("arv-mount lookup: parent_inode %i name %s",
                       parent_inode, name)
         inode = None
@@ -883,7 +884,10 @@ class Operations(llfuse.Operations):
         e = off
         while e < len(handle.entry):
             if handle.entry[e][1].inode in self.inodes:
-                yield (handle.entry[e][0].encode('utf-8'), self.getattr(handle.entry[e][1].inode), e+1)
+                try:
+                    yield (handle.entry[e][0].encode(self.encoding), self.getattr(handle.entry[e][1].inode), e+1)
+                except UnicodeEncodeError:
+                    pass
             e += 1
 
     def releasedir(self, fh):
diff --git a/services/fuse/bin/arv-mount b/services/fuse/bin/arv-mount
index e92b1b4..5b161fd 100755
--- a/services/fuse/bin/arv-mount
+++ b/services/fuse/bin/arv-mount
@@ -43,6 +43,7 @@ with "--".
     parser.add_argument('--debug', action='store_true', help="""Debug mode""")
     parser.add_argument('--logfile', help="""Write debug logs and errors to the specified file (default stderr).""")
     parser.add_argument('--foreground', action='store_true', help="""Run in foreground (default is to daemonize unless --exec specified)""", default=False)
+    parser.add_argument('--encoding', type=str, help="Character encoding to use for filesystem, default is utf-8 (see Python codec registry for list of available encodings)", default="utf-8")
     parser.add_argument('--exec', type=str, nargs=argparse.REMAINDER,
                         dest="exec_args", metavar=('command', 'args', '...', '--'),
                         help="""Mount, run a command, then unmount and exit""")
@@ -79,7 +80,7 @@ with "--".
 
     try:
         # Create the request handler
-        operations = Operations(os.getuid(), os.getgid())
+        operations = Operations(os.getuid(), os.getgid(), args.encoding)
         api = SafeApi(arvados.config)
 
         usr = api.users().current().execute(num_retries=args.retries)

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list