[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

issue with xargs

From: Hunter Peress
Subject: issue with xargs
Date: 26 Apr 2002 10:02:20 -0400

xargs says it the largest arg it can take per command line is 20k chars
which is "the largest possible".
In bash I can easily put over 10x that amount.

The amount seems to differ by machine, maybe has to do with amount of
memory, or kernel...
from man xargs:
--max-chars=max-chars, -s max-chars
              Use  at most max-chars characters per command line,
              including the command and initial arguments and the
              terminating  nulls  at  the  ends  of  the argument
              strings.  The default is as large as  possible,  up
              to 20k characters.

I wish to use xargs for this feature, so that if the input IS greater
than this "max", then xargs will naturally just create the another
instance of the command with the remaining arguments.


Do you think it's necessary to update the program such that xargs
reflects whatever the system can support in terms of length of command
line, OR, to arbitrarily cap it off at 20k, or some other optimal value.

The reason i use xargs in this case is to reduce the amount of forking
that happens with a whole bunch of arguments.

Anyway what tests do you think should be done to determine whether such
a change is warranted.I might volunteer to produce a set of reproducible
tests as I wish to 'cut my teeth'.

Here is the cute python program I used to test bash for max length:

import sys
if len(sys.argv) < 2: 
  print "missing arg"
#This ensures the exact amount of chars that argv[1]
stropen="echo '"
numc = int(sys.argv[1])-c


reply via email to

[Prev in Thread] Current Thread [Next in Thread]