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

Messy output when do zplug update #419

Open
1 of 4 tasks
CarterLi opened this issue Jun 17, 2017 · 24 comments
Open
1 of 4 tasks

Messy output when do zplug update #419

CarterLi opened this issue Jun 17, 2017 · 24 comments

Comments

@CarterLi
Copy link

CarterLi commented Jun 17, 2017

  • Type:
    • Bug
    • Enhancement
    • Feature Request
    • Question

  • zplug --version: 2.4.1
  • zsh --version: zsh 5.3.1-dev-0 (x86_64-apple-darwin16.6.0) Also tried the stable version
  • uname -a: Darwin litongzhoudeMacBook-Pro.local 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64 i386 MacBookPro11,5 Darwin
  • zplug env
ZPLUG_ROOT = /Users/Carter/.zplug/repos/zplug/zplug
ZPLUG_HOME = /Users/Carter/.zplug
ZPLUG_THREADS = 16
ZPLUG_PROTOCOL = HTTPS
ZPLUG_FILTER = fzf-tmux:fzf:peco:percol:fzy:zaw
ZPLUG_LOADFILE = /Users/Carter/.zplug/packages.zsh
ZPLUG_USE_CACHE = true
ZPLUG_ERROR_LOG = /Users/Carter/.zplug/.error_log
ZPLUG_BIN = /Users/Carter/.zplug/bin
ZPLUG_CACHE_DIR = /Users/Carter/.zplug/cache
ZPLUG_REPOS = /Users/Carter/.zplug/repos
_ZPLUG_VERSION = 2.4.1
_ZPLUG_URL = https://github.com/zplug/zplug
_ZPLUG_OHMYZSH = robbyrussell/oh-my-zsh
_ZPLUG_PREZTO = sorin-ionescu/prezto
_ZPLUG_AWKPATH = /Users/Carter/.zplug/repos/zplug/zplug/misc/contrib
_ZPLUG_CONFIG_SUBSHELL = :

Minimal zshrc (with less than 30 lines)

source ~/.zplug/init.zsh

zplug 'zplug/zplug', hook-build:'zplug --self-manage'

if ! zplug check; then
    zplug install
fi

zplug load

Step to reproduce

  1. zplug update

Result

litongzhoudeMacBook-Pro% zplug update
[zplug] Start to update 1 plugins in parallel

 ⠏  Updating...           zplug/zplug
 ✔  Up-to-date            zplug/zplug

