URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=14550>

                 Summary: xargs --help breaks with over-large environ
                 Project: findutils
            Submitted by: None
            Submitted on: Fri 09/16/05 at 16:19
                Category: xargs
                Severity: 3 - Normal
              Item Group: Wrong result
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: Eric Blake
        Originator Email: [EMAIL PROTECTED]
             Open/Closed: Open
                 Release: 4.2.25
           Fixed Release: None

    _______________________________________________________

Details:

Background: A recent cygwin bug report exposed a flaw in some Windows
versions - Windows does not document a maximum environment size, only that
individual environment variables must not exceed 32k; meanwhile the command
line is in independent memory from environ and is capped at 32k.  This does
not map very well to cygwin and the idea of ARG_MAX.  As a result, it is
possible to have an environment that exceeds 32k, but which is still seen by
the child process.  For an example:
$ foo=`perl -e 'print "a"x31000'`
$ export foo
$ /bin/env | wc -c
34664

Bug: xargs ALWAYS tries to calculate its buffer range, prior to parsing argv.
 As a result, when the environment leads to an impossible situation (such as
cygwin having a larger environment than the useful 32k ARG_MAX), --help no
longer works:
$ xargs --help
xargs: environment is too large for exec
$ xargs --version
xargs: environment is too large for exec

Instead, xargs should parse argv FIRST, because --help and --version should
not fail (since xargs does not have to exec any subprocess).




    _______________________________________________________

Carbon-Copy List:

CC Address                          | Comment
------------------------------------+-----------------------------
ebb9 --AT-- byu --DOT-- net         | Originator Email




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=14550>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-findutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-findutils

Reply via email to