help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] What affects the number of arguments allowed?


From: Eric Blake
Subject: Re: [Help-bash] What affects the number of arguments allowed?
Date: Mon, 10 Dec 2018 21:00:38 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1

On 12/10/18 7:47 PM, Peng Yu wrote:
Hi,

The following test case runs differently on different terminals
(tested on Mac OS X). Sometimes, it fails sometimes, it does not.

Somebody says it is determined by kern.argmax Mac OS X. There are
obviously other factors affecting the limit.

Yes, the size of the environment variables often affects the limits (although the effect may depend on your operating system). That is, on a single system, if the kernel shares the storage used for sharing argv and environ from a parent process to its child, then having more (or longer) variables defined in the environment reduces the amount of space remaining for command line arguments.


https://stackoverflow.com/questions/43305775/osx-sierra-argument-list-too-long

How does bash determine this limit?

Bash doesn't. The kernel does. Bash just reports the E2BIG that the kernel uses to fail an execve() with too much data to pass on to the child.

Is there a command that one can
predetermine what is a legitimate length instead of trying it and
fails?

If you have GNU Findutils available, 'xargs --show-limits' tries pretty hard to come up with reasonable numbers.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

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