]> arthur.barton.de Git - bup.git/commitdiff
Improve some metadata error messages.
authorRob Browning <rlb@defaultvalue.org>
Wed, 19 Jan 2011 05:46:54 +0000 (23:46 -0600)
committerRob Browning <rlb@defaultvalue.org>
Wed, 19 Jan 2011 05:48:17 +0000 (23:48 -0600)
lib/bup/metadata.py
lib/bup/t/tmetadata.py

index 927c5cffe0581b66048ac255bd611f4019d9b414..17215ce993cdce3ce223cabeb19260ff3a463642 100644 (file)
@@ -173,11 +173,11 @@ class Metadata:
         try:
             self.owner = pwd.getpwuid(st.st_uid)[0]
         except KeyError, e:
-            add_error(e)
+            add_error("no user name for id %s '%s'" % (st.st_gid, path))
         try:
             self.group = grp.getgrgid(st.st_gid)[0]
         except KeyError, e:
-            add_error(e)
+            add_error("no group name for id %s '%s'" % (st.st_gid, path))
 
     def _encode_common(self):
         atime = self.atime.to_timespec()
@@ -336,7 +336,7 @@ class Metadata:
             if(stat.S_ISLNK(st.st_mode)):
                 self.symlink_target = os.readlink(path)
         except OSError, e:
-            add_error(e)
+            add_error('readlink: %s', e)
 
     def _encode_symlink_target(self):
         return self.symlink_target
@@ -415,7 +415,7 @@ class Metadata:
                     self.linux_attr = get_linux_file_attr(path)
             except EnvironmentError, e:
                 if e.errno == errno.EACCES:
-                    add_error('unable to read Linux attr for "%s"' % path)
+                    add_error('read Linux attr: %s' % e)
                 else:
                     raise
 
index 6295ad3692110a8288f4f119e7dc6ee5537529d3..b6451edcf38031bf4e6bddbb521c3ad674c1a878 100644 (file)
@@ -88,7 +88,7 @@ def test_from_path_error():
         subprocess.call(['chmod', '000', path])
         metadata.from_path(path, archive_path=path, save_symlinks=True)
         errmsg = helpers.saved_errors[0] if helpers.saved_errors else ''
-        WVPASS(errmsg.startswith('unable to read Linux attr'))
+        WVPASS(errmsg.startswith('read Linux attr'))
         clear_errors()
     finally:
         subprocess.call(['rm', '-rf', tmpdir])