URL:
  <https://savannah.gnu.org/bugs/?68501>

                 Summary: Manual unclear about exit codes 128 through 254
                   Group: findutils
               Submitter: l0b0
               Submitted: Sun 05 Jul 2026 02:18:01 PM CEST
                Category: xargs
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Wrong result
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name:
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Unlocked
                 Release: 4.10.0
           Fixed Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sun 05 Jul 2026 02:18:01 PM CEST By: Victor Engmark <l0b0>
The relevant part of `man xargs`:

```man
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
pro‐
     gram died due to a fatal signal.
```

Despite the last paragraph, there's nothing stopping a script from running
`exit 128` or higher to achieve the same result as receiving a fatal signal.
But the manual snippet above doesn't indicate what xargs returns when the exit
code of the command is 128 through 254. I guessed from the last paragraph that
it would return the original exit code of the first/last failing command, but
that is not the case:

```console
$ echo 126 | xargs -I{} bash -c 'exit {}'; echo $?
123
$ echo 127 | xargs -I{} bash -c 'exit {}'; echo $?
123
$ echo 128 | xargs -I{} bash -c 'exit {}'; echo $?
123
$ echo 254 | xargs -I{} bash -c 'exit {}'; echo $?
123
```

So it looks like the note for exit code 123 should be amended to say "1-254"
rather than "1-125". The final paragraph about fatal signals can probably be
removed.

Version:

```console
$ xargs --version
xargs (GNU findutils) 4.10.0
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Eric B. Decker, James Youngman, and Kevin Dalley.
```







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?68501>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to