Răsfoiți Sursa

create: also archive inode number, fixes #8362

we could use this if we use the "previous archive" instead of the "files cache"
to determine whether a file is unchanged.
Thomas Waldmann 8 luni în urmă
părinte
comite
ae4abdfe1c
4 a modificat fișierele cu 9 adăugiri și 1 ștergeri
  1. 2 0
      src/borg/archive.py
  2. 1 1
      src/borg/constants.py
  3. 4 0
      src/borg/item.pyi
  4. 2 0
      src/borg/item.pyx

+ 2 - 0
src/borg/archive.py

@@ -1058,6 +1058,8 @@ class MetadataCollector:
             group = gid2group(st.st_gid)
             if group is not None:
                 attrs["group"] = group
+        if st.st_ino > 0:
+            attrs["inode"] = st.st_ino
         return attrs
 
     def stat_ext_attrs(self, st, path, fd=None):

+ 1 - 1
src/borg/constants.py

@@ -1,7 +1,7 @@
 # this set must be kept complete, otherwise the RobustUnpacker might malfunction:
 # fmt: off
 ITEM_KEYS = frozenset(['path', 'source', 'target', 'rdev', 'chunks', 'chunks_healthy', 'hardlink_master', 'hlid',
-                       'mode', 'user', 'group', 'uid', 'gid', 'mtime', 'atime', 'ctime', 'birthtime', 'size',
+                       'mode', 'user', 'group', 'uid', 'gid', 'mtime', 'atime', 'ctime', 'birthtime', 'size', 'inode',
                        'xattrs', 'bsdflags', 'acl_nfs4', 'acl_access', 'acl_default', 'acl_extended',
                        'part'])
 # fmt: on

+ 4 - 0
src/borg/item.pyi

@@ -209,6 +209,10 @@ class Item(PropDict):
     @nlink.setter
     def nlink(self, val: int) -> None: ...
     @property
+    def inode(self) -> int: ...
+    @inode.setter
+    def inode(self, val: int) -> None: ...
+    @property
     def size(self) -> int: ...
     @size.setter
     def size(self, val: int) -> None: ...

+ 2 - 0
src/borg/item.pyx

@@ -288,6 +288,8 @@ cdef class Item(PropDict):
     # size is only present for items with a chunk list and then it is sum(chunk_sizes)
     size = PropDictProperty(int)
 
+    inode = PropDictProperty(int)
+
     hlid = PropDictProperty(bytes)  # hard link id: same value means same hard link.
     hardlink_master = PropDictProperty(bool)  # legacy