[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#28251: marked as done (libc should cause programs which leave stuff in stdio to fail)



Your message dated Mon, 26 Feb 2018 10:22:36 +0000 (UTC)
with message-id <1165894864.8333533.1519640556544@mail.yahoo.com>
and subject line Apply for a Personal/Business Loan
has caused the Debian Bug report #28250,
regarding libc should cause programs which leave stuff in stdio to fail
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
28250: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=28250
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libc6
Version: 2.0.7t-1
Severity: grave

Many programs (even the standard hello world examples) do this
 int main(void) {
   if (!fputs("hello world\n",stdout)) { perror("stdout"); exit(-1); }
   return 0;
 }

Of course stdout is usually buffered, and the error isn't reported by
the kernel until the implicit close(0) done at exit, but then there is
no application for the libc to pass the error to.

1. All programs which do this are buggy in the sense that they won't
work correctly on any UN*X when the disk becomes full, if they have
less than a stdio buffer of output.  I have filed a several bug
reports about this - some years ago I got `echo' fixed (both /bin/echo
and the builtins in bash and tcsh) - and now I've reported the same
bug in mawk, GNU sed and printf (from shellutils).

2. libc should either:

(a) Cause these programs to fail all the time (eg, the implicit
close(0) should be replaced by a call which aborts if there is
anything in stdio buffers).  This would allow these programs to be
detected, because they'd all break.  This would affect nearly every
stdio-using program, which would all have to be fixed, and should not
be done just before a release :-).  There would have to be an
environment variable to turn the behaviour off for old programs, so
that people can have useability if not reliability.

or

(b) It should do the error handling itself.  Ie, if the implicit
close(0) fails then libc should print a message to stderr (if
possible) and exit with status 255.

I prefer (b) because it means that we don't have to change many
programs, however it is somewhat lazier, and doesn't result in the bug
being fixed anywhere but glibc-based systems.

Neither of (a) or (b) is likely to be standards-compliant, but if the
standard is to be broken then we shouldn't follow it.

Ian.

--- End Message ---
--- Begin Message ---

Attachment: Credible Loan Application Form.docx
Description: application/vnd.openxmlformats-officedocument.wordprocessingml.document


--- End Message ---

Reply to: