-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(bootstrap): preserve argv[0] for shim dispatch #8521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,7 +102,7 @@ __mise_bootstrap() {{ | |
| test -f "$MISE_INSTALL_PATH" || install | ||
| }} | ||
| __mise_bootstrap | ||
| exec "$MISE_INSTALL_PATH" "$@" | ||
| exec -a "$0" "$MISE_INSTALL_PATH" "$@" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Using Useful? React with 👍 / 👎. |
||
| "# | ||
| ); | ||
| Ok(script.trim().to_string()) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this change correctly fixes the issue for the bootstrap script, the same problem exists in other script-generating commands. To ensure consistent behavior and fully resolve the
argv[0]preservation issue, similar changes are needed in other files.Since I can only comment on changed files, I'm leaving this feedback here. Please consider applying fixes to the following:
src/cli/generate/tool_stub.rs:In the
wrap_with_bootstrapfunction, theexeccall does not preserveargv[0]. It should be changed from:to:
src/cli/generate/task_stubs.rs:The generated script in the
generatefunction uses#!/bin/shand anexeccall that doesn't preserveargv[0]. This should be updated to usebashandexec -a.Change from:
to:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is out of scope for this PR.
This change is limited to
mise generate bootstrap. Other generators should be evaluated separately.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correction: this is not the same issue.
This PR is limited to
mise generate bootstrap, where preservingargv[0]is required for shim dispatch.tool_stub.rspasses the original path explicitly totool-stub, andtask_stubs.rsinvokesmise run {display_name}directly, so they do not depend onargv[0]in the same way.