GNU bug report logs - #74159
Unexpected exit code of 0 when -q is set and close_stdout fails

Previous Next

Package: grep;

Reported by: Jan Černohorský <jan <at> kam.mff.cuni.cz>

Date: Fri, 1 Nov 2024 13:22:04 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jan Černohorský <jan <at> kam.mff.cuni.cz>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 74159-done <at> debbugs.gnu.org, wizards <at> kam.mff.cuni.cz
Subject: bug#74159: Unexpected exit code of 0 when -q is set and close_stdout fails
Date: Sun, 3 Nov 2024 23:22:10 +0100
Thank you for your very swift reply and fix.

>>when the `-q` option is detected (grep.c:2697), the `exit_failure` 
>>variable is set to 0. This causes any error, when not specially 
>>handled, to exit with 0, even before any match is found.
>
>Yes, that's a mistake. I can't reproduce your bug but I can see other 
>consequences of the mistake. Fixed in the attached patch (with a test 
>case that's unlike your problem); please give it a try.

The provided patch fixes the issue 👍

>That being said, the lower levels of your OS appear to be buggy, as 
>'close' should not fail with EACCES. I wouldn't be surprised if other 
>software breaks because of this issue. So I suggest also reporting a 
>bug to whoever maintains the NFS client code that you're using.

I'm aware. I'll try to look into it, but it seems like a much deeper 
rabbit hole.


Thanks again,
Jan




This bug report was last modified 202 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.