jandamm/zgenom

zwc files everywhere

tcurdt opened this issue · 6 comments

IIUC zgenom compiles some of the shell scripts to speed up the execution.
I always thought this would be limited to just the zgenom files.
But somehow I end up with .zwc files all over my filesystem.

This is my setup:

export ZGEN_CUSTOM_COMPDUMP="${HOME}/.zcompdump-shodan2"
source "${HOME}/.zgenom/zgenom.zsh"
zgenom autoupdate
if ! zgenom saved; then

  echo "not saved"
  zgenom ohmyzsh
  zgenom ohmyzsh plugins/sudo
  zgenom ohmyzsh themes/daveverwer

  zgenom save

  zgenom compile "$HOME/.zshrc"
  zgenom compile $ZDOTDIR
fi

Now looking at this I was wondering if maybe ZDOTDIR could cause this.
And fair enough - it is empty.

Could this be cause by my zgenom setup?
According to the zsh folks this is by no means caused by zsh itself.

Yes this could be an issue in the usage with zgenom.

Zgenom uses zcompile which only compiles one file.
zgenom compile accepts a file or a path. When given a path it'll compile all found files recursively.
So zgenom compile / would compile all files on your hard drive (probably error for all paths without write access).
It'll look for *.sh, *.zsh, compdumps and also check for zsh shebangs.

Zgenom internally only compiles itself, its cloned sources and the compdump if known. In your case $HOME/.zgenom and $HOME/.zcompdump-shodan2.

Assuming that $HOME/.zshrc exists and is a file I'd guess zgenom compile $ZDOTDIR is the issue.

So your $ZDOTDIR is unset ("") or is it set to an empty folder?
I would expect zgenom compile without a path/file to do nothing but maybe there is a bug 🤷‍♂️

Thanks for the quick help.

Yes, this is copied from my $HOME/.zshrc. And for me $ZDOTDIR is unset ("") .

It looks like the equivalent of zgenom compile / is getting called and causing this then.

So either zgenom compile is not a noop or at some time $ZDOTDIR had a value of / or maybe $HOME.

I tested it today and zgenom compile $UNKNOWN_VARIABLE would create an error. So probably the $ZDOTDIR was set at one point.

You can also check the creation date of the zwc files. This should give an indication when it was compiled.

What should $ZDOTDIR point to?
I was wondering if I could just remove that line.

Thanks for helping with the debugging.

Yes, if you don't set the $ZDOTDIR yourself just remove the line.
It's the directory zsh should look for the .zshrc etc. I've set it to .config/zsh.

Here is the reference:
https://zsh.sourceforge.io/Intro/intro_3.html

I'll update the readme to clarify that this line should only be used if $ZDOTDIR is manually set.

Thanks for the help. This should have fixed it for me.