[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] head,tail: consistently diagnose write errors
From: |
Bernhard Voelker |
Subject: |
Re: [PATCH] head,tail: consistently diagnose write errors |
Date: |
Thu, 30 Jan 2014 00:12:14 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
On 01/30/2014 12:02 AM, Bernhard Voelker wrote:
> On 01/29/2014 07:43 PM, Pádraig Brady wrote:
>> On 01/29/2014 12:06 PM, Pádraig Brady wrote:
>>
>>> --- a/NEWS
>>> +++ b/NEWS
>>
>>> + tail now diagnoses all failures when writing to stdout. Previously write
>>> + errors could have been silently ignored if some data was output.
>>> + [This bug was present in "the beginning".]
>>
>> Actually this is not the case. The atexit handler would have caught
>> partial write failures, albeit with a less detailed error message.
>> So I'll remove the NEWS but leave the code changes.
>
> Thanks.
>
> It seems your patch didn't make it thru the mail systems:
>
> error: patch failed: src/head.c:504
> error: src/head.c: patch does not apply
> Patch failed at 0001 head,tail: consistently diagnose write errors
>
> Can you resend as attachment, please?
Sorry, I missed that this patch was based on the other patch for
bug http://bugs.gnu.org/16329. After that, it applies cleanly.
> However, if head is exiting earlier on the first write error,
> then there should be a user visible change.
>
> $ seq -f'%1000g' 1000 | { src/head --lines=-1 > /dev/full ; wc -l ; }
> src/head: write error
> 0
>
> With the patch, I'd expect wc to see more than 0 lines in the above
> case, right?
Indeed, now with the patch:
$ seq -f'%1000g' 1000 | { src/head --lines=-1 > /dev/full ; wc -l ; }
src/head: write error: No space left on device
src/head: write error
984
Unfortunately, the atexit code now produces a second error diagnostic.
It doesn't hurt, but it looks a bit ugly.
Have a nice day,
Berny