zsh-workers
 help / color / mirror / code / Atom feed
* export limit in zsh and other shells?
@ 1999-06-03  2:49 Nik Gervae
  1999-06-03  3:43 ` Geoff Wing
  0 siblings, 1 reply; 3+ messages in thread
From: Nik Gervae @ 1999-06-03  2:49 UTC (permalink / raw)
  To: zsh-workers

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.

Here's what I used to generate a test file to source:

  (i=0; while [[ ${i} -lt 600 ]] ; do
  echo "foo${i}=\"a nice long string to see what happens ${i}\""
  i=$[i + 1]
  done) >>| /tmp/vartest

--

Nik Gervae < nik at linna dot com >
Writer, coder, vegan, dilettante



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: export limit in zsh and other shells?
  1999-06-03  2:49 export limit in zsh and other shells? Nik Gervae
@ 1999-06-03  3:43 ` Geoff Wing
  1999-06-03  4:13   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Geoff Wing @ 1999-06-03  3:43 UTC (permalink / raw)
  To: zsh-workers

Nik Gervae <nik@linna.com> 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@pobox.com>            Mobile : (Australia) 0413 431 874
Work URL: http://www.primenet.com.au/   Ego URL: http://pobox.com/~gcw/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: export limit in zsh and other shells?
  1999-06-03  3:43 ` Geoff Wing
@ 1999-06-03  4:13   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 1999-06-03  4:13 UTC (permalink / raw)
  To: Nik Gervae, zsh-workers

On Jun 2,  7:49pm, Nik Gervae wrote:
} Subject: export limit in zsh and other shells?
}
} 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

On Jun 3,  3:43am, Geoff Wing wrote:
} Subject: Re: export limit in zsh and other shells?
}
} And all the shells spew out the same message.  It's an operating system
} limit on argument lists.
} 
} 	% sysctl kern.argmax
} 	kern.argmax = 262144
} which is described as "The maximum bytes of argument to execve(2)."

The important point to note here is that "argument to execve(2)" includes
both the `argv' and `envp' arrays.  Although passed to execve() as two
pointers (char*[]), when the kernel prepares a new process image for
execution it copies the entirety of both arrays into a contiguous chunk
of memory.  The `argmax' kernel parameter in Geoff's example sets the
size of that chunk.

In short, you may have to find a different way to control your animations.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-06-03  4:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-03  2:49 export limit in zsh and other shells? Nik Gervae
1999-06-03  3:43 ` Geoff Wing
1999-06-03  4:13   ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).