Enrico Tassi wrote: > On Wed, Dec 19, 2007 at 07:03:46PM -0500, Norman Ramsey wrote: >> Package: lua5.1 >> Version: 5.1.2-4 >> Severity: normal >> >> 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. > > Citing luaconf.h: > > This limit is arbitrary; its only purpose is to stop C > functions to consume unlimited stack space. > > So it seems safe to increase this parameter. The only thing that bothers > me is that you may end up writing a lua script that works pretty well on > Debian, but won't run on Fedora/Gentoo/Windows/OSX or any other platform on > which lua has been compiled with *default* options. > > I suggest you to make your script accept a path (root directory) and > iterate on its contents with lfs.dir (liblua5.1-filesystem0 in debian). > This should work even for extremely populated directories and is pretty > portable too. lfs also supports a function to check if a given path is a > directory (thus the current semantics of your script can be preserved). > Your command line should then be changed using '.' instead of '*'. > > Since the workaround seems easy and the patch could compromise > portability of .lua scripts written on Debian, I'm reluctant to the > proposed change. > > Do you agree?
If I understand correctly, I think this is a misdesign of the Lua standard intepreter. It should not be mapping command line argument words to Lua arguments precisely because there is an arbitrary (and relatively low) limit on chunk args. Instead, lua should assemble the command line arguments into a Lua list, and pass that list to the script chunk as a single argument. Since Lua list length is virtually unlimited, there will be no such issue with command line length. --John -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

