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>
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)
# 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
_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):
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