bugfindutils - Bugs: bug #42937, xargs --show-limits environment...


bug #42937: xargs --show-limits environment size subtracted twice possibly

Submitter:  None
Submitted:  Thu 07 Aug 2014 06:29:20 PM UTC
Category:  xargs Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Originator Name:  Donald Zoch Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  4.4.2
Fixed Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Thu 18 Sep 2014 08:39:42 PM UTC, comment #2: 

Working on a test to check to confirm this is not happening.

Scott Jewloszewicz-Clarke <swjclarke>
Sun 10 Aug 2014 10:38:53 AM UTC, comment #1: 

This seems correct to me, however, then also the output for
 "POSIX upper limit on argument length (this system)"
should be fixed, too, because that should reflect the
original limit without 'size_of_environment' already being
subtracted. This amends to:

diff --git a/xargs/xargs.c b/xargs/xargs.c
index 89e78a3..673fdc0 100644
--- a/xargs/xargs.c
+++ b/xargs/xargs.c
@@ -696,13 +696,13 @@ main (int argc, char **argv)
              (uintmax_t)bc_size_of_environment ());
       fprintf (stderr,
              _("POSIX upper limit on argument length (this system): %" PRIuMAX "\n"),
-             (uintmax_t)bc_ctl.posix_arg_size_max);
+             (uintmax_t)bc_get_arg_max ());
       fprintf (stderr,
              _("POSIX smallest allowable upper limit on argument length (all systems): %" PRIuMAX "\n"),
       fprintf (stderr,
              _("Maximum length of command we could actually use: %" PRIuMAX "\n"),
-             (uintmax_t)(bc_ctl.posix_arg_size_max - bc_size_of_environment ()));
+             (uintmax_t)(bc_ctl.posix_arg_size_max));
       fprintf (stderr,
              _("Size of command buffer we are actually using: %" PRIuMAX "\n"),

Bernhard Voelker <berny>
Group administrator
Thu 07 Aug 2014 06:29:20 PM UTC, original submission:  


We have some code that parses the output of

xargs -show-limits

specifically the

"Maximum length of command we could actually use"  line

We noticed when updating from findutils 4.2.30 to 4.4.2 that it appeared the
number was different and it appeared that the
environment size was being subtracted twice.

I notice in findutils 4.2.30 that line 446 in buildcmd.c doesn't actually
modify ctl->posix_arg_size_max

ctl->posix_arg_size_max - size_of_environment;

This was changed/corrected  to

ctl->posix_arg_size_max -= size_of_environment;

in findutils 4.4.2, buildcmd.c line 479

So in xargs.c, should line 699 be changed to not subtract the environment again?

<             (unsigned long)(bc_ctl.posix_arg_size_max -
<                             bc_size_of_environment()));

>             (unsigned long)bc_ctl.posix_arg_size_max);

Thank you

Donald Zoch



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by swjclarke (Posted a comment)
  • -email is unavailable- added by berny (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code