]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: determine errno string more efficiently
authorPádraig Brady <P@draigBrady.com>
Sun, 8 Feb 2026 19:41:41 +0000 (19:41 +0000)
committerPádraig Brady <P@draigBrady.com>
Tue, 10 Feb 2026 12:36:06 +0000 (12:36 +0000)
* 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

tests/misc/read-errors.sh

index 1e2bd6f027db2529352ab97c1b131d696d1c3050..f967a9044c093947460ea772e0f3040dc5e457c6 100755 (executable)
@@ -17,8 +17,8 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 . "${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