unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Grep exited abnormally with code 123
@ 2013-04-16 18:54 Andrew Pennebaker
  2013-04-16 19:11 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Pennebaker @ 2013-04-16 18:54 UTC (permalink / raw)
  To: Emacs Help

[-- Attachment #1: Type: text/plain, Size: 202 bytes --]

Often, M-x rgrep terminates early with this message in the minibuffer:

Grep exited abnormally with code 123



System:

* Emacs 24.2.1
* Windows XP SP3

-- 
Cheers,

Andrew Pennebaker
www.yellosoft.us

[-- Attachment #2: Type: text/html, Size: 423 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Grep exited abnormally with code 123
  2013-04-16 18:54 Grep exited abnormally with code 123 Andrew Pennebaker
@ 2013-04-16 19:11 ` Eli Zaretskii
  2013-04-16 21:08   ` Bob Proulx
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2013-04-16 19:11 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 16 Apr 2013 14:54:16 -0400
> From: Andrew Pennebaker <andrew.pennebaker@gmail.com>
> 
> Often, M-x rgrep terminates early with this message in the minibuffer:
> 
> Grep exited abnormally with code 123

According to this:

 http://superuser.com/questions/197031/grep-exits-abnormally-with-code-123-when-running-rgrep-on-emacs

this is "normal" (well, everything except the message).

Perhaps consider submitting a bug report.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Grep exited abnormally with code 123
  2013-04-16 19:11 ` Eli Zaretskii
@ 2013-04-16 21:08   ` Bob Proulx
  2013-04-17 22:27     ` Andrew Pennebaker
  0 siblings, 1 reply; 5+ messages in thread
From: Bob Proulx @ 2013-04-16 21:08 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii wrote:
> > Andrew Pennebaker wrote:
> > Often, M-x rgrep terminates early with this message in the minibuffer:
> > 
> > Grep exited abnormally with code 123
> 
> According to this:
> 
>  http://superuser.com/questions/197031/grep-exits-abnormally-with-code-123-when-running-rgrep-on-emacs
> 
> this is "normal" (well, everything except the message).

It is normal.  It just means that there were no grep hits.  If there
were grep hits then it would exit 0.  No grep hits and it is reporting
123.  It is a grep feature.

You are probably using emacs 23.  Emacs 23 uses find piped to xargs to
run grep.  That is an obsolete way of running it.  Emacs 24 now
defaults to using only find to run grep.  And in 24 if there are no
grep hits the return is captured and "Grep:exit [no match]" is
displayed instead of a non-zero exit code.  Therefore what you are
complaining about is already improved in the next version.

To understand where the 123 comes from start looking at the grep
documentation.  

  man 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.)

If there are no matches then grep exits 1.

The xargs command exit status is:

  man xargs
  EXIT STATUS
       xargs exits with the following 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.

       Exit codes greater than 128 are used by the shell to  indicate  that  a
       program died due to a fatal signal.

And since grep exits 1 with no matches then xargs exits 123 as
documented in the above table.

Emacs 23 and earlier:
  find . -type f -print0 | xargs -0 -e grep -nH -e PATTERN

Emacs 24:
  find . -type f -exec grep -nH -e PATTERN {} +

> Perhaps consider submitting a bug report.

Since it has already been addressed with a later version I would
simply update the default grep-find pattern to the new find-only
style.  Then it will be solved now.  Or upgrade to emacs 24. :-)
Or just understand that exit 123 means no grep matches.

You can customize the grep-find-command.  The v24 help for it says:

  grep-find-command is a variable defined in `grep.el'.
  Its value is ("find . -type f -exec grep -nH -e  {} +" . 34)
  Original value was nil

    This variable may be risky if used as a file-local variable.

  Documentation:
  The default find command for M-x grep-find.
  In interactive usage, the actual value of this variable is set up
  by `grep-compute-defaults'; to change the default value, use
  Customize or call the function `grep-apply-setting'.

Bob



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Grep exited abnormally with code 123
  2013-04-16 21:08   ` Bob Proulx
@ 2013-04-17 22:27     ` Andrew Pennebaker
  2013-04-17 22:41       ` Bob Proulx
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Pennebaker @ 2013-04-17 22:27 UTC (permalink / raw)
  To: Emacs Help

[-- Attachment #1: Type: text/plain, Size: 3226 bytes --]

No, I'm using Emacs 24, and grep is reporting matches, but halting early
(omitting matches as a result), and signaling 123.
On Apr 16, 2013 5:08 PM, "Bob Proulx" <bob@proulx.com> wrote:

> Eli Zaretskii wrote:
> > > Andrew Pennebaker wrote:
> > > Often, M-x rgrep terminates early with this message in the minibuffer:
> > >
> > > Grep exited abnormally with code 123
> >
> > According to this:
> >
> >
> http://superuser.com/questions/197031/grep-exits-abnormally-with-code-123-when-running-rgrep-on-emacs
> >
> > this is "normal" (well, everything except the message).
>
> It is normal.  It just means that there were no grep hits.  If there
> were grep hits then it would exit 0.  No grep hits and it is reporting
> 123.  It is a grep feature.
>
> You are probably using emacs 23.  Emacs 23 uses find piped to xargs to
> run grep.  That is an obsolete way of running it.  Emacs 24 now
> defaults to using only find to run grep.  And in 24 if there are no
> grep hits the return is captured and "Grep:exit [no match]" is
> displayed instead of a non-zero exit code.  Therefore what you are
> complaining about is already improved in the next version.
>
> To understand where the 123 comes from start looking at the grep
> documentation.
>
>   man 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.)
>
> If there are no matches then grep exits 1.
>
> The xargs command exit status is:
>
>   man xargs
>   EXIT STATUS
>        xargs exits with the following 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.
>
>        Exit codes greater than 128 are used by the shell to  indicate
>  that  a
>        program died due to a fatal signal.
>
> And since grep exits 1 with no matches then xargs exits 123 as
> documented in the above table.
>
> Emacs 23 and earlier:
>   find . -type f -print0 | xargs -0 -e grep -nH -e PATTERN
>
> Emacs 24:
>   find . -type f -exec grep -nH -e PATTERN {} +
>
> > Perhaps consider submitting a bug report.
>
> Since it has already been addressed with a later version I would
> simply update the default grep-find pattern to the new find-only
> style.  Then it will be solved now.  Or upgrade to emacs 24. :-)
> Or just understand that exit 123 means no grep matches.
>
> You can customize the grep-find-command.  The v24 help for it says:
>
>   grep-find-command is a variable defined in `grep.el'.
>   Its value is ("find . -type f -exec grep -nH -e  {} +" . 34)
>   Original value was nil
>
>     This variable may be risky if used as a file-local variable.
>
>   Documentation:
>   The default find command for M-x grep-find.
>   In interactive usage, the actual value of this variable is set up
>   by `grep-compute-defaults'; to change the default value, use
>   Customize or call the function `grep-apply-setting'.
>
> Bob
>
>

[-- Attachment #2: Type: text/html, Size: 3956 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Grep exited abnormally with code 123
  2013-04-17 22:27     ` Andrew Pennebaker
@ 2013-04-17 22:41       ` Bob Proulx
  0 siblings, 0 replies; 5+ messages in thread
From: Bob Proulx @ 2013-04-17 22:41 UTC (permalink / raw)
  To: help-gnu-emacs

Andrew Pennebaker wrote:
> No, I'm using Emacs 24, and grep is reporting matches, but halting early
> (omitting matches as a result), and signaling 123.

Please run the exact same grep command manually.  What is the
resulting output?  What is the exit code?  If it is doing something
strange then that is the next place to go to understand it.

Bob



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-04-17 22:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-16 18:54 Grep exited abnormally with code 123 Andrew Pennebaker
2013-04-16 19:11 ` Eli Zaretskii
2013-04-16 21:08   ` Bob Proulx
2013-04-17 22:27     ` Andrew Pennebaker
2013-04-17 22:41       ` Bob Proulx

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).