Skip to content
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

[bug]: zinit should check that all persisted ices are defined during update #540

Open
1 task done
jankatins opened this issue Jun 13, 2023 · 5 comments
Open
1 task done
Assignees
Labels
bug Something isn't working

Comments

@jankatins
Copy link
Contributor

jankatins commented Jun 13, 2023

What happened?

During zinit update, the ices are loaded from a file in the plugin folder. These ices seems to not get validated and if some ice are not defined, they are silently ignored.

zinit update should validate all ice which are loaded from the persisted file during update.


Original issue which showed this problem

I've the following recipe:

zinit light-mode depth"1" for \
  @zdharma-continuum/zinit-annex-binary-symlink \
  @zdharma-continuum/zinit-annex-bin-gem-node \
  @zdharma-continuum/zinit-annex-default-ice \
  @zdharma-continuum/zinit-annex-patch-dl \
  @zdharma-continuum/zinit-annex-readurl

zinit default-ice --quiet as'null' from"gh-r" lbin'!' lucid nocompile completions

zinit lbin'!' completions \
    dl'https://raw.githubusercontent.com/junegunn/fzf/master/bin/fzf-tmux;
       https://raw.githubusercontent.com/junegunn/fzf/master/shell/completion.zsh -> _fzf_completion;
       https://raw.githubusercontent.com/junegunn/fzf/master/shell/key-bindings.zsh;
       https://raw.githubusercontent.com/junegunn/fzf/master/man/man1/fzf-tmux.1 -> $ZPFX/man/man1/fzf-tmux.1;
       https://raw.githubusercontent.com/junegunn/fzf/master/man/man1/fzf.1 -> $ZPFX/man/man1/fzf.1' \
    src"key-bindings.zsh" \
    for @junegunn/fzf

I usually run the following command to update all zinit stuff automatically from a bigger script:

# NOTE: this basically does not load any plugins as it does not source .zshrc
zsh -c "source /Users/jankatins/.local/share/zinit/zinit.git/zinit.zsh && zinit update --all --parallel"

This currently breaks the dl parts of the fzf recipe which in turn breaks the src, resulting in

.zinit-load-plugin:source:111: no such file or directory: /Users/jankatins/.local/share/zinit/plugins/junegunn---fzf/key-bindings.zsh

Steps to reproduce

  1. Enable the above fzf recipe
  2. Change the already downlaoded version (see below for a sed line) to trigger a update
  3. Run the above update line

Relevant output

[22:33:09] λ  zinit update junegunn/fzf
(Requesting `fzf-0.41.1-darwin_amd64.zip', version 0.41.1… Current version: 0.40.1.)
####################################################### 100.0%
[ziextract] Unpacking the files from: `fzf-0.41.1-darwin_amd64.zip'
Archive:  fzf-0.41.1-darwin_amd64.zip
  inflating: fzf
[ziextract] Successfully extracted and assigned +x chmod to the file: fzf.

==> patch-dl-annex: fzf-tmux downloaded successfully
==> patch-dl-annex: _fzf_completion downloaded successfully
==> patch-dl-annex: key-bindings.zsh downloaded successfully
==> patch-dl-annex: fzf-tmux.1 downloaded successfully
==> patch-dl-annex: fzf.1 downloaded successfully
==> linkbin annex: Re-created fzf soft link & set +x on the fzf binary

[22:33:45] λ  sed -i.bak 's/41\./40\./'  ~/.local/share/zinit/plugins/junegunn---fzf/._zinit/{is_release,url}

[22:34:03] λ  zsh -c "source /Users/jankatins/.local/share/zinit/zinit.git/zinit.zsh && zinit update junegunn/fzf"
(Requesting `fzf-0.41.1-darwin_amd64.zip', version 0.41.1… Current version: 0.40.1.)
####################################################### 100.0%
[ziextract] Unpacking the files from: `fzf-0.41.1-darwin_amd64.zip'
Archive:  fzf-0.41.1-darwin_amd64.zip
  inflating: fzf
[ziextract] Successfully extracted and assigned +x chmod to the file: fzf.
==> Skipped re-installing 1 completion

(slightly shortend the progress bars)

-> Note that the dl lines are not in the second version

Operating System & Version

OS: darwin21.3.0 | Vendor: apple | Machine: x86_64 | CPU: x86_64 | Processor: i386 | Hardware: x86_64

(this also happens on my linux machone, so it shouldn't be OS specific)

Zsh version

zsh 5.9 (x86_64-apple-darwin21.3.0)

Terminal emulator

wezterm

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jankatins jankatins added the bug Something isn't working label Jun 13, 2023
@jankatins
Copy link
Contributor Author

For some reason the original problem in #467 is back, but the workaround for #467 is still in place:

λ  cat ~/.local/share/zinit/plugins/zdharma-continuum---zinit-annex-patch-dl/z-a-patch-dl.plugin.zsh | grep hook:atpull
    hook:atpull-20 \

@jankatins
Copy link
Contributor Author

jankatins commented Jun 13, 2023

Ok, found the problem and it's me: the problem is that the above update line does not register the annex (as the .zshrc is not run) and therefore the dl part is silently ignored. Using

 zsh -c "source ~/.zshrc && source /Users/jankatins/.local/share/zinit/zinit.git/zinit.zsh && zinit update junegunn/fzf"

fixes the problem for me...

@jankatins
Copy link
Contributor Author

Ok, one could argue that any not registered ices should error out even during update, but I guess that's a hard problem to solve :-(

@vladdoster
Copy link
Member

@jankatins,

Did you try running zsh via

zsh --interactive --login -c --

or possibly zinit via

zsh -ils -c -- '@zinit-scheduler burst'

@vladdoster vladdoster reopened this Nov 29, 2023
@jankatins
Copy link
Contributor Author

I did not, but I'm also fine with running the extra source .zshrc in the zsh call. The main gripe I have here, is that zinit does not complain if it receives an ice which it doesn't know about: currently (at least at the time of this issue) it silently ignores them.

The fix would be to also check that all the ices are defined when running update and the ices are loaded from the respective plugin folder and not given via the cli.

-> Update the initial message and title.

@jankatins jankatins changed the title [bug]: zinit update in a special shell breaks dl annex [bug]: zinit should check that all persisted ices are defined during update Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants