bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] Strange wget behavior when saving to stdout


From: Micah Cowan
Subject: Re: [Bug-wget] Strange wget behavior when saving to stdout
Date: Sat, 16 Jun 2012 06:59:15 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

On 06/16/2012 02:43 AM, Giuseppe Scrivano wrote:
> Hi Micah,
> 
> Micah Cowan <address@hidden> writes:
> 
>> At first, I assumed wget was using errno improperly. Imagine my
>> surprise, though, when running wget under a debugger, to find that at
>> the tail end of main(), exit() gets called with an argument value of 0.
>> But gdb then still reports a non-zero exit status - and this "wget:
>> write error: No such file or directory" seems to get called _after_ wget
>> calls exit.
>>
>> I finally figured out what's happening by setting a breakpoint at exit,
>> and then setting one on write(), _after_ that first point hits.
> 
> it smells like a regression in gnulib.  I remember it was detecting
> correctly EBADF before without report any error.  Wget already closes
> stdout in the "cleanup" function so when gnulib later attempts to do the
> same thing.
> 
> I am thinking about not using the close_stdout module but registering
> "cleanup" at exit, I am going to investigate it.

The error message it's reporting seems to correspond to ENOENT
instead... wonder if it's mistakenly getting that error from normal
gettext() lookups, rather than any messages actually related to the
close... the actual close(1) from the strace log in my first message,
seems to have returned 0. If that's the case, shame on them! ;) errno
shouldn't generally be considered meaningful unless it's set to 0 just
prior to the call, and checked immediately after a verified-failed call.

-mjc




reply via email to

[Prev in Thread] Current Thread [Next in Thread]