-
Notifications
You must be signed in to change notification settings - Fork 3
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
Ensure global startup RCs see the right ZDOTDIR #4
base: master
Are you sure you want to change the base?
Conversation
We do this by disabling zsh's builtin behavior to read these startup files and instead doing them ourselves. This allow us to exert control over what ZDOTDIR is set to (we cannot just set ZDOTDIR to the right thing before global startup scripts are executed because this would cause zsh to not execute the custom startup scripts we wrote out to the temporary directory). In order to maintain compatibility with existing zsh behavior, we stash the state of the GLOBAL_RCS option at the end of our custom startup scripts but before disabling the option. We then restore its state at the beginning of the next startup script (so immediately after zsh *would* have executed the relevant global startup script). Fixes romkatv#3
The directory with global rcs is specified when compiling zsh and it's not guaranteed to be I don't see a way to properly fix #3. If you just want it to work on your system, you can modify your |
What if we gate the code in this patch on Obviously it wouldn't fix things for systems with a different global config directory, but at least it would be fixed for many systems and would not introduce regressions for the rest. |
It would cause a regression for users of https://github.com/romkatv/zsh-bin (including myself). Normally it does not source any global rc files. The new bugs look worse, or at least more weird, than the old bugs: sourcing global rc files with wrong
Could you reply to this ☝️ Does this workaround work for you? |
But it seems to read them, though. Is the intended behavior for
We depend on this script at work so we could probably use this workaround in the wrapper, yeah. I would just prefer not to since it's kind of a hack and means that our script is even more complicated. |
How are you testing this?
The intended behavior is described in https://github.com/romkatv/zshi/blob/master/README.md:
The word "standard" is somewhat fuzzy. I'm trying to say here that |
Any solution will be a hack. I don't see an option for a proper fix. |
Oh shoot, I mixed up zsh-bin and Am I understanding correctly that zsh-bin disables reading of all startup files, but that does not affect the |
I missed your question here, sorry.
zsh-bin never reads global startup files.
On my system there is |
We do this by disabling zsh's builtin behavior to read these startup files and instead doing them ourselves. This allow us to exert control over what ZDOTDIR is set to (we cannot just set ZDOTDIR to the right thing before global startup scripts are executed because this would cause zsh to not execute the custom startup scripts we wrote out to the temporary directory).
In order to maintain compatibility with existing zsh behavior, we stash the state of the GLOBAL_RCS option at the end of our custom startup scripts but before disabling the option. We then restore its state at the beginning of the next startup script (so immediately after zsh would have executed the relevant global startup script).
Note that I didn't test this exhaustively (I basically just tested that the behavior described in #3 was fixed).
Fixes #3