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]: Bad math expression in zinit plugins on Ubuntu-22.04/WSL2 #545

Closed
arielsalvo opened this issue Jul 21, 2023 · 4 comments · Fixed by #559
Closed

[bug]: Bad math expression in zinit plugins on Ubuntu-22.04/WSL2 #545

arielsalvo opened this issue Jul 21, 2023 · 4 comments · Fixed by #559
Assignees
Labels
bug Something isn't working

Comments

@arielsalvo
Copy link

arielsalvo commented Jul 21, 2023

What happened?

I found an error in the zinit plugins command on WSL2/Ubuntu-22.04/zsh-5.8.1 combo.

This is a fresh install, .zshrc only has zinit's installation and initialization (no plugins at all)

$ zsh
Cloning into '/home/***/.local/share/zinit/repo'...
remote: Enumerating objects: 20371, done.
remote: Counting objects: 100% (364/364), done.
remote: Compressing objects: 100% (170/170), done.
remote: Total 20371 (delta 258), reused 275 (delta 191), pack-reused 20007
Receiving objects: 100% (20371/20371), 12.59 MiB | 13.06 MiB/s, done.
Resolving deltas: 100% (12834/12834), done.
% zi plugins
==> Plugins
.zinit-list-plugins:18: bad math expression: illegal character: "
U %/home/***/.local/share/zinit/repo

Loaded: L | Unloaded: U

This does not happen on MacOS with zsh 5.9 but replicated on another machine with same setup.

Steps to reproduce

Just install zsh from apt in a fresh Ubuntu 22.04 on WSL2 on Windows 10
Create a .zshrc containing only the following:

ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit"
[ ! -d $ZINIT_HOME/repo ] && mkdir -p "$(dirname $ZINIT_HOME/repo)"
[ ! -d $ZINIT_HOME/repo/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME/repo"
source "${ZINIT_HOME}/repo/zinit.zsh"

Start zsh and wait until zinit is installed
Run zi plugins

Relevant output

% zi plugins
==> Plugins
.zinit-list-plugins:18: bad math expression: illegal character: "
U %/home/***/.local/share/zinit/repo

Loaded: L | Unloaded: U


### Screenshots and recordings

_No response_

### Operating System & Version

OS: linux-gnu | Vendor: ubuntu | Machine: x86_64 | CPU: x86_64 | Processor: x86_64 | Hardware: x86_64

### Zsh version

zsh 5.8.1 (x86_64-ubuntu-linux-gnu)

### Terminal emulator

xterm-256color

### If using WSL on Windows, which version of WSL

WSL 2

### Additional context

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
@arielsalvo arielsalvo added the bug Something isn't working label Jul 21, 2023
@Ririshi
Copy link

Ririshi commented Aug 8, 2023

Seeing the same in a similar environment (Windows 11, WSL2, Ubuntu 22.04, zsh 5.8.1), but with more plugins installed.

❯ zi plugins
==> Plugins
.zinit-list-plugins:18: bad math expression: illegal character: "
U %/home/ririshi/.zinit/bin
.zinit-list-plugins:18: bad math expression: illegal character: "
U jessarcher/zsh-artisan
.zinit-list-plugins:18: bad math expression: illegal character: "
U romkatv/powerlevel10k
.zinit-list-plugins:18: bad math expression: illegal character: "
U zdharma-continuum/fast-syntax-highlighting
.zinit-list-plugins:18: bad math expression: illegal character: "
U zdharma-continuum/zinit-annex-bin-gem-node
.zinit-list-plugins:18: bad math expression: illegal character: "
U zdharma-continuum/zinit-annex-patch-dl
.zinit-list-plugins:18: bad math expression: illegal character: "
U zdharma-continuum/zinit-annex-readurl
.zinit-list-plugins:18: bad math expression: illegal character: "
U zdharma-continuum/zinit-annex-rust
.zinit-list-plugins:18: bad math expression: illegal character: "
U zsh-users/zsh-autosuggestions
.zinit-list-plugins:18: bad math expression: illegal character: "
U zsh-users/zsh-completions

@Ririshi
Copy link

Ririshi commented Aug 8, 2023

I think there are some extra double quotes that are not correct inside (( )) in zinit-autoload.zsh#L1567:

(( "ZINIT[STATES__$i]" )) && is_loaded="{happy}L"

The above (current) version produces the error. It works fine after changing it to this:

(( ZINIT[STATES__$i] )) && is_loaded="{happy}L"

@vladdoster
Copy link
Member

vladdoster commented Aug 12, 2023

@Ririshi @arielsalvo,

Good catch. I wonder why this issue doesn't occur on macOS...?

If you have time, please test the bug fix via branch 545-bug-bad-math-expression-in-zinit-plugins-on-ubuntu-2204wsl2

@Gerrit-K
Copy link
Contributor

@vladdoster @pschmitt what happened with this change on the main branch? It looks like there was a merge, then an attempted revert, but instead origin/main was hard reset ❔ Because I pulled from origin in between, my local main branch now diverged from origin and it appears that this also ended up in another branch (origin/fix/handle-bsd-realpath)
image

I know how to easily fix this locally, but it might not be as obvious to everyone.

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

Successfully merging a pull request may close this issue.

4 participants