bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#9226: 23.3; [rgrep]; (matches found) ?


From: Juri Linkov
Subject: bug#9226: 23.3; [rgrep]; (matches found) ?
Date: Wed, 10 Aug 2011 18:10:27 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu)

> 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".





reply via email to

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