From: Pádraig Brady Date: Tue, 6 Jan 2026 20:29:45 +0000 (+0000) Subject: tests: cp: fix always skipped nfs-removal-race.sh X-Git-Tag: v9.10~131 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c43f517e2a733eda125ef32390ed48aa92f6fdeb;p=thirdparty%2Fcoreutils.git tests: cp: fix always skipped nfs-removal-race.sh * tests/cp/nfs-removal-race.sh: This test was invalid since v8.32 as we now use fstatat() rather than stat(). Also since commit v9.0-66-ge2daa8f79 we leverage the errno from open(O_DIRECTORY) to avoid a stat, so pass --no-target-directory to ensure fstatat() is called. Discussed in https://github.com/coreutils/coreutils/pull/161 --- diff --git a/tests/cp/nfs-removal-race.sh b/tests/cp/nfs-removal-race.sh index da787e6bb9..1bf59fe768 100755 --- a/tests/cp/nfs-removal-race.sh +++ b/tests/cp/nfs-removal-race.sh @@ -93,6 +93,18 @@ stat (const char *path, struct stat *st) real_stat = dlsym (RTLD_NEXT, "stat"); return real_stat (redirect_path (path), st); } + +/* Since coreutils v8.32 we use fstatat() rather than stat() */ +int fstatat(int dirfd, const char *restrict path, + struct stat *restrict statbuf, int flags) +{ + static int (*real_fstatat) (int dirfd, const char *restrict pathname, + struct stat *restrict statbuf, int flags) = NULL; + if (!real_fstatat) + real_fstatat = dlsym (RTLD_NEXT, "fstatat"); + return real_fstatat (dirfd, redirect_path (path), statbuf, flags); +} + EOF # Then compile/link it: @@ -103,7 +115,7 @@ touch d2 || framework_failure_ echo xyz > src || framework_failure_ # Finally, run the test: -LD_PRELOAD=$LD_PRELOAD:./k.so cp src d || fail=1 +LD_PRELOAD=$LD_PRELOAD:./k.so cp -T src d || fail=1 test -f preloaded || skip_ 'LD_PRELOAD was ineffective?'