From ae4abdfe1c54cb778abbc5e33959f9ca652b7105 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Tue, 17 Sep 2024 11:47:52 +0200 Subject: [PATCH] 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. --- src/borg/archive.py | 2 ++ src/borg/constants.py | 2 +- src/borg/item.pyi | 4 ++++ src/borg/item.pyx | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/borg/archive.py b/src/borg/archive.py index 9265a2e62..2e7323c29 100644 --- a/src/borg/archive.py +++ b/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): diff --git a/src/borg/constants.py b/src/borg/constants.py index 0511f62de..65f9c00db 100644 --- a/src/borg/constants.py +++ b/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 diff --git a/src/borg/item.pyi b/src/borg/item.pyi index 8cb2df43d..31fda5540 100644 --- a/src/borg/item.pyi +++ b/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: ... diff --git a/src/borg/item.pyx b/src/borg/item.pyx index 04dd884f2..ff50912d4 100644 --- a/src/borg/item.pyx +++ b/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