[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: failure with HEAD: stdin seekable
From: |
Eric Blake |
Subject: |
Re: failure with HEAD: stdin seekable |
Date: |
Mon, 18 Dec 2006 22:53:11 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Thunderbird/1.5.0.8 Mnenhy/0.7.4.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Gary V. Vaughan on 12/18/2006 1:24 PM:
> Hi Eric, Ralf,
Hi Gary, gnulib readers,
[gnulib list, this thread starts at
http://lists.gnu.org/archive/html/bug-m4/2006-12/msg00012.html]
>> I see it on cygwin as well. The problem is that my added call to fflush
>> ignores the errno, and while ferror tracks that something went wrong, the
>> error message is now less descriptive. But warning during the flush is
>> also wrong, as m4 should only need to error out once that stdout is full,
>> rather than on every subsequent flush. I'm debating whether it is worth
>> capturing errno on flush, then referring to that on close; or just
>> changing the testsuite to match the new reality of the error message.
>>
>>> @@ -1,2 +1,2 @@
>>> -m4: write error: No space left on device
>>> +m4: write error
>
> Unless the amount of work involved is prohibitive, better error messages
> always win out IMHO.
The current situation is that ferror/fclose are done in an atexit handler
supplied by gnulib, and my change only added an explicit fflush up front.
My fflush is necessary to work around the glibc bug that it does not
flush read streams during exit(), but it resides in code shared with
flushing prior to using the syscmd macro as documented in the M4 manual.
I don't see how I can make the atexit handler aware of a saved errno from
the fflush, but also don't think that reporting failure at the time of
fflush is wise, since fflush can occur many times before exit. Perhaps we
should add an accessor function that sets a static variable in the
closeout module, defaulting to 0, but that an application can call to
register any errno that it wants tracked (in this case, after failing
fflush, m4 would call the accessor to stash the ENOSPC), so that when the
atexit handler is finally called, the stashed errno can be used if
close_stream fails but without explaining why.
I'm willing to code up a patch if this idea sounds feasible; otherwise,
I'm out of ideas for keeping the useful error message around while still
keeping my m4 patch for proper flushing of stdout prior to forking or
exiting, and without overwhelming the user with fflush failure messages
when only one is needed.
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFh35H84KuGfSFAYARAlu2AJwOEl3Lm8etQGF/mI2NQ2krPCwHWQCfVCfu
ms5Pe4mTNNVs7znyhPuGrg0=
=3bnp
-----END PGP SIGNATURE-----