On FreeBSD 12.0: 1 test fails.
FAIL: tests/misc/csplit-io-err ============================== 0 --- exp 2020-02-29 11:57:09.266337000 +0100 +++ out 2020-02-29 11:57:09.314904000 +0100 @@ -1 +1 @@ -csplit: write error for 'xx01': No space left on device +csplit: : No space left on device FAIL tests/misc/csplit-io-err.sh (exit status: 1) I could debug this failure: A modified 'csplit' program (with k.c from tests/misc/csplit-io-err), invoked as ./csplit - 1 4 < in hits the overridden fwrite() with a stack trace like this: fwrite at k.c:10 rpl_vfprintf at lib/vfprintf.c:52 error_tail at lib/error.c:274 error at lib/error.c:323 save_line_to_file at src/csplit.c:1054 process_line_count at src/csplit.c:753 split_file at src/csplit.c:916 main at src/csplit.c:1464 The attached patch fixes it, by limiting the effect of the overridden fwrite() to streams != stderr.
>From f0a63e5ff0e53868b4c1e914175a19049d781f10 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 29 Feb 2020 22:33:04 +0100 Subject: [PATCH] tests: Fix test failure on FreeBSD 12. * tests/misc/csplit-io-err.sh: Limit the effect of the fwrite override to streams != stderr. --- tests/misc/csplit-io-err.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/misc/csplit-io-err.sh b/tests/misc/csplit-io-err.sh index 683a9e4..f1e6229 100755 --- a/tests/misc/csplit-io-err.sh +++ b/tests/misc/csplit-io-err.sh @@ -39,9 +39,23 @@ cat > k.c <<'EOF' || framework_failure_ size_t fwrite (const void *ptr, size_t size, size_t nitems, FILE *stream) { - fclose (fopen ("preloaded","w")); /* marker for preloaded interception */ - errno = ENOSPC; - return 0; + if (stream == stderr) + { + /* Perform the normal operation of fwrite. */ + const char *p = ptr; + size_t count = size * nitems; + size_t i; + for (i = 0; i < count; i++) + if (putc ((unsigned char) *p++, stream) == EOF) + break; + return i / size; + } + else + { + fclose (fopen ("preloaded","w")); /* marker for preloaded interception */ + errno = ENOSPC; + return 0; + } } size_t -- 2.7.4