On 10/09/2026 16:07, Bruno Haible via GNU coreutils General Discussion wrote:
Pádraig Brady wrote:syscalls=$( for s in $zc_syscalls; do strace -qe "$s" true >/dev/null 2>&1 && echo "$s" done | paste -s -d,)It sounds like the strace is hanging? Does adding a "timeout 10" on front of the strace avoid the hang?Yes, it does, for both of the tests. With this, we are down to 24 FAIL.
Weird, especially since get_stat_syscalls_() in init.cfg is Ok. Ah I see it! The tee syscall overlaps with a valid command, and strace -e does different things on Cygwin and linux. strace on Cygwin doesn't seem to support filtering syscalls at all. So probably the cleanest solution is to use a syntax that is rejected on Cygwin but works elsewhere. Failing strace is already handled generally, so should just avoid the test (portions) on Cygwin. The attached makes that change for the whole test suite. cheers, Padraig
From b3cdc09344bcd5801dace055b32e900b247d2d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]> Date: Thu, 10 Sep 2026 16:40:06 +0100 Subject: [PATCH] tests: avoid hangs with strace on cygwin `strace -e tee true` will run the tee command on cygwin, rather than filtering for the tee syscall. Reported by Bruno Haible on Cygwin 2.9.0 * init.cfg: Use -e trace=foo where foo might be a command, so that strace probes will fail rather than invoke foo on Cygwin. * tests/cat/cat-distinct-err.sh: Likewise. * tests/cat/splice.sh: Likewise. * tests/ls/no-cap.sh: Likewise. * tests/misc/yes.sh: Likewise. * tests/mv/atomic.sh: Likewise. * tests/mv/atomic2.sh: Likewise. * tests/nproc/nproc-quota.sh: Likewise. * tests/pwd/pwd-long.sh: Likewise. * tests/stty/stty.sh: Likewise. * tests/tail/debug.sh: Likewise. * tests/tail/inotify-only-regular.sh: Likewise. --- init.cfg | 4 ++-- tests/cat/cat-distinct-err.sh | 2 +- tests/cat/splice.sh | 2 +- tests/ls/no-cap.sh | 4 ++-- tests/misc/yes.sh | 2 +- tests/mv/atomic.sh | 2 +- tests/mv/atomic2.sh | 2 +- tests/nproc/nproc-quota.sh | 2 +- tests/pwd/pwd-long.sh | 2 +- tests/stty/stty.sh | 4 ++-- tests/tail/debug.sh | 2 +- tests/tail/inotify-only-regular.sh | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/init.cfg b/init.cfg index 8bacb5d68..3f2055511 100644 --- a/init.cfg +++ b/init.cfg @@ -252,7 +252,7 @@ require_strace_() strace -V < /dev/null > /dev/null 2>&1 || skip_ 'no strace program' - strace -qe "$1" echo > /dev/null 2>&1 || + strace -qe trace="$1" echo > /dev/null 2>&1 || skip_ 'strace -qe "'"$1"'" does not work' # On some linux/sparc64 systems, strace works fine on 32-bit executables, @@ -273,7 +273,7 @@ get_stat_syscalls_() local stats=stat local stat for stat in statx lstat stat64 lstat64 newfstatat fstatat64; do - strace -qe "$stat" true > /dev/null 2>&1 && + strace -qe trace="$stat" true > /dev/null 2>&1 && stats="$stats,$stat" done printf '%s\n' "$stats" diff --git a/tests/cat/cat-distinct-err.sh b/tests/cat/cat-distinct-err.sh index 5b15ddc14..8baf9dcbf 100755 --- a/tests/cat/cat-distinct-err.sh +++ b/tests/cat/cat-distinct-err.sh @@ -40,7 +40,7 @@ fi # Verify splice is called multiple times, # and doesn't just fall back after the first EINVAL. # This also implicitly handles systems without splice at all. -strace -o splice_count -e splice cat /dev/zero | head -c1M >/dev/null +strace -o splice_count -e trace=splice cat /dev/zero | head -c1M >/dev/null splice_count=$(grep '^splice' splice_count | wc -l) # Test that splice errors are diagnosed. diff --git a/tests/cat/splice.sh b/tests/cat/splice.sh index f1636278e..d4a5fdb67 100755 --- a/tests/cat/splice.sh +++ b/tests/cat/splice.sh @@ -32,7 +32,7 @@ zc_syscalls='io_uring_setup io_uring_enter io_uring_register memfd_create sendfile splice tee vmsplice' syscalls=$( for s in $zc_syscalls; do - strace -qe "$s" true >/dev/null 2>&1 && echo "$s" + strace -qe trace="$s" true >/dev/null 2>&1 && echo "$s" done | paste -s -d,) no_zero_copy() { diff --git a/tests/ls/no-cap.sh b/tests/ls/no-cap.sh index 6f639625b..69f36d06b 100755 --- a/tests/ls/no-cap.sh +++ b/tests/ls/no-cap.sh @@ -27,11 +27,11 @@ setcap 'cap_net_bind_service=ep' file || skip_ "setcap doesn't work" LS_COLORS=ca=1; export LS_COLORS -strace -e capget ls --color=always > /dev/null 2> out || fail=1 +strace -e trace=capget ls --color=always > /dev/null 2> out || fail=1 $EGREP 'capget\(' out || skip_ "your ls doesn't call capget" LS_COLORS=ca=:; export LS_COLORS -strace -e capget ls --color=always > /dev/null 2> out || fail=1 +strace -e trace=capget ls --color=always > /dev/null 2> out || fail=1 $EGREP 'capget\(' out && fail=1 Exit $fail diff --git a/tests/misc/yes.sh b/tests/misc/yes.sh index a31001b7b..5160e17c1 100755 --- a/tests/misc/yes.sh +++ b/tests/misc/yes.sh @@ -68,7 +68,7 @@ zc_syscalls='io_uring_setup io_uring_enter io_uring_register memfd_create sendfile splice tee vmsplice' syscalls=$( for s in $zc_syscalls; do - strace -qe "$s" true >/dev/null 2>&1 && echo "$s" + strace -qe trace="$s" true >/dev/null 2>&1 && echo "$s" done | paste -s -d,) no_zero_copy() { diff --git a/tests/mv/atomic.sh b/tests/mv/atomic.sh index a249853d9..6a4e103c7 100755 --- a/tests/mv/atomic.sh +++ b/tests/mv/atomic.sh @@ -34,7 +34,7 @@ ln -s t1 s1 || framework_failure_ ln -s t2 s2 || framework_failure_ -strace -qe unlink mv -T s1 s2 > out 2>&1 || fail=1 +strace -qe trace=unlink mv -T s1 s2 > out 2>&1 || fail=1 $EGREP 'unlink.*"s1"' out && fail=1 # Ensure that the source, s1, is gone. diff --git a/tests/mv/atomic2.sh b/tests/mv/atomic2.sh index 22149e067..9a22fb83d 100755 --- a/tests/mv/atomic2.sh +++ b/tests/mv/atomic2.sh @@ -32,7 +32,7 @@ touch a b || framework_failure_ ln b b2 || framework_failure_ -strace -qe unlink mv a b > out 2>&1 || fail=1 +strace -qe trace=unlink mv a b > out 2>&1 || fail=1 $EGREP 'unlink.*"b"' out && fail=1 # Ensure that the source, "a", is gone. diff --git a/tests/nproc/nproc-quota.sh b/tests/nproc/nproc-quota.sh index f591365d0..bbc2077f0 100755 --- a/tests/nproc/nproc-quota.sh +++ b/tests/nproc/nproc-quota.sh @@ -23,7 +23,7 @@ uses_strace_ # Ensure new enough Linux systems # as otherwise cpu_quota() will not call sched_getscheduler() -strace -o getsched_count -e sched_getscheduler nproc +strace -o getsched_count -e trace=sched_getscheduler nproc getsched_count=$(grep '^sched_getscheduler' getsched_count | wc -l) test "$getsched_count" -ge 1 || skip_ 'sched_getscheduler() call not detected' diff --git a/tests/pwd/pwd-long.sh b/tests/pwd/pwd-long.sh index 26e1822e7..570745bab 100755 --- a/tests/pwd/pwd-long.sh +++ b/tests/pwd/pwd-long.sh @@ -29,7 +29,7 @@ export ARGV_0 # Disable the getcwd syscall if possible, so more of our code is exercised. no_sys_getcwd() { - strace -f -o /dev/null -e 'getcwd' -e fault=all:error=ENOSYS "$@" + strace -f -o /dev/null -e trace=getcwd -e fault=all:error=ENOSYS "$@" } no_sys_getcwd true || no_sys_getcwd() { "$@"; } diff --git a/tests/stty/stty.sh b/tests/stty/stty.sh index 21af07830..5bfc17603 100755 --- a/tests/stty/stty.sh +++ b/tests/stty/stty.sh @@ -83,9 +83,9 @@ done stty $(cat $saved_state) # Ensure we validate options before accessing the device -strace -o log1 -e ioctl stty --version || fail=1 +strace -o log1 -e trace=ioctl stty --version || fail=1 n_ioctl1=$(wc -l < log1) || framework_failure_ -returns_ 1 strace -o log2 -e ioctl stty -blahblah || fail=1 +returns_ 1 strace -o log2 -e trace=ioctl stty -blahblah || fail=1 n_ioctl2=$(wc -l < log2) || framework_failure_ test "$n_ioctl1" -ge "$n_ioctl2" || fail=1 diff --git a/tests/tail/debug.sh b/tests/tail/debug.sh index 6f3869921..b644166a6 100755 --- a/tests/tail/debug.sh +++ b/tests/tail/debug.sh @@ -56,7 +56,7 @@ cleanup_ touch file.debug require_strace_ 'inotify_add_watch' -returns_ 124 timeout .1 strace -e inotify_add_watch -o strace.out \ +returns_ 124 timeout .1 strace -e trace=inotify_add_watch -o strace.out \ tail -F file.debug || fail=1 if grep 'inotify' strace.out; then timeout 10 tail --debug -n0 -f file.debug 2>debug.out & pid=$! diff --git a/tests/tail/inotify-only-regular.sh b/tests/tail/inotify-only-regular.sh index d6f9281b0..c9d9c3f35 100755 --- a/tests/tail/inotify-only-regular.sh +++ b/tests/tail/inotify-only-regular.sh @@ -23,7 +23,7 @@ require_inotify_supported_ require_strace_ 'inotify_add_watch' -returns_ 124 timeout .1 strace -e inotify_add_watch -o strace.out \ +returns_ 124 timeout .1 strace -e trace=inotify_add_watch -o strace.out \ tail -f /dev/null || fail=1 grep 'inotify' strace.out && fail=1 -- 2.55.0
