command-line-arguments not properly restored after image dump
Disclaimer: I'm not sure if this is a bug in cmucl. It might be entirely uiop's fault, I'd just like to bring attention to this issue since it affects every image deployed through asdf's program-op
on cmucl.
The issue is described in this asdf bug and also in this cl-launch issue. I'll copy over the relevant parts for your convenience, though. Please consider the following minimal example:
In foo.asd:
(asdf:defsystem #:foo
:serial t
:components ((:file "foo"))
:entry-point "foo:main")
In foo.lisp:
(defpackage #:foo
(:export #:main)
(:use #:cl))
(in-package #:foo)
(defun main ()
(format t "Got arguments: ~a~%" (uiop:command-line-arguments))
(format t "Got raw arguments: ~a~%" (uiop:raw-command-line-arguments))
0)
These files make up an executable that just echoes whatever it is passed. This works as expected with sbcl and ccl. With cmucl, instead, when I build an executable via
(push (uiop:ensure-absolute-pathname (uiop:getcwd)) asdf:*central-registry*)
(asdf:disable-output-translations)
(asdf:operate 'asdf:program-op :foo)
and then run it via ./foo
, I get the arguments that I invoke cmucl with at build time rather than at run time.