GNU bug report logs -
#9762
tac fails when given multiple non-seekable inputs due to misuse of mkstemp()
Previous Next
Full log
View this message in rfc822 format
On 10/18/11 05:38, Jim Meyering wrote:
> * src/tac.c (temp_stream): Don't exit immediately upon failed heap
> allocation, here. That would inhibit processing of any additional
> command-line arguments.
It doesn't matter that much either way here, but in general I'm
leery about any attempt to do useful work after a memory allocation
failure in C. The output of 'tac' will be wrong anyway, and many
users would prefer 'tac' to simply exit, than to go on and generate
a much larger (but still wrong) output, consuming needless resources.
Also (as my recent experiences with Emacs have shown),
once malloc has failed, other code can start to go wrong,
including library code that we have no control over. Sometimes
the failures are subtle, and sometimes they're spectacular; either
way it's typically better to steer clear of that particular chasm.
After malloc fails, Emacs typically enters a "restricted" mode,
where it first releases a memory reserve, and then continually
asks you to save your work and exit as soon as possible. This
is good advice, and even then one is not entirely sure of exiting
safely.
This bug report was last modified 13 years and 223 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.