zplug icon indicating copy to clipboard operation
zplug copied to clipboard

Messy output when do zplug update

Open CarterLi opened this issue 8 years ago • 24 comments

  • Type:
    • [x] 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'

CarterLi avatar Jun 17 '17 03:06 CarterLi

I experience this when both installing plugins and updating.

sudoforge avatar Jul 16 '17 15:07 sudoforge

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.

akrejczinger avatar Jul 19 '17 13:07 akrejczinger

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

CarterLi avatar Jul 20 '17 02:07 CarterLi

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 avatar Jul 20 '17 03:07 sudoforge

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

akrejczinger avatar Jul 20 '17 09:07 akrejczinger

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.

CarterLi avatar Aug 11 '17 14:08 CarterLi

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

sudoforge avatar Aug 11 '17 16:08 sudoforge

@bddenhartog What locale prints?

CarterLi avatar Aug 12 '17 13:08 CarterLi

@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

sudoforge avatar Aug 14 '17 15:08 sudoforge

Removing setopt rc_expand_param from my zshrc solved this for me.

drrlvn avatar Aug 27 '17 14:08 drrlvn

@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 avatar Aug 27 '17 15:08 sudoforge

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
...

sudoforge avatar Aug 27 '17 15:08 sudoforge

@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.

drrlvn avatar Aug 27 '17 15:08 drrlvn

@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.

sudoforge avatar Aug 27 '17 15:08 sudoforge

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=

sbusch avatar Nov 12 '17 14:11 sbusch

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

cailloumajor avatar Aug 24 '18 14:08 cailloumajor

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"

raabf avatar Nov 06 '18 13:11 raabf

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

nbrondeau avatar Nov 03 '19 13:11 nbrondeau

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

simonbcn avatar Dec 21 '19 09:12 simonbcn

Same issue.

deividaspetraitis avatar Oct 15 '20 11:10 deividaspetraitis

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

kleest avatar Aug 20 '22 11:08 kleest

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!

plague-doctor avatar Mar 14 '23 20:03 plague-doctor

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

binarykitchen avatar Jun 01 '23 23:06 binarykitchen

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.

ssh352 avatar Jul 29 '23 16:07 ssh352