zplug icon indicating copy to clipboard operation
zplug copied to clipboard

awk availability check not working properly

Open crhg opened this issue 8 years ago • 4 comments

  • Type:
    • [x] Bug
    • [ ] Enhancement
    • [ ] Feature Request
    • [ ] Question

  • zplug --version: 2.4.1
  • zsh --version: zsh 5.2 (x86_64-ubuntu-linux-gnu)
  • uname -a: Linux kanamo 4.8.0-53-generic #56-Ubuntu SMP Tue May 16 00:23:44 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Minimal zshrc (with less than 30 lines)

source ~/.zplug/init.zsh

zplug "zsh-users/zsh-history-substring-search" # This problem is not related to specific plugin

if zplug check || zplug install; then
  zplug load --verbose
fi

Step to reproduce

  1. Install only mawk (no gawk).
  2. Empty .zplug/repos
  3. Run zsh
% zsh -i                                                                                       [~]
[zplug] Start to install 1 plugins in parallel

 ✘  Unknown error         zsh-users/zsh-history-substring-search

[zplug] Elapsed time: 2.1649 sec.
 ==> Installation finished successfully!
 Load "~/.zplug/repos/zsh-users/zsh-history-substring-search/zsh-history-substring-search.zsh" (zsh-users/zsh-history-substring-search)
[zplug] Run compinit

Problem

It seems that zplug is checking awk availability in __zplug::core::core::prepare.

        if ! __zplug::utils::awk::available; then
            __zplug::io::print::f \
                --die \
                --zplug \
                --error \
                'No available AWK variant in your $PATH\n'
            return 1
        fi

But this error does not occur, and "Unknown error" is displayed during installation.

crhg avatar Jun 07 '17 02:06 crhg

According to the readme, mawk is not supported https://github.com/zplug/zplug/blob/master/README.md#requirements

jrock2004 avatar Aug 06 '17 02:08 jrock2004

I solved this by installing gawk: sudo apt install gawk. Hope this helps.

ghost avatar Sep 15 '19 12:09 ghost

This issue is about error message when proper awk is not installed.

  • The error message currently displayed is Unknown error, and there is not enough information to read that the necessary awk is not installed.

  • The source code contains a more appropriate error message 'No available AWK variant in your $PATH \n' that seems to have been prepared for this case, but this is not displayed for some reason.

crhg avatar Sep 17 '19 04:09 crhg

Reproduced this error. It's taken me quite a while to track down this problem. Would be very good if the correct error message mentioned above by @crhg were displayed instead of "Unknown error".

[zplug] Start to update 9 plugins in parallel

 ✘  Unknown error         unixorn/bitbucket-git-helpers.plugin.zsh
 ✘  Unknown error         Tarrasch/zsh-autoenv
 ✘  Unknown error         sharat87/pip-app
 ✘  Unknown error         unixorn/tumult.plugin.zsh
 ✘  Unknown error         caarlos0/zsh-pg
 ✘  Unknown error         zdharma/fast-syntax-highlighting
 ✘  Unknown error         zplug/zplug
 ✘  Unknown error         sei40kr/zsh-tmux-rename
 ✘  Unknown error         supercrabtree/k

[zplug] Elapsed time: 5.1897 sec.
 ==> Updating finished successfully!
piplex% sudo apt-get install gawk
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  gawk-doc
The following NEW packages will be installed:
  gawk
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/480 kB of archives.
After this operation, 1,778 kB of additional disk space will be used.
Selecting previously unselected package gawk.
(Reading database ... 123528 files and directories currently installed.)
Preparing to unpack .../gawk_1%3a4.1.1+dfsg-1_armhf.deb ...
Unpacking gawk (1:4.1.1+dfsg-1) ...
Processing triggers for man-db (2.7.5-1~bpo8+1) ...
Setting up gawk (1:4.1.1+dfsg-1) ...
piplex% zplug update
[zplug] Start to update 9 plugins in parallel

 ✔  Up-to-date            unixorn/bitbucket-git-helpers.plugin.zsh
 ✔  Up-to-date            Tarrasch/zsh-autoenv
 ✔  Up-to-date            sharat87/pip-app
 ✔  Up-to-date            unixorn/tumult.plugin.zsh
 ✔  Up-to-date            caarlos0/zsh-pg
 ✔  Up-to-date            zdharma/fast-syntax-highlighting
 ✔  Up-to-date            zplug/zplug
 ✔  Up-to-date            sei40kr/zsh-tmux-rename
 ✔  Up-to-date            supercrabtree/k

[zplug] Elapsed time: 5.1251 sec.
 ==> Updating finished successfully!
piplex% zplug --version
2.4.2
piplex% zsh --version
zsh 5.0.7 (arm-unknown-linux-gnueabihf)
piplex% uname -a
Linux piplex 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux```

npadgen avatar Apr 18 '20 10:04 npadgen