Collin Funk <[email protected]> writes:
>> -csplit: read error: Is a directory
>> +csplit: '/^a/': match not found
>> FAIL tests/csplit/csplit.sh (exit status: 1)
>
> Interesting. I will take a look at this later today, thanks.
>
> I thought it would be unproblematic since we check for read errors using
> the current working directory in tests/misc/misc/read-errors.sh.
Oh, that file has this check that I forgot about:
! cat . >/dev/null 2>&1 || skip_ "Need unreadable directories"
I pushed the attached patch after testing it on NetBSD 10.1.
Thanks!
Collin
>From 4c234d7555a0dbc0f28d1947137ed6cf79589305 Mon Sep 17 00:00:00 2001
Message-ID: <4c234d7555a0dbc0f28d1947137ed6cf79589305.1782876227.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Tue, 30 Jun 2026 19:45:24 -0700
Subject: [PATCH] tests: csplit: avoid a false failure on NetBSD
* 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 | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/tests/csplit/csplit.sh b/tests/csplit/csplit.sh
index cb1deb158..44189138f 100755
--- a/tests/csplit/csplit.sh
+++ b/tests/csplit/csplit.sh
@@ -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
--
2.54.0