[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: diffutils-3.10.242-d65b test failure on Slackware 14 and openSUSE 12
From: |
Bruno Haible |
Subject: |
Re: diffutils-3.10.242-d65b test failure on Slackware 14 and openSUSE 12.1 |
Date: |
Sun, 05 Jan 2025 18:26:30 +0100 |
On Slackware 14 and openSUSE 12.1, there is a test failure:
FAIL: no-dereference
It can be easily reproduced like this:
$ mkdir subdir
$ ln -s loop loop
$ ln -s loop subdir/loop
$ diff --no-dereference loop subdir
diff: subdir/loop: Bad file descriptor
Find also (attached) the system calls log of
$ strace diff --no-dereference loop subdir
I debugged it:
diff.c:1442: oflags = 0xa0000
1st argument:
diff.c:1484 openat (-100, "loop", 0xa0000) => fd = -1
=> fd = UNOPENED, err = 0
diff.c:1526 fstatat (-100, "loop", ..., AT_SYMLINK_NOFOLLOW) => err = 0
2nd argument:
diff.c:1484 openat (-100, "subdir", 0xa0000) => fd = 7
diff.c:1528 fstat (7, ...) => err = 0
diff.c:1561
fnm_arg = 0
dir_arg = 1
filename = "subdir/loop"
diff.c:1579 openat (7, "loop", O_RDONLY | 0xa0000) => -1, errno = ELOOP
diff.c:1583 openat (7, "loop", O_PATHSEARCH | 0xa0000) => 8
The last openat() call is the one that produces the "bad" file descriptor.
Find attached a program 'foo.c' that exhibits the interaction between
openat() and fstat() more directly. It fails on
- Linux 3.1.0 (openSUSE 12.1)
- Linux 3.2.29 (Slackware 14)
The manpage "man openat" explains it: O_PATH exists since Linux 2.6.39,
but is supported with fstat() only since Linux 3.6.
But the diff.c change from 2023-07-31 assumes that O_PATH is supported
with fstat() always.
The attached patch fixes the issue by using O_SEARCH instead of O_PATH
on these versions of Linux.
Bruno
slackware14-log
Description: Text document
foo.c
Description: Text Data
0001-diff-Fix-failure-of-no-dereference-option-regression.patch
Description: Text Data