-
-
Notifications
You must be signed in to change notification settings - Fork 791
Open
Description
The code at:
borg/src/borg/platform/linux.pyx
Lines 142 to 151 in 1c6ef7a
if open_fd: | |
fd = os.open(path, os.O_RDONLY|os.O_NONBLOCK|os.O_NOFOLLOW) | |
try: | |
if ioctl(fd, FS_IOC_SETFLAGS, &flags) == -1: | |
error_number = errno.errno | |
if error_number != errno.EOPNOTSUPP: | |
raise OSError(error_number, strerror(error_number).decode(), path) | |
finally: | |
if open_fd: | |
os.close(fd) |
can remove for example an ext4 flag like EXT4_EXTENTS_FL
which results in EOPNOTSUPP
. That one is indeed handled above, but this is still incorrect. The flags
should be fetched with FS_IOC_GETFLAGS
, updated and only then stored back with FS_IOC_SETFLAGS
.
This became visible due to a bug in torvalds/linux@474b155. With that commit, ENOTTY
is returned instead of EOPNOTSUPP
, so borg tests occasionally fail -- depending whether it is possible to convert the inode to no EXT4_EXTENTS_FL
or not.
See also: https://bugzilla.suse.com/show_bug.cgi?id=1251048#c3
FTR, strace
dump of the failing test:
newfstatat(AT_FDCWD, "/tmp/tmpwsa22bk4/input", {st_mode=S_IFDIR|0777, st_size=4096, ...}, 0) = 0
openat(AT_FDCWD, "/tmp/tmpwsa22bk4/input/file3", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 12
fstat(12, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
ioctl(12, TCGETS2, 0x7ffcdd3c9a20) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(12, 0, SEEK_CUR) = 0
write(12, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"..., 81920) = 81920
close(12) = 0
newfstatat(AT_FDCWD, "/tmp/tmpwsa22bk4/input/file3", {st_mode=S_IFREG|0600, st_size=81920, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, "/tmp/tmpwsa22bk4/input/file3", O_RDONLY|O_NONBLOCK|O_NOFOLLOW|O_CLOEXEC) = 12
ioctl(12, FS_IOC_SETFLAGS, [FS_NODUMP_FL]) = -1 ENOTTY (Inappropriate ioctl for device)
close(12) = 0
Metadata
Metadata
Assignees
Labels
No labels