Repository navigation
fix(argument): handle login-shell invocation names safely - #61
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #61 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 10 10
Lines 585 586 +1
=========================================
+ Hits 585 586 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
🎉 This PR is included in version 2.5.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Requirements
changes, explain why test-suite changes are unnecessary and describe the
documentation or metadata checks performed.
measurable-line coverage gates. Do not weaken checks to obtain a passing result.
not passing results.
Type
Issue (only for type
bug fix/feature change)No separate issue filed. The bug was reproduced in a real macOS login zsh where
both
$0andZSH_ARGZEROare-zsh.Description of the Change
Fix
THIS_SCRIPT_NAMEinitialization for login shells.Previously,
basename "$_bash_base_argzero"treated-zshas an option onmacOS and printed
basename: illegal option -- z.The implementation now uses shell parameter expansion and strips the login-shell
leading
-. Regression tests cover both-bashand-zsh.Contract and Compatibility
Regular Bash/zsh invocation names keep the same result.
Login-shell names are normalized:
-bash->bash-zsh->zshTHIS_SCRIPT_PATHbehavior is intentionally unchanged.No new dependencies or breaking API changes are introduced.
Validation
Completed:
$0=-zsh,ZSH_ARGZERO=-zsh-bashnormalization pathPending before merge:
npm testPossible Drawbacks
The fix removes the external
basenamecall for this value and normalizes aleading login-shell
-.THIS_SCRIPT_PATHis deliberately not changed; its login-shell semantics mayneed separate review.