GNU bug report logs -
#64540
[PATCH] od: exit out on failure to write to stdout
Previous Next
Reported by: Josef Bacik <josef <at> toxicpanda.com>
Date: Sun, 9 Jul 2023 09:09:02 UTC
Severity: normal
Tags: patch
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
Full log
Message #17 received at 64540 <at> debbugs.gnu.org (full text, mbox):
On 2023-07-09 07:11, Pádraig Brady wrote:
> Note the patch looks wrong as it would close the input always.
> We can fix that up easily enough anyway.
If it's easy and doesn't hurt performance in the usual case, that's of
course fine.
> For my reference a short list of utils to check (that might inf loop) are:
> cat comm cp cut dd dirname expand factor fmt fold head join ls nl numfmt
> od paste pr printf ptx readlink realpath seq shuf sort stat tac tail
> tee tr tsort unexpand uniq wc yes
There's no point to complicating programs that have bounded input for
other reasons, as they'll report errors soon enough for those other
reasons. The main problem comes from programs like 'cat' and 'od' that
can read from "infinite" input like /dev/urandom and can write indefinitely.
So I think we needn't worry about dirname, ptx, readlink, realpath,
sort, stat, tac, tsort, wc. For example, we needn't worry about 'sort'
because it needs to read all its input before outputting anything, and
it cannot read all of /dev/urandom. As long as these programs eventually
check for write errors, which I expect they all do, that should be good
enough.
Even for programs like 'od' there is no need to check every output
function; just check occasionally, when it's convenient.
This bug report was last modified 1 year and 304 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.