[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua5.1: Lua stack is too small for a script that takes over 2048 arguments
- From: Gé Weijers <ge@...>
- Date: Wed, 19 Dec 2007 22:27:18 -0800
This is a bit of a problem.
Alternatively the arguments could be passed in as a single argument,
i.e. an array, or a userdata object pretending to be a read-only
array (implementing the length and index operations). The userdata
object would not require the allocation of a potentially massive
array to store a copy of the argument vector, but would copy the
contents of 'argv' to the lua interpreter one string at a time.
The worst case argument vector would be about ARG/MAX zero-byte
strings, which would require LUAI_MAXCSTACK to be equal to ARG_MAX,
i.e. insanely large.
On Dec 19, 2007, at 4:03 PM, Norman Ramsey wrote:
I just got this rather unhappy result:
: nr@homedog 10445 ; label-by-hand -udir /home/nr/tmp/tt2 *
lua5.1: stack overflow (too many arguments to script)
It seems to me that the Lua interpreter should accept as many
arguments as the local operating system is willing to provide. This
number is fairly fuzzy (see http://tinyurl.com/nn8yd for a good
discussion of the issues), but the current default of 2048 is
unreasonably small for a stock Debian system. ARG_MAX is 131072 on
this system, so supposing we assume each argument is an 8.3 pathname
with a trailing null, even leaving room for some environment this is
space for about ten thousand arguments. I suggest that when Lua is
built for Debian that line 445 of luaconf.h be changed so that
LUAI_MAXCSTACK is more in that range.
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (500, 'testing'), (500, 'stable'), (50, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.22-3-k7 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash
Versions of packages lua5.1 depends on:
ii libc6 2.7-3 GNU C Library: Shared
ii libreadline5 5.2-3 GNU readline and
lua5.1 recommends no packages.
-- no debconf information