Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

/bin/sh - enlarge buffer for argument list

34 views
Skip to first unread message

David Murphy

unread,
Mar 7, 2001, 12:46:08 PM3/7/01
to
Is there some environment variable I can set to increase the argument
list size on AIX. Using AIX v4.3.3, and the script I have is linking a
lot of object files with libtool, and I run out of space, error is:

/bin/sh: /bin/sh: arg list is too long

Now I am almost at the end of my list of arguments and extending the
space, if I can, would be the quick and easy solution, otherwise it is
back to creating a convenience library.

Have only be playing with AIX a while, so any info. gladly received.


--
Regards David Murphy, Novell Inc. Ph.801-861 2117, e-mail
dmu...@novell.com


Greg Wimpey

unread,
Mar 7, 2001, 5:41:25 PM3/7/01
to David Murphy
David Murphy <dmu...@novell.com> writes:

> Is there some environment variable I can set to increase the argument
> list size on AIX. Using AIX v4.3.3, and the script I have is linking a
> lot of object files with libtool, and I run out of space, error is:
>
> /bin/sh: /bin/sh: arg list is too long

I believe that this is a system defined limit, NCARGS in sys/param.h ,
as mentioned in the exec() man page. NCARGS, in turn, is defined to
be the same as ARG_MAX in sys/limits.h, which is 24576 in AIX 4.3.3.
There is also _POSIX_ARG_MAX, which is 4096. I'm not sure if any
system commands use this value. This limit is enforced by exec(), not
by the shell, so I don't think that there is much you can do.

--
Greg Wimpey

Simon T(Bob Bobson)

unread,
Mar 7, 2001, 10:39:25 PM3/7/01
to

David Murphy wrote:
>
> /bin/sh: /bin/sh: arg list is too long
>
> Now I am almost at the end of my list of arguments and extending the
> space, if I can, would be the quick and easy solution, otherwise it is
> back to creating a convenience library.
>
> Have only be playing with AIX a while, so any info. gladly received.

Right, break out the spurs.
It depends on how you supply the arg list. For instance, if you were
to say "# some-cmd /usr/bloodylongname/evenlongernamefornogoodreason/*"
your list could be bloody huge.

IF, however, you
# cd /usr/bloodylongname/evenlongernamefornogoodreason/*

then
# some-cmd *

You may find it's a goer because the repeating of /usr/bloo... doesn't
occur. Testing?
Relatively easy - do an "echo *", "echo /usr/*" or whatever to see
if it fails.

Simon Travaglia
http://bofh.ntk.net

J.Smith

unread,
Mar 8, 2001, 3:08:58 PM3/8/01
to

Dunno how to handle this with libtool in particular, but for shell scripts
and such, the xargs command was designed to solve these issues.

For example lets assume that mycommand only accepts one argument at a time
before it will start generating the "arg list is too long" error.
Then the command
echo too many arguments | xargs -s 1 mycommand
executes
mycommand too
mycommand many
mycommand arguments

Hope this helps.

----------------------------------------------------------------------------

XARGS(1)

NAME
xargs - construct argument list(s) and executes utility

SYNOPSIS
xargs [-0] [-t] [-n number [-x]] [-s size] [utility [argument ...]]

DESCRIPTION
The xargs utility reads space, tab, newline and end-of-file delimited
ar­
guments from the standard input and executes the specified utility with
them as arguments.

The utility and any arguments specified on the command line are given
to
the utility upon each invocation,


----------------------------------------------------------------------------

"David Murphy" <dmu...@novell.com> wrote in message
news:3AA673DF...@novell.com...

Pete Forman

unread,
Mar 9, 2001, 7:48:37 AM3/9/01
to
IIRC the same space is shared by command line arguments and
environment variables. Try unsetting unnecessary env vars.
--
Pete Forman -./\.- Disclaimer: This post is originated
WesternGeco -./\.- by myself and does not represent
pete....@westerngeco.com -./\.- opinion of Schlumberger, Baker
http://www.crosswinds.net/~petef -./\.- Hughes or their divisions.

Christer Palm

unread,
Mar 14, 2001, 1:33:54 PM3/14/01
to
David Murphy wrote:
>
> Is there some environment variable I can set to increase the argument
> list size on AIX. Using AIX v4.3.3, and the script I have is linking a
> lot of object files with libtool, and I run out of space, error is:
>
> /bin/sh: /bin/sh: arg list is too long
>
No, this buffer is fixed size, but if I remember correctly it is shared
with the environment so removing some environment variables may help you
through the problem.
Having said that, careful coding can avoid the problem. xargs is a great
tool for this for example.
palm.vcf
0 new messages