-
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
$HISTFILE is set to a file in the temporary directory on macOS zsh #3
Comments
Thanks for reporting this. If you send a PR with a fix, I'll merge it. I'm afraid I won't be fixing this myself. |
Totally understandable, thanks for the quick response. I was thinking about sending a PR but I'm not sure what the best approach is here... I could look into trying to do something similar for the site-wide startup files as is done for the user startup files? But I'm not sure that's actually workable. Would you still take patches even if it's just hacking up |
Actually I think this can be fixed by fiddling with the |
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
In summary:
The problem appears to be coming from this line in
/etc/zshrc
:The embedded script in
zshi
setsZDOTDIR
to the correct, non-temporary path at the beginning and then resets it to the temporary path at the end in order to ensure that zsh continues loading startup files from the temporary directory. However, because the globalzshrc
is loaded in between the user's startup files,ZDOTDIR
is set to the temporary directory, and the history file defined by this line therefore is also in the tempdir instead of where the user expected it (probably in~
).The text was updated successfully, but these errors were encountered: