File 0002-set_flags-better-give-up-than-corrupt.patch of Package borgbackup
From: Thomas Waldmann <tw@waldmann-edv.de>
Date: Fri, 17 Oct 2025 00:20:05 +0200
Subject: set_flags: better give up than corrupt
References: bsc#1251048
Git-repo: https://github.com/ThomasWaldmann/borg#fix-set_flags-1.4
Git-commit: 9c600a95715ec22a5dd6cfba9bb1bee8238fc938
Patch-mainline: Queued in subsystem maintainer repository
Thanks to Earnestly for the feedback on IRC.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
src/borg/platform/linux.pyx | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/borg/platform/linux.pyx b/src/borg/platform/linux.pyx
index e849dbba32d1..d7680ccd62d2 100644
--- a/src/borg/platform/linux.pyx
+++ b/src/borg/platform/linux.pyx
@@ -149,9 +149,12 @@ def set_flags(path, bsd_flags, fd=None):
if open_fd:
fd = os.open(path, os.O_RDONLY|os.O_NONBLOCK|os.O_NOFOLLOW)
try:
- # Get current flags. If this fails, fall back to 0 so we can still attempt to set.
+ # Get current flags.
if ioctl(fd, FS_IOC_GETFLAGS, &flags) == -1:
- flags = 0
+ # If this fails, give up because it is either not supported by the fs
+ # or maybe not permitted? If we can't determine the current flags,
+ # we better not risk corrupting them by setflags, see the comment below.
+ return # give up silently
# Replace only the bits we actually want to influence, keep others.
# We can't just set all flags to the archived value, because we might
--
2.51.0