On Fri, Apr 18, 2025 at 1:51 AM Jim Meyering <[email protected]> wrote:
>
> Surprised to find that coreutils-9.5 (fedora 41 stock) works fine:
>
> $ { /bin/printf %4095s; /bin/printf %4096s; } > /dev/full
> /bin/printf: write error: No space left on device
> /bin/printf: write error: No space left on device
Though OTOH (not sure why):
$ { /bin/printf %4096s; /bin/printf %4097s; } > /dev/full
/bin/printf: write error: No space left on device
/bin/printf: write error
----
But I'm concerned that with this change because programs where:
1. errno is set by a failed (unchecked) write
2. errno is then set by some unrelated function
3. close_stdout() is arranged to run atexit
4. when close_stream() calls fclose() it does not fail
will now erroneously report the error from the unrelated function
when running close_stdout.
Previously:
$ stdbuf -oL realpath -e . xxx >/dev/full
realpath: xxx: No such file or directory
realpath: write error
After the patch:
$ stdbuf -oL src/realpath -e . xxx >/dev/full
realpath: xxx: No such file or directory
realpath: write error: No such file or directory