From: Andrew Pennebaker <andrew.pennebaker@gmail.com>
To: Emacs Help <help-gnu-emacs@gnu.org>
Subject: Re: Grep exited abnormally with code 123
Date: Wed, 17 Apr 2013 18:27:07 -0400 [thread overview]
Message-ID: <CAHXt_SU=zpktEF+x7C_TEp9FBkAqZJCT6-QENEtKXeUViO=kRA@mail.gmail.com> (raw)
In-Reply-To: <20130416210815.GA7232@hysteria.proulx.com>
[-- 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 --]
next prev parent reply other threads:[~2013-04-17 22:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2013-04-17 22:41 ` Bob Proulx
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHXt_SU=zpktEF+x7C_TEp9FBkAqZJCT6-QENEtKXeUViO=kRA@mail.gmail.com' \
--to=andrew.pennebaker@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.