[zplug] Elapsed time: 3.6173 sec.tate:21: bad math expression: operator expected at `0'
 ==> Updating finished successfully!

If I do full update, things get even worse

❯ zplug update
[zplug] Start to update 26 plugins in parallel

 ⠋  Updating...           mafredri/zsh-async
 ⠙  Updating...           mafredri/zsh-async
 ⠹  Updating...           mafredri/zsh-async
 ⠴  Updating...           mafredri/zsh-async
 ⠦  Updating...           mafredri/zsh-asyncletions
 ⠧  Updating...           mafredri/zsh-asyncletions
 ✔  Up-to-date            mafredri/zsh-asyncletions
 ✔  Up-to-date            mafredri/zsh-asyncletions
 ✔  Up-to-date            mafredri/zsh-asyncletionslighting
 ✔  Up-to-date            mafredri/zsh-asyncletionslighting
 ✔  Up-to-date            mafredri/zsh-asyncletionslighting
 ✔  Up-to-date            mafredri/zsh-asyncletionslighting
 ✔  Up-to-date            mafredri/zsh-asyncletionslighting
 ✔  Up-to-date            mafredri/zsh-asyncletionslighting
 ✔  Up-to-date            mafredri/zsh-asyncd math expression: operator expected at `0'
 ✔  Up-to-date            mafredri/zsh-asyncletionslighting
 ✔  Up-to-date            mafredri/zsh-asyncletionslighting
 ✔  Up-to-date            plugins/osxtipstoenv-highlighting
 ✔  Up-to-date            djui/alias-tipsompletionslighting
 ✔  Up-to-date            plugins/pythoncompletionslighting
 ✔  Up-to-date            zsh-users/zsh-completionslighting
 ✔  Up-to-date            Tarrasch/zsh-autoenvggestions
 ✔  Up-to-date            plugins/pipsh-syntax-highlighting
 ✔  Up-to-date            teancom/k/zsh-syntax-highlighting
 ✔  Up-to-date            zsh-users/zsh-syntax-highlighting
 ✔  Up-to-date            zsh-users/zsh-autosuggestions
 ✔  Up-to-date            plugins/yarnred-man-pages
 ✔  Up-to-date            plugins/colored-man-pages
 ✔  Up-to-date            plugins/zpmrts
 ✔  Up-to-date            plugins/npmrts.plugin.zshexpression: operator expected at `0'
 ✔  Up-to-date            caarlos0/ports.plugin.zsh
 ✔  Up-to-date            unixorn/tumult.plugin.zsh
 ⠹  Updating...           plugins/battery
 ⠼  Updating...           plugins/battery bad math expression: operator expected at `0'
 ⠧  Updating...           plugins/battery
 ⠏  Updating...           plugins/batterytory-substring-search
 ⠋  Updating...           plugins/batterytory-substring-search
 ⠙  Updating...           plugins/batterytory-substring-search
 ⠹  Updating...           plugins/batterytory-substring-search
 ⠴  Updating...           plugins/batterytory-substring-search
 ⠦  Updating...           plugins/batterytory-substring-search
 ✔  Up-to-date            plugins/batterytory-substring-search
 ✔  Up-to-date            plugins/batterytory-substring-search
 ✔  Up-to-date            plugins/githubstory-substring-search
 ✔  Up-to-date            plugins/rsyncistory-substring-search
 ✔  Up-to-date            plugins/zsh-history-substring-search
 ✔  Up-to-date            sindresorhus/pureot-found
 ✔  Up-to-date            lib/*/zplugmand-not-found
 ✔  Up-to-date            zplug/zplugmand-not-found
 ✔  Up-to-date            plugins/command-not-found
 ✔  Up-to-date            plugins/sudo
 ✔  Up-to-date            plugins/git

[zplug] Elapsed time: 33.7548 sec.ate:21: bad math expression: operator expected at `0'
 ==> Updating finished successfully!

EDIT: If I redirect stdout into a file, I got this: __zplug::utils::git::get_remote_state:21: bad math expression: operator expected at `0'

@sudoforge
Copy link

I experience this when both installing plugins and updating.

@akrejczinger
Copy link

I have the same issue, and I found that I have the following line in my zshrc:
setopt rcexpandparam

If I remove that line, the rendering issues stop. I hope this helps.

@CarterLi
Copy link
Author

CarterLi commented Jul 20, 2017

I have the same issue, and I found that I have the following line in my zshrc:
setopt rcexpandparam

If I remove that line, the rendering issues stop. I hope this helps.

Mine doesn't contain similar line

@sudoforge
Copy link

I have the same issue, and I found that I have the following line in my zshrc:
setopt rcexpandparam

If I remove that line, the rendering issues stop. I hope this helps.

From man zshoptions:

RC_EXPAND_PARAM (-P)

    Array expansions of the form ‘foo${xx}bar’, where the parameter xx is set to (a b c),
    are substituted with ‘fooabar foobbar foocbar’ instead of the default ‘fooa b cbar’. Note
    that an empty array will therefore cause all arguments to be removed. 

I am not manually setting this option either, and the default is unset.

@akrejczinger
Copy link

Mine doesn't contain similar line

Hmm, maybe it's a similar, but different issue then. I looked closer at the output and the error on the last line is different in my case:

[zplug] Finished: printf: ‘[zplug] 0’: expected a numeric value

@CarterLi
Copy link
Author

Well, It turns out that non en_US locale cause this.
If I export LC_ALL=en_US.UTF-8 or use git without gettext support, zplug update works without issues.

@sudoforge
Copy link

sudoforge commented Aug 11, 2017

@CarterLi I'm running Fedora 25. LC_ALL was not set, but exporting it doesn't seem to fix the messy output from zplug.

@CarterLi
Copy link
Author

@bddenhartog What locale prints?

@sudoforge
Copy link

@CarterLi

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

@drrlvn
Copy link

drrlvn commented Aug 27, 2017

Removing setopt rc_expand_param from my zshrc solved this for me.

@sudoforge
Copy link

@spatz, that's very unlikely to be the cause:

I have the same issue, and I found that I have the following line in my zshrc:
setopt rcexpandparam

If I remove that line, the rendering issues stop. I hope this helps.

From man zshoptions:

RC_EXPAND_PARAM (-P)

    Array expansions of the form ‘foo${xx}bar’, where the parameter xx is set to (a b c),
    are substituted with ‘fooabar foobbar foocbar’ instead of the default ‘fooa b cbar’. Note
    that an empty array will therefore cause all arguments to be removed. 

I am not manually setting this option either, and the default is unset.

@sudoforge
Copy link

Also:

$ unsetopt rc_expand_param

$ zplug update
[zplug] Start to update 13 plugins in parallel

[5] 29110
[6] 29148
[7] 29186
[8] 29226
[9] 29275
[10] 29306
[11] 29361
[12] 29394
[13] 29437
[14] 29468
...

@drrlvn
Copy link

drrlvn commented Aug 27, 2017

@bddenhartog I read the documentation for that option and I don't know why it causes this bug, but the fact is that for me adding it causes it and removing it fixes it.

@sudoforge
Copy link

@bddenhartog I read the documentation for that option and I don't know why it causes this bug, but the fact is that for me adding it causes it and removing it fixes it.

@spatz If that's reproducible for you, then that's definitely weird. Perhaps there are multiple causes for this issue.

@sbusch
Copy link

sbusch commented Nov 12, 2017

I confirm this bug:

$ zplug update
[zplug] Start to update 7 plugins in parallel

 ⠋  Updating...           djui/alias-tips
 ⠋  Updating...           zsh-users/zsh-completions
 ⠋  Updating...           caarlos0/zsh-mkc
 ✔  Up-to-date            djui/alias-tipsyntax-highlighting
 ✔  Up-to-date            djui/alias-tipsompletionsions
 ⠸  Updating...           zsh-users/zsh-completionsstring-search
 ✔  Up-to-date            djui/alias-tipscntax-highlighting
 ✔  Up-to-date            djui/alias-tipsompletionslighting
 ✔  Up-to-date            zsh-users/zsh-completionsionsng-search
 ✔  Up-to-date            caarlos0/zsh-mkcntax-highlightingearchperator expected at `0'
 ✔  Up-to-date            zsh-users/zsh-syntax-highlighting
 ✔  Up-to-date            zsh-users/zsh-autosuggestionsng-search
 ✔  Up-to-date            zsh-users/zsh-history-substring-searchperator expected at `0'
 ✔  Up-to-date            zplug/zplug

[zplug] Elapsed time: 1.7643 sec.tate:21: bad math expression: operator expected at `0'
 ==> Updating finished successfully!

Setting LC_MESSAGE to en_US.UTF-8 (or C) fixes it for me:

$ LC_ALL=en_US.UTF-8 zplug update
[zplug] Start to update 7 plugins in parallel

 ✔  Up-to-date            djui/alias-tips
 ✔  Up-to-date            zsh-users/zsh-completions
 ✔  Up-to-date            caarlos0/zsh-mkc
 ✔  Up-to-date            zsh-users/zsh-syntax-highlighting
 ✔  Up-to-date            zsh-users/zsh-autosuggestions
 ✔  Up-to-date            zsh-users/zsh-history-substring-search
 ✔  Up-to-date            zplug/zplug

[zplug] Elapsed time: 2.7418 sec.
 ==> Updating finished successfully!

My locale:

$ locale
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

@cailloumajor
Copy link

cailloumajor commented Aug 24, 2018

I have the same problem as @sbusch, with system default locale being fr_FR.UTF-8 :

$ locale
LANG=fr_FR.UTF-8
LANGUAGE=
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC=fr_FR.UTF-8
LC_TIME=fr_FR.UTF-8
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY=fr_FR.UTF-8
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER=fr_FR.UTF-8
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT=fr_FR.UTF-8
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=
$ zplug status
[zplug] Start to get remote status 1 plugins in parallel

 ⠦  Fetching...           zplug/zplug
 ✘  Unknown error         zplug/zplug

[zplug] Elapsed time: 0.7798 sec.tate:21: bad math expression: operator expected at `0'
 ==> All packages are up-to-date!

Setting locale to C gives a different but not better output (terminal cluttered, reset command needed) :

$ LC_ALL=C zplug status
[zplug] Start to get remote status 1 plugins in parallel

__zplug::job::message::white:3: character not in range
 % 

Setting locale to en_US.UTF-8 gives expected output :

$ LC_ALL=en_US.UTF-8 zplug status
[zplug] Start to get remote status 1 plugins in parallel

 ✔  Up-to-date            zplug/zplug

[zplug] Elapsed time: 1.5652 sec.
 ==> All packages are up-to-date!

For information :

$ zsh --version
zsh 5.5.1 (x86_64-debian-linux-gnu)
$ zplug --version
2.4.2
$ awk --version
GNU Awk 4.1.4, API: 1.1 (GNU MPFR 4.0.1, GNU MP 6.1.2)

My .zshrc :

source ~/.zplug/init.zsh

zplug "zplug/zplug", hook-build:'zplug --self-manage'
# zplug "zsh-users/zsh-syntax-highlighting"

# Theme
# zplug "denysdovhan/spaceship-prompt", use:spaceship.zsh, from:github, as:theme

# Install packages that have not been installed yet
if ! zplug check --verbose; then
    printf "Install? [y/N]: "
    if read -q; then
        echo; zplug install
    else
        echo
    fi
fi

zplug load --verbose

@raabf
Copy link

raabf commented Nov 6, 2018

can confirm that LC_MESSAGES=en_US.UTF-8 removes the messy output (I have also LC_MESSAGES="de_DE.UTF-8" as default). I do not have setopt rcexpandparam in my zshrc.

Currently use this as a workaround in my zshrc:

alias -g zplug="LC_MESSAGES=en_US.UTF-8 zplug"

@nbrondeau
Copy link

nbrondeau commented Nov 3, 2019

zplug don't accept foreign language like French, Germain, Spain... when the command GIT is being used

change git.zsh to fix this bug

base/utils/git.zsh

-        remote_show="$(git remote show "$remote_name")"

+        remote_show="$(LANG=C git remote show "$remote_name")"

Duplicate #363

@simonbcn
Copy link

Same problem.
Is this project abandoned? It seems it hasn't updates since a long time.

@deividaspetraitis
Copy link

Same issue.

dadav added a commit to dadav/zplug that referenced this issue Nov 28, 2020
used flags, I got rid of some anoying error messages when not using
en_US.UTF-8 in LC_MESSAGES.

Fixes zplug#419
@kleest
Copy link

kleest commented Aug 20, 2022

For anyone struggling with setting LANG or LC_ALL having no effect, look at the value of LANGUAGE. This takes precedence over LANG and LC_ALL, so you have to set this to en as well.
You can check if it's working correctly by running git status. For example:

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
$ git status
fatal: Kein Git-Repository (oder irgendeines der Elternverzeichnisse): .git
$ echo $LANGUAGE
de:en_US

Even though locale shows that everything is set to en_US.UTF_8, Git output is still in German due to LANGUAGE set to de:en_US. Changing LANGUAGE as well, makes Git speak English:

$ LANGUAGE=en git status  
fatal: not a git repository (or any of the parent directories): .git

This also fixes zplug:

$ LANGUAGE=en LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 zplug update

@plague-doctor
Copy link

This issue still exist and setting the language (LANGUAGE=en LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 zplug update) doesn't help...

LANGUAGE=en LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 zplug update
[zplug] Start to update 14 plugins in parallel

 ⠏  Updating...           mafredri/zsh-async
 ✔  Up-to-date            mafredri/zsh-asyncetch
 ✔  Up-to-date            plugins/git-auto-fetchons
 ✔  Up-to-date            zsh-users/zsh-completions
 ✔  Up-to-date            plugins/pipg-zsh-completion
 ✔  Up-to-date            glidenote/ag-zsh-completion
 ✔  Up-to-date            plugins/gitfast
 ✔  Up-to-date            plugins/aws
 ✔  Up-to-date            zplug/zplugract
 ✔  Up-to-date            plugins/extract
 ✔  Up-to-date            plugins/systemde
 ✔  Up-to-date            diazod/git-prunee
 ✔  Up-to-date            plugins/gitignorel10k
 ✔  Up-to-date            romkatv/powerlevel10k
 ✔  Up-to-date            plugins/git

[zplug] Elapsed time: 2.2610 sec.tate:21: bad math expression: operator expected at `0'
 ==> Updating finished successfully!

@binarykitchen
Copy link

Likewise, I'm still experiencing this too on any Linux machine, but not on MacOS.

@ssh352
Copy link

ssh352 commented Jul 29, 2023

latest MacOSx and latest zplug has this issue.
Screenshot 2023-07-30 at 12 14 18 AM

caused by zplug "mafredri/zsh-async", from:github
manually removed mafredri and sindresorhus directories from .zplug/repo, and zplug install, fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.