Skip to content

Commit fac6c29

Browse files
committed
util/build-gnu.sh: Bypass timeout/yes SIGPIPE handling bug
See #7252, both `timeout` and `yes` reset the SIGPIPE handler (actually, the Rust core does that), leading to trap_sigpipe_or_skip_ test: ``` (trap '' PIPE && timeout 10 yes |:) 2>&1 | grep 'Broken pipe' ``` to fail, causing 4 tests to be skipped. I believe the intent here is to check if the OS supports SIGPIPE, so it probably makes sense to use System's timeout/yes here, and run the tests anyway (which, happen to pass).
1 parent 0c669c8 commit fac6c29

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

util/build-gnu.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ elif [ -x /usr/local/bin/timeout ]; then
6060
SYSTEM_TIMEOUT="/usr/local/bin/timeout"
6161
fi
6262

63+
SYSTEM_YES="yes"
64+
if [ -x /usr/bin/yes ]; then
65+
SYSTEM_YES="/usr/bin/yes"
66+
elif [ -x /usr/local/bin/yes ]; then
67+
SYSTEM_YES="/usr/local/bin/yes"
68+
fi
69+
6370
###
6471

6572
release_tag_GNU="v9.7"
@@ -212,6 +219,11 @@ sed -i "s|warning: unrecognized escape|warning: incomplete hex escape|" tests/st
212219

213220
sed -i 's|timeout |'"${SYSTEM_TIMEOUT}"' |' tests/tail/follow-stdin.sh
214221

222+
# trap_sigpipe_or_skip_ fails with uutils tools because of a bug in
223+
# timeout/yes (https://github.com/uutils/coreutils/issues/7252), so we use
224+
# system's yes/timeout to make sure the tests run (instead of being skipped).
225+
sed -i 's|\(trap .* \)timeout\( .* \)yes|'"\1${SYSTEM_TIMEOUT}\2${SYSTEM_YES}"'|' init.cfg
226+
215227
# Remove dup of /usr/bin/ and /usr/local/bin/ when executed several times
216228
grep -rlE '/usr/bin/\s?/usr/bin' init.cfg tests/* | xargs -r sed -Ei 's|/usr/bin/\s?/usr/bin/|/usr/bin/|g'
217229
grep -rlE '/usr/local/bin/\s?/usr/local/bin' init.cfg tests/* | xargs -r sed -Ei 's|/usr/local/bin/\s?/usr/local/bin/|/usr/local/bin/|g'

util/why-skip.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
# spell-checker:ignore epipe readdir restorecon SIGALRM capget bigtime rootfs enotsup
22

3-
= trapping SIGPIPE is not supported =
4-
* tests/tail-2/pipe-f.sh
5-
* tests/misc/seq-epipe.sh
6-
* tests/misc/printf-surprise.sh
7-
* tests/misc/env-signal-handler.sh
8-
93
= skipped test: breakpoint not hit =
104
* tests/tail-2/inotify-race2.sh
115
* tail-2/inotify-race.sh

0 commit comments

Comments
 (0)