Allow saved applications to disable runtime option processing - #559
Open
luciusmagn wants to merge 2 commits into
Open
Allow saved applications to disable runtime option processing#559luciusmagn wants to merge 2 commits into
luciusmagn wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, I would like to propose a solution to the issue that the lisp kernel invariably eats some arguments before -- which may be used by other applications.
To describe it better, CCL’s kernel removes recognized runtime options before a saved application’s Lisp toplevel runs, which means that application flags such as --batch, --debug, -R, and -S can disappear or be misinterpreted. Saved applications with an explicit toplevel also do not receive arguments following
--through*UNPROCESSED-COMMAND-LINE-ARGUMENTS*.I recognize that there is a lot of prior art and discussion to this topic (it is possible I missed some, so this list is probably not exhaustive and there may have been some things outside of github also):
This issue is particularly important for me, because I am developing CCLSH, which should support an open-ended argument vocab since it can be used to call arbitrary scripts, and these conflicts could bite me, or somebody else, in the ass, hypothetical scenario:
Especially since hypothetically, the options that concern the kernel could change in the future and scripts that work before may not work anymore.
Solution
My solution adds an optional
:PROCESS-RUNTIME-OPTIONSoption toCCL:SAVE-APPLICATION, which defaults to the current behavior when omitted, so that we don't affect prior software.When set to NIL, this policy is recorded in the saved image. For a embedded or default marked image, the kernel detects it before option scanning and leaves runtime-looking arguments untouched. When a marked image is selected through
-I, runtime options before it can still configure the kernel, while subsequent args belong to the applicationI also initialize
*UNPROCESSED-COMMAND-LINE-ARGUMENTS*for explicit toplevel functions, giving standalone programs a reliable&complete path to args without affecting existing images.Unlike wrappers or UIOP or app-level parsing, this solution happens before the kernel irreversibly removes args. Recording the policy in the image makes it generic and opt-in, not dependent on executable names, and compatible with CCL images that already exist