-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
Error printed on first autocompletion menu: "couldn't create cache-dir /zsh/compcache" #262
Comments
Are you sure? Because it gets set here:
|
I'm sure. I can see it's empty if I "echo $XDG_CACHE_HOME" at the end of my .zshrc. I think the issue is that .autocomplete.init.precmd runs after .zshrc. Also zsh-autocomplete should not be exporting XDG_CACHE_HOME/XDG_DATA_HOME. It should just use "${XDG_CACHE_HOME:-$HOME/.cache}" where appropriate, or use "local" instead of "export". |
Yes, that is intentional.
Sure, I can change that. Anyway, I cannot reproduce this. Can you please use the bug report template that you deleted when you created this issue to make a reproducible test case? It doesn't have this warning for nothing, you know:
|
The repro steps are: $ git -C ~zsh-autocomplete switch main # Make sure you test with the `main` branch.
$ git -C ~zsh-autocomplete pull # Update to the latest commit.
$ cd $(mktemp -d) # Create a temp dir and enter it.
$ unset _comp_dumpfile ZDOTDIR XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME
$ HOME=$PWD exec zsh -f # Restart Zsh without config files in this dir.
% source /path/to/zsh-autocomplete/zsh-autocomplete.plugin.zsh
% zstyle ':completion:*' extra-verbose true
% l Upon typing "l", I get "couldn't create cache-dir /zsh/compcache". The error is not shown again. The key to getting this to reproduce for me is
That explains why the issue is occurring. At the time [1] https://github.com/marlonrichert/zsh-autocomplete/blob/main/module/.autocomplete.config#L15 |
Thanks. I can confirm that is indeed the case. Will fix. |
Fixed. |
Woo! Thank you very much for the fix! |
This bug only repros when I set:
zstyle ':completion:*' extra-verbose true
The issue is that .autocomplete.config sets cache-path to "$XDG_CACHE_HOME/zsh/compcache", but my XDG_CACHE_HOME is not set. According to the XDG spec [1], "If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used."
[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
The text was updated successfully, but these errors were encountered: