On 21/03/2026 08:29, Collin Funk wrote:
This patch also fixes a bug where 'tac' would print a vague error on
some inputs:

     $ seq 10000 | ./src/tac-prev > /dev/full
     tac-prev: write error
     $ seq 10000 | ./src/tac > /dev/full
     tac: write error: No space left on device

In this case ferror (stdout) is true, but errno has been set back to
zero by a successful fclose (stdout) call.

Yes with just two write locations it's worth adding that.

diff --git a/tests/misc/write-errors.sh b/tests/misc/write-errors.sh
index 53111417a..4ecafd626 100755
--- a/tests/misc/write-errors.sh
+++ b/tests/misc/write-errors.sh
@@ -57,6 +57,7 @@ pr /dev/zero
  pr --version; yes 1 | pr
  seq inf
  shuf -i 0-1 -r
+tac --version; seq 10000 | tac
  tail -n+1 -z /dev/zero
  tee < /dev/zero
  tr . . < /dev/zero

Well write-errors.sh is for commands that run indefinitely,
so it would be best not to add it there.

Instead I've pushed the attached update to io-errors.sh
which distinguishes generic and specific errors, so you
should be able to add "tac --version; seq 10000 | tac" there.

cheers,
Padraig


Reply via email to