Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: export limit in zsh and other shells?



Nik Gervae <nik@xxxxxxxxx> typed:
:Here at PDI we use a TON of environment variables to control many aspects of
:our animation jobs. Just today a user came to me complaining that when he
:loaded *all* of these variables into his zsh session he got output like
:this:
:  % ls
:  zsh: arg list too long: ls
:I did a little research and have discovered that just about every shell we
:have here--sh, bash, csh, tcsh, and zsh--exhibit this behavior when presented
:with a couple hundred exported/environment variables. Many of these variables
:are strings, by the way, so I suspect this might cause some kind of memory
:buffer overrrun. Don't quote me on that, though.

And all the shells spew out the same message.  It's an operating system
limit on argument lists.  Some systems may let you alter this while up
(though I don't know of any), some need a kernel recompile (I've a vague
memory of doing this on my system once though I would have to rework out
how), some don't let you alter it at all.

My NetBSD system has a read-only value (queried with 4.4BSD-based ``sysctl''):
	% sysctl kern.argmax
	kern.argmax = 262144
which is described as "The maximum bytes of argument to execve(2)."

Regards,
-- 
Geoff Wing   <gcw@xxxxxxxxx>            Mobile : (Australia) 0413 431 874
Work URL: http://www.primenet.com.au/   Ego URL: http://pobox.com/~gcw/



Messages sorted by: Reverse Date, Date, Thread, Author