]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: csplit: avoid a false failure on NetBSD
authorCollin Funk <collin.funk1@gmail.com>
Wed, 1 Jul 2026 02:45:24 +0000 (19:45 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Wed, 1 Jul 2026 03:04:10 +0000 (20:04 -0700)
* tests/csplit/csplit.sh: Don't run the test if calling read on a
directory file descriptor works.
Reported by Bruno Haible.

tests/csplit/csplit.sh

index cb1deb1581e438dd35142ef1f57d926859a6ef7b..44189138fcfb2e1516628fea02cf5080b65b003c 100755 (executable)
@@ -111,16 +111,18 @@ EOF
 compare experr err || fail=1
 
 # Test that the message to standard output isn't elided after read fails.
-echo 0 >exp-out || framework_failure_
-cat <<\EOF >exp-err || framework_failure_
+if ! cat . >/dev/null 2>&1; then
+  echo 0 >exp-out || framework_failure_
+  cat <<\EOF >exp-err || framework_failure_
 csplit: read error: Is a directory
 EOF
-for opt in '' '-k'; do
-  rm -f xx?? || framework_failure_
-  returns_ 1 csplit $opt . '/^a/' >out 2>err || fail=1
-  compare /dev/null xx00 || fail=1
-  compare exp-out out || fail=1
-  compare exp-err err || fail=1
-done
+  for opt in '' '-k'; do
+    rm -f xx?? || framework_failure_
+    returns_ 1 csplit $opt . '/^a/' >out 2>err || fail=1
+    compare /dev/null xx00 || fail=1
+    compare exp-out out || fail=1
+    compare exp-err err || fail=1
+  done
+fi
 
 Exit $fail