]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid a failure on musl
authorCollin Funk <collin.funk1@gmail.com>
Thu, 9 Apr 2026 01:57:54 +0000 (18:57 -0700)
committerPádraig Brady <P@draigBrady.com>
Thu, 16 Apr 2026 21:20:49 +0000 (22:20 +0100)
* tests/misc/io-errors.sh: Allow a generic error string on musl since
the first line is emitted immediately instead of being buffered as
expected.
Reported by Bruno Haible.

tests/misc/io-errors.sh

index 8d01aa913e7e6fa65baf8c5367b97d43adff370b..72bfeb458455c9563a9fc3e969725394a6b3a60e 100755 (executable)
@@ -83,6 +83,15 @@ while read writer; do
   # For e.g. with _IOLBF etc, stdio will discard pending data at each line,
   # thus only giving a generic error upon ferror() in close_stream().
   error_re="$ENOSPC"
+
+  # musl writes the first line immediately when it should be fully buffered.
+  # As a result, when we print a single line there is no bytes buffered when
+  # we close the stream and errno is not set.  See:
+  # <https://www.openwall.com/lists/musl/2026/04/02/1>.
+  case $host_triplet in
+    *-musl*) error_re="$error_re|" ;;
+  esac
+
   printf '%s' "$writer" | grep 'generic' >/dev/null &&
     { error_re="write error|$error_re"; }