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

Unable to install fd #454

Closed
2 of 4 tasks
bbenne10 opened this issue Jan 29, 2018 · 3 comments
Closed
2 of 4 tasks

Unable to install fd #454

bbenne10 opened this issue Jan 29, 2018 · 3 comments

Comments

@bbenne10
Copy link
Contributor

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

  • zplug --version: 2.4.2
  • zsh --version: zsh 5.1.1 (x86_64-ubuntu-linux-gnu)
  • uname -a: Linux XXXXXXXX 4.10.0-42-generic Manual sourcing of .zshrc reports errors #46~16.04.1-Ubuntu SMP Mon Dec 4 15:57:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Minimal zshrc

source ~/.zplug/init.zsh

zplug "sharkdp/fd", \
      from:gh-r, \
      as:command, \
      use:fd, \
      rename-to:fd

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

Step to reproduce

  1. Run the above minimal zshrc
  2. head ~/.zplug/bin/fd, and note that the file is a script, not the binary you expected.

Issue

The default candidate selection for commands seems inadequate for fd. fd's downloaded tar.gz contains the following:

fd
autocomplete/fd.bash-completion
autocomplete/fd.fish
autocomplete/_fd

fd is the binary I'd like. autocomplete/_fd looks to be a wrapper script (no doubt useful, but not the tool itself). Specifying use:fd, as above, is getting autocomplete/_fd for some reason.

I've tried multiple use parameters, but nothing has yet allowed me to access the correct binary. The documentation doesn't mention this explicitly (I assume because this behavior is supposed to be default?)

I joined the slack channel, but it was a ghost town. I figured I would ask to see if this was a bug here. If you need any more information, please let me know.

@bbenne10
Copy link
Contributor Author

bbenne10 commented Jan 31, 2018

The problem appears to come from line 216 in releases.zsh.
This line will find "fd-v6.2.0-x86_64-unknown-linux-gnu/autocomplete/_fd" before it finds "fd-v6.2.0-x86-unknown-linux-gnu/fd". My suggestion (and the obvious answer) is to modify as follows:

binaries=()
binaries+=(**/$cmd(N-.))  # new. Will find files which are named exactly $cmd
binaries+=(**/*$cmd*(N-.)) 
binaries+=(**/*(N-*))
binaries+=( $(file **/*(N-.)  | awk -F: '$2 ~ /executable/{print $1}') )

Of course, if we weren't dual-using $tags[use] as both a target script glob AND as a target download glob, we wouldn't be in this pickle as we could declare exactly which file to rip out of the download in the same manner as as:plugin does. Fundamentally, I believe that this sort of parameter re-use is more confusing than helpful (especially here!), but I'm not sure that there's a way to back that change out.

@bbenne10
Copy link
Contributor Author

bbenne10 commented Jan 31, 2018

Hell - we could even replace the globbing with a call to 'find' if we're okay with GNU extensions and recent-ish versions of find: find . -name "*$cmd*" -executable -type f

-executable was added to GNU find in or slightly before 4.4.0, which was released in 2008

@babarot
Copy link
Member

babarot commented May 14, 2018

Maybe fixed. So please clone latest zplug and check it works correctly

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

No branches or pull requests

2 participants