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

zplug "repos/custom", from:local: not found, $ZPLUG_HOME empty #207

Closed
dezza opened this issue Jun 24, 2016 · 11 comments
Closed

zplug "repos/custom", from:local: not found, $ZPLUG_HOME empty #207

dezza opened this issue Jun 24, 2016 · 11 comments

Comments

@dezza
Copy link

dezza commented Jun 24, 2016

Problem Summary

A relative path is resolved with respect to the $ZPLUG_HOME

zplug "repos/robbyrussell/oh-my-zsh/custom/plugins/my-plugin", from:local

System Information

  • uname -a

    FreeBSD freebsd 10.3-RELEASE-p4 FreeBSD 10.3-RELEASE-p4 #0: Sat May 28 12:23:44 UTC 2016     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
    
  • zsh version

    zsh 5.2 (amd64-portbld-freebsd10.1)
    
  • zplug version/commit

    2.1.0
    

Minimal zshrc

source ~/.zplug/init.zsh

zplug "repos/dezza/vi-mode", from:local

zplug load --verbose

Steps to Reproduce

  1. put a relative path like the one in README.md in your zshrc
  2. load a new shell

stdout on launch new shell:

[zplug] no matching file or directory: repos/dezza/vi-mode

Description

I tried to echo $ZPLUG_HOME since it says it is relative to it. It is empty.

I tried setting it manually. Didn't work.

I tried searching in the source here on github. It seems it only runs this when it gets a zplug.

$ZPLUG_HOME is defined when it has loaded completely (e.g. after loading, not in zshrc)

Specifying the path manually and not relative does work however

zplug "${HOME}/.zplug/repos/dezza/vi-mode", from:local

Just trying to sort this out :)

@NigoroJr NigoroJr added bug and removed bug labels Jun 25, 2016
@NigoroJr
Copy link
Member

Thanks for reporting!

I tried to echo $ZPLUG_HOME since it says it is relative to it. It is empty.

That doesn't sound right. Are you doing that after source ~/.zplug/init.zsh?

Following these steps I was able to get the expected outputs.

$ mkdir -p ~/.zplug/repos/foo/bar
$ echo 'echo a' > ~/.zplug/repos/foo/bar/a.zsh
$ echo 'echo b' > ~/.zplug/repos/foo/bar/b.zsh
$ cat ~/zshrc
source ~/.zplug/init.zsh
zplug 'repos/foo/bar', from:local
zplug check || zplug install
zplug load --verbose
$ # Start a new zsh session
$ zvanilla ~/zshrc
a
  Loaded repos/foo/bar/a.zsh
b
  Loaded repos/foo/bar/b.zsh
%

@dezza
Copy link
Author

dezza commented Jun 25, 2016

Yes it is after source.

@dezza dezza closed this as completed Jun 25, 2016
@dezza dezza reopened this Jun 25, 2016
@dezza
Copy link
Author

dezza commented Jun 25, 2016

@NigoroJr I replicated your setup 100% and moved my old .zshrc out of the way.

Still

[zplug] no matching file or directory: repos/dezza/vi-mode
[zplug] no matching file or directory: repos/foo/bar

$ZPLUG_HOME is set after the first zplug plugin line (in this case "repos/foo/bar". Not after source ~/.zplug/init.zsh though.

I don't know if the FreeBSD default awk is compatible. But GNU awk is a different package (gawk) and it is also registered under a different binary-name "gawk" might break other things if I link it.

Could this be a problem ? Anyone of you tested on FreeBSD ?

@dezza
Copy link
Author

dezza commented Jun 25, 2016

I can reproduce the same error with your example on a Debian VM (debian-8.5.0-amd64-netinst.iso) with gawk install.

$ mkdir -p ~/.zplug/repos/foo/bar
$ echo 'echo a' > ~/.zplug/repos/foo/bar/a.zsh
$ echo 'echo b' > ~/.zplug/repos/foo/bar/b.zsh
$ cat ~/zshrc
source ~/.zplug/init.zsh
zplug 'repos/foo/bar', from:local
zplug check || zplug install
zplug load --verbose

Screenshot

@NigoroJr
Copy link
Member

@dezza Sorry my bad, I was starting a new zsh session from the current session, where ZPLUG_HOME was already set. Clearing that out and then starting a new session, I was able to reproduce the problem. I think it has something to do with sourcing variables.zsh. I will look into it.

@NigoroJr NigoroJr added the bug label Jun 25, 2016
@NigoroJr
Copy link
Member

I took a closer look at the code and it turns out it is the right behavior for ZPLUG_HOME to not be set right after source ~/.zplug/init.zsh. This issue is a bug in the from:local source. I will fix this soon, but I wonder if it's better to make it relative under $HOME or $ZPLUG_HOME? What do you think? @dezza @b4b4r07

@dezza
Copy link
Author

dezza commented Jun 25, 2016

$ZPLUG_HOME points to "${HOME}.zplug/" which is not guessable with $HOME only. It would still need to know the .zplug/ directory at some point - If the intention is to have from:local under repos/

@dezza
Copy link
Author

dezza commented Jun 25, 2016

/base/sources/local.zsh#L15 __zplug::local::check()

/base/sources/local.zsh#L42 __zplug::local::load_plugin()

Needs to read
$ZPLUG_HOME/${zspec[dir]}

__zplug::local::check() {
#[...]
expanded_paths=( $(zsh -c "$_ZPLUG_CONFIG_SUBSHELL; echo ${ZPLUG_HOME}/${zspec[dir]}" 2>/dev/null) )
__zplug::local::load_plugin() {
#[...]
expanded_paths=( $(zsh -c "$_ZPLUG_CONFIG_SUBSHELL; echo ${ZPLUG_HOME}/${zspec[dir]}" 2>/dev/null) )

This is where I am unsure if echo is the right print and if we need a better escaping / quoting. Or if $ZPLUG_HOME insertion right there is hacker-ish if there's logic to do that in another file (which I haven't found, but searched for)

And loading now works fine :)

@dezza
Copy link
Author

dezza commented Jul 3, 2016

Pull request: #210

@ghost
Copy link

ghost commented Jul 24, 2016

I'm seeing something similar. Things like enhanced aren't getting sourced any more.

@babarot babarot added wontfix and removed bug labels Jul 25, 2016
@babarot
Copy link
Member

babarot commented Jul 25, 2016

Thanks all, however, after due deliberation I will abolish it since this specification is difficult to understand and troublesome.

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

3 participants