Re: [PATCH 3/6] doc: xargs does not use the (128+sig) convention of /bin/sh.
On 7/9/26 00:35, James Youngman wrote:
On Wed, Jul 8, 2026 at 10:33 PM Bernhard Voelker
wrote:
hmm, did I miss a patch? I don't see a fix for that line pushed.
My apologies, I had confused the STANDARDS CONFORMANCE change I had
made with the change that you were pointing out as still being needed.
I have now pushed a change making this consistent.
Great, I pushed another commit to do the same in the Texinfo manual.
Have a nice day,
Berny
From 12dc73a97cbf254dab96d74ab1f82c1b46566769 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker
Date: Thu, 9 Jul 2026 08:38:07 +0200
Subject: [PATCH] doc: propagate recent xargs exit status changes from find.1
to find.texi
This merges the changes of recent commit 1c2c1fcc33d from the xargs
manpage to the Texinfo manual.
* doc/find.texi (Invoking xargs): exit status 123 also covers cases where
the command's (normal) exit status was a value greater than 125.
Explain that xargs might in the future use other values in the 2-233
range to indicate other failure modes.
Improve the hint that xargs uses execvp rather than invoking via the shell.
---
doc/find.texi | 15 +++
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/doc/find.texi b/doc/find.texi
index 4868a17d..eaa3dc35 100644
--- a/doc/find.texi
+++ b/doc/find.texi
@@ -3981,9 +3981,11 @@ standard input.
@table @asis
@item 0
-if it succeeds
+if it succeeds (and any commands run by @code{xargs},
+if there were any, exited normally with exit status 0).
@item 123
-if any invocation of the command exited with status 1-125
+if any invocation of the command exited with status other than 0 or
+255 (though see below).
@item 124
if the command exited with status 255
@item 125
@@ -3996,9 +3998,14 @@ if the command is not found
if some other error occurred.
@end table
+It is possible that future versions of @code{xargs}
+may exit with a status in the range 1-125 when the command it
+launched fails in some specific way not listed above.
+Nevertheless, @code{xargs} will comply with POSIX.
-The commands run by @code{xargs} are not invoked via the shell. The
-shell's @math{128 + n} convention for reporting that a process had
+The commands run by @code{xargs} are run directly (with @code{execvp()}
+rather than being invoked via the shell.
+The shell's @math{128 + n} convention for reporting that a process had
been killed by a signal is not used by @code{xargs}.
@menu
--
2.54.0
Re: [PATCH 3/6] doc: xargs does not use the (128+sig) convention of /bin/sh.
On Wed, Jul 8, 2026 at 10:33 PM Bernhard Voelker wrote: > hmm, did I miss a patch? I don't see a fix for that line pushed. My apologies, I had confused the STANDARDS CONFORMANCE change I had made with the change that you were pointing out as still being needed. I have now pushed a change making this consistent. James.
Re: [PATCH 3/6] doc: xargs does not use the (128+sig) convention of /bin/sh.
On 7/8/26 10:10, James Youngman wrote:
On Tue, Jul 7, 2026 at 8:15 AM Bernhard Voelker
Therefore, the documentation fix would be:
- 125if any invocation of the command exited with status 1-125
+ 125if any invocation of the command exited with status 1-254
WDYT?
Another patch in the sequence addresses the problem you mentioned.
hmm, did I miss a patch? I don't see a fix for that line pushed.
The pushed series shows the correct command exit code mapping to 125
in the new POSIX EXIT STATUS REQUIREMENTS subsection, that's nice.
For the wrong line in the section EXIT STATUS I suggest the attached patch.
WDYT?
Have a nice day,
Berny
From 9407b3578383e26be4f31fe5cec28f0e9ef07f28 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker
Date: Wed, 8 Jul 2026 23:24:08 +0200
Subject: [PATCH] doc: further clarify the exit status of xargs
* doc/find.texi (Invoking xargs): Clarify that xargs only exits with 0
if all of the command invocations succeeded.
For xargs exit code 123, fix the range of the exit codes of the invoked
command from 1-125 to 1-254.
Add a sentence clarifying that xargs terminates as soon as possible when
it exits with status 125-128.
* xargs/xargs.1 (EXIT STATUS): Likewise.
---
doc/find.texi | 7 +--
xargs/xargs.1 | 8 ++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/doc/find.texi b/doc/find.texi
index 4868a17d..b336e592 100644
--- a/doc/find.texi
+++ b/doc/find.texi
@@ -3981,9 +3981,9 @@ standard input.
@table @asis
@item 0
-if it succeeds
+if all invocations of the command succeeded and exited with status 0
@item 123
-if any invocation of the command exited with status 1-125
+if any invocation of the command exited with status 1-254.
@item 124
if the command exited with status 255
@item 125
@@ -3996,6 +3996,9 @@ if the command is not found
if some other error occurred.
@end table
+In the cases of the @code{xargs} exit codes 125, 126, 127 and 128, the tool
+terminates as soon as possible, and does therefore not process any further
+input.
The commands run by @code{xargs} are not invoked via the shell. The
shell's @math{128 + n} convention for reporting that a process had
diff --git a/xargs/xargs.1 b/xargs/xargs.1
index e140581f..78613091 100644
--- a/xargs/xargs.1
+++ b/xargs/xargs.1
@@ -540,9 +540,9 @@ Generates a compact listing of all the users on the system.
exits with the following status:
.RS
.IP 0
-if it succeeds
+if all invocations of the command succeeded and exited with status 0
.IP 123
-if any invocation of the command exited with status 1\*(en125
+if any invocation of the command exited with status 1\*(en254
.IP 124
if the command exited with status 255
.IP 125
@@ -556,6 +556,10 @@ if some other error occurred.
.RE
.
.P
+In the cases of the xargs exit codes 125, 126, 127 and 128, the tool terminates
+as soon as possible, and does therefore not process any further input.
+.
+.P
The commands run by
.B xargs
are not invoked via the shell.
--
2.54.0
Re: [PATCH 3/6] doc: xargs does not use the (128+sig) convention of /bin/sh.
Another patch in the sequence addresses the problem you mentioned.
On Tue, Jul 7, 2026 at 8:15 AM Bernhard Voelker
wrote:
>
> Hi James,
>
> On 7/6/26 22:06, James Youngman wrote:
> > * doc/find.texi: Point out that xargs does not launch commands via the
> > shell and does not use the "128 + signal" convention used for $? in
> > the shell.
> > * xargs/xargs.1: Likewise.
> > ---
> > doc/find.texi | 5 +++--
> > xargs/xargs.1 | 8 ++--
> > 2 files changed, 9 insertions(+), 4 deletions(-)
> >
> > diff --git a/doc/find.texi b/doc/find.texi
> > index f693db8c..71b80f53 100644
> > --- a/doc/find.texi
> > +++ b/doc/find.texi
> > @@ -3996,9 +3996,10 @@ if the command is not found
> > if some other error occurred.
> > @end table
> >
> > -Exit codes greater than 128 are used by the shell to indicate that
> > -a program died due to a fatal signal.
> >
> > +The commands run by @code{xargs} are not invoked via the shell. The
> > +shell's @math{128 + n} convention for reporting that a process had
> > +been killed by a signal is not used by @code{xargs}.
>
> While this is correct and, well, describes what xargs does _not_ do,
> I think the confusion of the recent bug report stems from the following row
> of the table with the exit codes:
>
>125if any invocation of the command exited with status 1-125
> ___^^^
>
> This is not the complete range:
>
>for f in $(seq 120 130); do echo $f | xargs -I'{}' sh -c 'set -x; exit
> "{}"' sh; echo $?; done
>+ exit 120
>123
>+ exit 121
>123
>+ exit 122
>123
>+ exit 123
>123
>+ exit 124
>123
>+ exit 125
>123
>+ exit 126
>123
>+ exit 127
>123
>+ exit 128
>123
>+ exit 129
>123
>+ exit 130
>123
>
> The practical range for exit is 0-255.
> And xargs(1) itself exits with 123 for all command exit values in 1..254.
> Only 0 and 255 are treated different.
>
># For all command exit codes, find the ones which make xargs(1) not exit
> with 123.
># Finally demonstrate that 256 overflows to 0 (in the shell process, not
> in xargs).
>for f in $(seq 0 256); do \
> echo $f | xargs -I'{}' sh -c 'exit "{}"' sh; \
> ret=$?; \
> test $ret != 123 \
>&& echo "$f -> $ret"; \
>done
>0 -> 0
>xargs: sh: exited with status 255; aborting
>255 -> 124
>256 -> 0
>
> Therefore, the documentation fix would be:
>
> - 125if any invocation of the command exited with status 1-125
> + 125if any invocation of the command exited with status 1-254
>
> WDYT?
>
> Have a nice day,
> Berny
>
Re: [PATCH 3/6] doc: xargs does not use the (128+sig) convention of /bin/sh.
Hi James,
On 7/6/26 22:06, James Youngman wrote:
* doc/find.texi: Point out that xargs does not launch commands via the
shell and does not use the "128 + signal" convention used for $? in
the shell.
* xargs/xargs.1: Likewise.
---
doc/find.texi | 5 +++--
xargs/xargs.1 | 8 ++--
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/doc/find.texi b/doc/find.texi
index f693db8c..71b80f53 100644
--- a/doc/find.texi
+++ b/doc/find.texi
@@ -3996,9 +3996,10 @@ if the command is not found
if some other error occurred.
@end table
-Exit codes greater than 128 are used by the shell to indicate that
-a program died due to a fatal signal.
+The commands run by @code{xargs} are not invoked via the shell. The
+shell's @math{128 + n} convention for reporting that a process had
+been killed by a signal is not used by @code{xargs}.
While this is correct and, well, describes what xargs does _not_ do,
I think the confusion of the recent bug report stems from the following row
of the table with the exit codes:
125if any invocation of the command exited with status 1-125
___^^^
This is not the complete range:
for f in $(seq 120 130); do echo $f | xargs -I'{}' sh -c 'set -x; exit "{}"'
sh; echo $?; done
+ exit 120
123
+ exit 121
123
+ exit 122
123
+ exit 123
123
+ exit 124
123
+ exit 125
123
+ exit 126
123
+ exit 127
123
+ exit 128
123
+ exit 129
123
+ exit 130
123
The practical range for exit is 0-255.
And xargs(1) itself exits with 123 for all command exit values in 1..254.
Only 0 and 255 are treated different.
# For all command exit codes, find the ones which make xargs(1) not exit with
123.
# Finally demonstrate that 256 overflows to 0 (in the shell process, not in
xargs).
for f in $(seq 0 256); do \
echo $f | xargs -I'{}' sh -c 'exit "{}"' sh; \
ret=$?; \
test $ret != 123 \
&& echo "$f -> $ret"; \
done
0 -> 0
xargs: sh: exited with status 255; aborting
255 -> 124
256 -> 0
Therefore, the documentation fix would be:
- 125if any invocation of the command exited with status 1-125
+ 125if any invocation of the command exited with status 1-254
WDYT?
Have a nice day,
Berny
