[Sbcl-devel] -script and -dynamic-space-size flags incompatible

12 views
Skip to first unread message

Eric Schulte

unread,
Nov 29, 2012, 9:06:44 PM11/29/12
to sbcl-...@lists.sourceforge.net
Hi,

I've noticed that with SBCL 1.1.1 I am unable to supply both the -script
and -dynamic-space-size flags. Specifically, the presence of
-dynamic-space-size causes an invocation with script to drop into the
REPL and ignore the file.

The net effect is that I'm unable to run sbcl scripts which require
large heaps. Are these flags fundamentally incompatible, or is this
something that may be changed at some point?

This isn't really causing problems for me, but thought I'd mention it.

Thanks,

--
Eric Schulte
http://cs.unm.edu/~eschulte

------------------------------------------------------------------------------
Keep yourself connected to Go Parallel:
TUNE You got it built. Now make it sing. Tune shows you how.
http://goparallel.sourceforge.net
_______________________________________________
Sbcl-devel mailing list
Sbcl-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-devel

Stas Boukarev

unread,
Nov 29, 2012, 9:40:03 PM11/29/12
to Eric Schulte, sbcl-...@lists.sourceforge.net
Eric Schulte <schult...@gmail.com> writes:

> Hi,
>
> I've noticed that with SBCL 1.1.1 I am unable to supply both the -script
> and -dynamic-space-size flags. Specifically, the presence of
> -dynamic-space-size causes an invocation with script to drop into the
> REPL and ignore the file.
>
> The net effect is that I'm unable to run sbcl scripts which require
> large heaps. Are these flags fundamentally incompatible, or is this
> something that may be changed at some point?
>
> This isn't really causing problems for me, but thought I'd mention it.
It's not an SBCL problem, it's a linux problem, execve(2) is unable to
pass more than one argument to shebang scripts (it actually passes all
the arguments as a single one). So, there are several solutions:

a) make a wrapper script

b) save an executable core from an SBCL which was started with a correct
--dynamic-space-size and a :save-runtime-options t option for
save-lisp-and-die

c) make the script look like a shell script, then run sbcl from it
#!/bin/sh
#|
exec sbcl --script --dynamic-space-size $@
|#

d) build SBCL with ./make.sh --dynamic-space-size=SIZE, that's similar to
the b) option, but possibly less hassle

--
With best regards, Stas.

Anton Kovalenko

unread,
Nov 30, 2012, 3:19:00 AM11/30/12
to sbcl-...@lists.sourceforge.net
Stas Boukarev <stas...@gmail.com> writes:

> c) make the script look like a shell script, then run sbcl from it
> #!/bin/sh
> #|
> exec sbcl --script --dynamic-space-size $@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> |#

That should be

exec sbcl --script --dynamic-space-size "$@"

so the arguments are not broke down into words when they contain word
separators.

Also there is a known bug in some ancient shells, when "$@" produces one
empty argument instead of empty list if no arguments are present. The
traditional workaround is

exec sbcl --script --dynamic-space-size ${1+"$@"}

--
Regards, Anton Kovalenko <http://github.com/akovalenko/sbcl-win32-threads/wiki>
+7(916)345-34-02 | Elektrostal' MO, Russia

Eric Schulte

unread,
Nov 30, 2012, 11:02:35 AM11/30/12
to Stas Boukarev, sbcl-...@lists.sourceforge.net
Stas Boukarev <stas...@gmail.com> writes:

> Eric Schulte <schult...@gmail.com> writes:
>
>> Hi,
>>
>> I've noticed that with SBCL 1.1.1 I am unable to supply both the -script
>> and -dynamic-space-size flags. Specifically, the presence of
>> -dynamic-space-size causes an invocation with script to drop into the
>> REPL and ignore the file.
>>
>> The net effect is that I'm unable to run sbcl scripts which require
>> large heaps. Are these flags fundamentally incompatible, or is this
>> something that may be changed at some point?
>>
>> This isn't really causing problems for me, but thought I'd mention it.
> It's not an SBCL problem, it's a linux problem, execve(2) is unable to
> pass more than one argument to shebang scripts (it actually passes all
> the arguments as a single one).

Ah, thanks for the explanation.

> So, there are several solutions:
>
> a) make a wrapper script
>
> b) save an executable core from an SBCL which was started with a correct
> --dynamic-space-size and a :save-runtime-options t option for
> save-lisp-and-die
>
> c) make the script look like a shell script, then run sbcl from it
> #!/bin/sh
> #|
> exec sbcl --script --dynamic-space-size $@
> |#
>
> d) build SBCL with ./make.sh --dynamic-space-size=SIZE, that's similar to
> the b) option, but possibly less hassle

and for the many workarounds.

--
Eric Schulte
http://cs.unm.edu/~eschulte

Reply all
Reply to author
Forward
0 new messages