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

Re: Argument list too long.



On Thu, Sep 11, 2003 at 06:23:15PM +0200, Dag Wieers wrote:
> You say the limit isn't reached very often in practice, I must beg to 
> differ.
> 
> The argument size is a balance between memory-usage and practical 
> considerations. Computers are becoming more powerful and people can do 
> more powerful things. So you see that such balances change from time 
> to time when computer-power increases and I think it is time to modify 
> this one too. (And yes, it should not be a Red Hat thing)

There are two competing tenets of Unix philosophy that have long
bumped heads:

	1. Design programs to be connected to other programs.

and
	2. Optimize for the common case.

If you look at the approach taken in the Linux kernel, arbitrary
limits are removed whenever (a) it can be done without vastly complicating
the code, and (b) the common case (i.e., "fast path") remains fast.

So if you can figure out how to keep execve() fast for the common case,
but handle a gigabyte arg list (and environment, while you are at it!),
without DoS, great.

Back in the days of MS-DOS, there were several different toolkits, like
MKS, that provided versions of the standard UNIX tools.  Since DOS limited
the arglist to some small (127 or 255, can't recall) characters, the
arg handling routines allowed one to specify an argument in the
format @pathname which would insert arguments from the file at the
specified location in the arglist.

For the exceptional cases that you discuss, this could be achieve in
userland several ways.  The simplest, which only works for non-set[ug]id
dynamically linked executables (i.e., the vast majority) is to wrap up
the required loader magic (e.g., LD_PRELOAD=/usr/lib/hugearglist.so in
a shell script, and invoke rpm as

	hugearglist rpm ...

[Alternatively, put it in /etc/ld.so.preload, and you don't need the
 hugearglist bit, but more caution is required.]

More difficult, but still workable, is to write hugearglist in C and
have it load the program directly.  A bit of ELF magic is
involved there.

One feature that one would want today is the option to separate
entries with '\0', ala "find -print0" and "xargs -0".

Regards,

	Bill Rugolsky




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