GNU bug report logs -
#9226
23.3; [rgrep]; (matches found) ?
Previous Next
Reported by: Dave Abrahams <dave <at> boostpro.com>
Date: Wed, 3 Aug 2011 01:42:02 UTC
Severity: normal
Found in version 23.3
Done: Juri Linkov <juri <at> jurta.org>
Bug is archived. No further changes may be made.
Full log
Message #14 received at 9226 <at> debbugs.gnu.org (full text, mbox):
> I suggest we remove this "matches found" thingy. It was meant to be
> a feature, but in the case where it works (i.e. for `grep') the rest of
> the output already gives the information anyway.
>
> We can replace it with the exit status code instead: it's more cryptic
> but at least it never lies.
It would be too bad to lose this useful feature that helps
to quickly see the status in the last line of the output
and in the mode line.
What we definitely know now is that:
GREP EXIT STATUS
The exit status is 0 if selected lines are found,
and 1 if not found. If an error occurred the exit status is 2.
(Note: POSIX error handling code should check for '2' or greater.)
FIND EXIT STATUS
find exits with status 0 if all files are processed successfully,
greater than 0 if errors occur. This is deliberately a very
broad description, but if the return value is non-zero, you
should not rely on the correctness of the results of find.
XARGS EXIT STATUS
0 if it succeeds
123 if any invocation of the command exited with status 1-125
124 if the command exited with status 255
125 if the command is killed by a signal
126 if the command cannot be run
127 if the command is not found
1 if some other error occurred.
and currently process the following cases in grep.el:
0 finished (matches found)
1 finished with no matches found
* exited abnormally with code %d
So to never lie to the users and determine reliably
the status we could use the following logic:
If status is 0 and the output is not empty:
Grep finished (matches found)
Otherwise:
Grep exited with status %d
These changes completely remove the case of status 1 that displayed
"finished with no matches found", and also remove the word "abnormally"
from the message of remaining cases, because we can't reliably determine
the case of "no matches found" by checking status 123 of a command line
that contains "xargs".
This bug report was last modified 13 years and 307 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.