This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Fwd: Bug#43023: libc 2.1.1-10 makes it impossible to use stdout


> 
> --- begin forwarded text
> Subject: Bug#43023: libc 2.1.1-10 makes it impossible to use stdout reliably
> Reply-To: Ian Jackson <ian@davenant.greenend.org.uk>, 43023@bugs.debian.org
> From: Ian Jackson <ian@davenant.greenend.org.uk>
> Date: Sun, 15 Aug 1999 17:05:32 +0100 (BST)
> To: submit@bugs.debian.org
> 
> Package: libc6
> Version: 2.1.1-10
> Severity: critical
> 
> We all know that correct programs check the return values from all
> their stdio writes.
> 
> However, stdio buffers things.  In many cases, the data doesn't get
> written until the program returns from main or calls exit(3).
> Furthermore there exist a number of network filesystems and similar
> systems where write errors are not reported until close(2).  So a
> straightforward `hello world' program, for example, might well lose
> data, even if it checked the return from printf(3).
> 
> I think this is a bug or misfeature in stdio, and that the run-time
> system should flush and close all its output streams on exit and treat
> errors as fatal, causing an error message to stderr and an exit status
> of -1.  However, this is not the current behaviour of the libc, and
> has never been the behaviour of any libc I've seen, so there may be
> some resistance to this course.
> 
> Thus any program which uses stdout must call fclose on it and check
> the error, before it exits 0 or returns from main.  (Unless it wants
> to risk exiting with status 0 after losing output.)  This will
> continue to be the case even if the Linux libc is fixed in the way I
> suggest, because programs will still need to be made reliable on other
> platforms.
> 
> However, with glibc 2.1.1-10 this causes a segmentation fault.  This
> is very bad.  Not only does it break any existing reliable software,
> but it is encouraging people to write more unreliable software (ie, by
> making it impossible for them to fclose stdout as they ought to) or
> even to make currently-reliable software unreliable (to fix what they
> perceive as a bug in the program - that it segfaults on exit).
> 
> A demonstration test case involving a simple `hello world' program is
> below.
> 

I cannot duplicate your testcase. A gdb backtrace may help.


H.J.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]