From: Pádraig Brady
Date: Sun, 8 Feb 2026 19:41:41 +0000 (+0000)
Subject: tests: determine errno string more efficiently
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d35e82b9b0460769c1966b1ef8acc0b5e5c8348;p=thirdparty%2Fcoreutils.git
tests: determine errno string more efficiently
* tests/misc/read-errors.sh: Use getlimits_ determined EIO error string,
rather than inferring the string from bash's output.
See https://bugs.gnu.org/80353
---
diff --git a/tests/misc/read-errors.sh b/tests/misc/read-errors.sh
index 1e2bd6f027..f967a9044c 100755
--- a/tests/misc/read-errors.sh
+++ b/tests/misc/read-errors.sh
@@ -17,8 +17,8 @@
# along with this program. If not, see .
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
-require_bash_as_SHELL_
uses_strace_
+getlimits_
! cat . >/dev/null 2>&1 || skip_ "Need unreadable directories"
@@ -106,12 +106,6 @@ expected_failure_status_sort=2
# Ensure read is called, otherwise it's a layering violation.
# Also ensure a read error is diagnosed appropriately.
if strace -o /dev/null -P _ -e '/read,splice' -e fault=all:error=EIO true; then
- # Get EIO error message independently from utils
- strace -o /dev/null -P /dev/null -e '/read,splice' -e fault=all:error=EIO \
- $SHELL -c 'read < /dev/null' 2>&1 |
- sed -e 's/\[/: /' -e 's/\]//' -e 's/.*: //' > io.err
- strerror_eio="$(cat io.err)" && test -n "$strerror_eio" || framework_failure_
-
while read reader; do
cmd=$(printf '%s\n' "$reader" | cut -d ' ' -f1) || framework_failure_
eval "expected=\$expected_failure_status_$cmd"
@@ -119,7 +113,7 @@ if strace -o /dev/null -P _ -e '/read,splice' -e fault=all:error=EIO true; then
returns_ $expected \
strace -f -o /dev/null -P . -e '/read,splice' -e fault=all:error=EIO \
$SHELL -c "$reader" 2>err || fail=1
- grep -F "$strerror_eio" err >/dev/null || { cat err; fail=1; }
+ grep -F "$EIO" err >/dev/null || { cat err; fail=1; }
done < built_readers
fi