On 27/08/2023 11:26, Bruno Haible wrote:
There are no test failures on
   - FreeBSD 12.0/x86_64
   - FreeBSD 12.2/arm64
   - FreeBSD 13.0/x86_64, FreeBSD 13.0/arm64

However:

* There is 1 test failure on FreeBSD 13.1/x86_64:
   FAIL: tests/head/head-write-error
   Same as my earlier report in
   https://lists.gnu.org/archive/html/coreutils/2023-03/msg00031.html
   Also
   ERROR: tests/env/env-signal-handler

* There is 1 test failure on FreeBSD 13.2/x86_64:
   FAIL: tests/ls/removed-directory

Find attached the two log files.

The FreeBSD failures seem not too important and to be just due
to a repeated diagnostic when there is an error writing to stdout.
Perhaps fpurge() is needed on FreeBSD to avoid the repeated warning?
I don't have easy access to a FreeBSD machine at present,
to test this change:

diff --git a/src/head.c b/src/head.c
index 7bba1420c..da32c886f 100644
--- a/src/head.c
+++ b/src/head.c
@@ -181,6 +181,7 @@ xwrite_stdout (char const *buffer, size_t n_bytes)
   if (n_bytes > 0 && fwrite (buffer, 1, n_bytes, stdout) < n_bytes)
     {
       clearerr (stdout); /* To avoid redundant close_stdout diagnostic.  */
+      fpurge (stdout);
       error (EXIT_FAILURE, errno, _("error writing %s"),
              quoteaf ("standard output"));
     }
diff --git a/src/system.h b/src/system.h
index 7b736604b..6f3abf529 100644
--- a/src/system.h
+++ b/src/system.h
@@ -770,6 +770,7 @@ write_error (void)
 {
   int saved_errno = errno;
   fflush (stdout);    /* Ensure nothing buffered that might induce an error. */
+  fpurge (stdout);
   clearerr (stdout);  /* To avoid extraneous diagnostic from close_stdout.  */
   error (EXIT_FAILURE, saved_errno, _("write error"));
 }


Reply via email to