-
Notifications
You must be signed in to change notification settings - Fork 128
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
fix: Don't error if $OPTS is not yet defined in .zinit-compinit call #241
fix: Don't error if $OPTS is not yet defined in .zinit-compinit call #241
Conversation
This codepath was triggered when deleting the whole `~/.zinit/plugins` dir: during recreation in `.zinit-prepare-home`, `.zinit-compinit &> /dev/null` would be called and the sourcing of `zinit.zsh` would error out with ``` +.zinit-compinit:2> [[.zinit-compinit:2: bad math expression: operand expected at `/Users/jan...' -n '' ]] ``` As the error was redirected to `/dev/null`, this never showed up. Any zinit install call during that session would not run any hooks as they were not yet registered. The next session would then be fine because the plugins dir would exist.
@jankatins Awesome find and fix. I really appreciate the use of commit message using the prefix |
@pschmitt @jankatins The conditional should have used [[ -v SOME_VARIABLE ]] |
Pendantic but true, this is effectively the same though. |
Since it errors on operand and would result in smaller diff, is there a reason not to use
I see [[ expr ]] used elsewhere, but seems redundant to check the same variable twice. |
Regardless of the answer above, this brings up the issue of deleting zinit directories. As I've said before @jankatins, this is not how you should delete plugins. Use I would assume this edge-case is handled in the delete command since it deletes subdirectories and not the actual |
zsh man page :
|
Link to my previous comment |
TIL :^) |
Indeed, it avoids this issue altogether. |
🎉 This PR is included in version 3.8.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This codepath was triggered when deleting the whole
~/.ziniti/plugins
dir: during recreation in.zinit-prepare-home
,.zinit-compinit &> /dev/null
would be called and the sourcing ofzinit.zsh
would error out withAs the error was redirected to
/dev/null
, this never showed up. Any zinit install call during that session would not run any hooks as they were not yet registered. The next session would then be fine because the plugins dir would exist.Motivation and Context
See #129 (comment) -> basically deleting the
~/.zinit/plugins
dir should result in complete recreation on the next run, but due to this bug, it had bad side effects.Closes: #129 (probably, not tested on initial run, only after deleting the plugins dir)
How Has This Been Tested?
Manually deleting the whole folder and starting the whole zinit setup from scratch
Types of changes
Checklist: