]> arthur.barton.de Git - bup.git/commitdiff
Move Cygwin uid/gid fixup from index to xstat
authorRob Browning <rlb@defaultvalue.org>
Sun, 24 May 2015 19:55:32 +0000 (14:55 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 26 Jul 2015 15:42:36 +0000 (10:42 -0500)
Move the Cygwin uid/gid fixup (8417c11948532ba890b862dcad9d37810d482616)
from the index to xstat.py so that it will affect metadata too.

If Cygwin is still affected by this issue, then it's possible that some
existing saves might have incorrect uid/gid values.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/index.py
lib/bup/metadata.py
lib/bup/xstat.py

index 794ff9f344393a9238883abe0aaf932c88399647..268716cfc945c4654af8e34676179261120293dd 100644 (file)
@@ -205,12 +205,6 @@ class Entry:
         self._fixup()
         
     def _fixup(self):
-        if self.uid < 0:
-            self.uid += 0x100000000
-        if self.gid < 0:
-            self.gid += 0x100000000
-        assert(self.uid >= 0)
-        assert(self.gid >= 0)
         self.mtime = self._fixup_time(self.mtime)
         self.ctime = self._fixup_time(self.ctime)
 
index bef806677220a899b7d5328fc44a2555f9d51767..9c6d46a987516f3522df5896bb64b156959215c1 100644 (file)
@@ -212,6 +212,8 @@ class Metadata:
     # must be non-negative and < 10**9.
 
     def _add_common(self, path, st):
+        assert(st.st_uid >= 0)
+        assert(st.st_gid >= 0)
         self.uid = st.st_uid
         self.gid = st.st_gid
         self.atime = st.st_atime
index 0eee9b2af2d956d495d4775f207ecd0e613c414f..7408414ce167bfed075cb02d0578ce3f6b5221c4 100644 (file)
@@ -81,6 +81,13 @@ else: # Must have these if utimensat isn't available.
         _bup_lutimes(path, (atime, mtime))
 
 
+def _fix_cygwin_id(id):
+    if id < 0:
+        id += 0x100000000
+        assert(id >= 0)
+    return id
+
+
 class stat_result:
     @staticmethod
     def from_xstat_rep(st):
@@ -99,6 +106,8 @@ class stat_result:
         result.st_atime = timespec_to_nsecs(result.st_atime)
         result.st_mtime = timespec_to_nsecs(result.st_mtime)
         result.st_ctime = timespec_to_nsecs(result.st_ctime)
+        result.st_uid = _fix_cygwin_id(result.st_uid)
+        result.st_gid = _fix_cygwin_id(result.st_gid)
         return result