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

                 Summary: xargs -s VERYLARGE issues diagnostic when POSIX
would likely prefer not
                   Group: findutils
               Submitter: jay
               Submitted: Mon 20 Jul 2026 02:00:17 PM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: jay
         Originator Name:
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Unlocked
                 Release: 4.11.0
           Fixed Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Mon 20 Jul 2026 02:00:17 PM UTC By: James Youngman <jay>

$ echo 1  | env POSIXLY_CORRECT=1 xargs  -s
100000000000000000000000000000000000000000000000 echo
xargs: value 100000000000000000000000000000000000000000000000 for -s option
should be <= 2092931


However, POSIX specifically says that too large a value for -s is not an
error.   The implication is that if this is the only problem with the command
line and there is no other error, xargs must exit with status 0.   

Less clear is whether a ("warning") diagnostic is allowed.    

POSIX utilities are often constrained by the way POSIX sets out the default
behaviour in the STDERR section (see the Shell and Utilities volume of
POSIX.1-2024):

> Default Behavior: When this section is listed as "The standard error shall be
> used only for diagnostic messages.", it means that, unless otherwise stated,
> the diagnostic messages shall be sent to the standard error only when the
> exit status indicates that an error occurred and the utility is used as
> described by this volume of POSIX.1-2024.

In the case of xargs though, the STDERR section doesn't say "The standard
error shall be used only for diagnostic messages." but instead says:

> The standard error shall be used for diagnostic messages and the -t and -p
> options. If the -t option is specified, the utility and its constructed
> argument list shall be written to standard error, as it will be invoked,
> prior to invocation. If -p is specified, a prompt of the following format
> shall be written (in the POSIX locale): "?..." at the end of the line of the
> output from -t.


I suspect that this means that the combination of a message on stderr and an
exit status of 0 would be conforming (even if neither -t nor -p were in use).
 Even though this is likely not what the writer(s) intended for the case where
the argument of "-s" is too large.

For the sake of argument, while considering this issue, we could assume that
the argument of -s is in excess of some system limit, but still no greater
than 2147483647 (since "Base Definitions" section 12.1 Utility Argument Syntax
requires us to recognise such a value as syntactically valid even if it
exceeds a limit).










    _______________________________________________________

Reply to this item at:

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

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

Attachment: signature.asc
Description: PGP signature

Reply via email to