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

0_path.zsh reinserts .yadr directories twice in $PATH when in tmux #506

Merged
merged 1 commit into from
Jul 4, 2014
Merged

0_path.zsh reinserts .yadr directories twice in $PATH when in tmux #506

merged 1 commit into from
Jul 4, 2014

Conversation

padi
Copy link
Contributor

@padi padi commented Jun 19, 2014

in terminal

sky@nimbus ~ $ echo $PATH 
/Users/sky/.rbenv/shims:/Users/sky/.rbenv/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/Users/sky/.yadr/bin:/Users/sky/.yadr/bin/yadr

in tmux

sky@nimbus ~ $ echo $PATH
/Users/sky/.rbenv/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/Users/sky/.rbenv/shims:/Users/sky/.yadr/bin:/Users/sky/.yadr/bin/yadr:/Users/sky/.yadr/bin:/Users/sky/.yadr/bin/yadr

Don't mind the differences in the first parts of the $PATH, I think it's a separate prezto issue (I'm still not sure why). It's best explained by this issue (rbenv breaks inside of tmux). You can choose not to read that issue as it is not related to this problem this PR is solving.

But I've found that the part that adds Users/sky/.yadr/bin:/Users/sky/.yadr/bin/yadr twice in $PATH when using tmux is due to this part that unconditionally modifies $PATH.

Also see: http://stackoverflow.com/a/13060475

in terminal
```sh
sky@nimbus ~ $ echo $PATH 
/Users/sky/.rbenv/shims:/Users/sky/.rbenv/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/Users/sky/.yadr/bin:/Users/sky/.yadr/bin/yadr
```

in tmux

```sh
sky@nimbus ~ $ echo $PATH
/Users/sky/.rbenv/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/Users/sky/.rbenv/shims:/Users/sky/.yadr/bin:/Users/sky/.yadr/bin/yadr:/Users/sky/.yadr/bin:/Users/sky/.yadr/bin/yadr
```
@padi padi changed the title 0_path.zsh reinserts .yadr paths twice in tmux 0_path.zsh reinserts .yadr directories twice in $PATH when in tmux Jun 19, 2014
@jby
Copy link
Contributor

jby commented Jun 22, 2014

Wouldn't it be better to use the first suggestion from that stackoverflow question that you linked?

if [[ -z $TMUX ]]; then
  PATH="$PATH:/foo"
fi

@padi
Copy link
Contributor Author

padi commented Jun 23, 2014

@jby I initially thought of that. However, I was thinking there'd be other terminal programs that will do the same thing aside from tmux. For example, a search in prezto yielded this issue (sorin-ionescu/prezto#500). Seems like they've decided to set the PATH in a similar manner.

0_path.zsh isn't part of prezto, so I'm not sure if it's good to just to erase this file and put the path manipulation in .zprofile/.zshrc, since I have the impression that zsh config customizations should be within the zsh folder only. So in my terminal, I just decided to keep the file and just modify it in the same way prezto suggests.

typeset -gU cdpath fpath mailpath path

# Set the the list of directories that cd searches.
# cdpath=(
#   $cdpath
# )

# Set the list of directories that Zsh searches for programs.
path=(
  /usr/local/{bin,sbin}
  $path
)

I'm not that familliar yet with shell or config files best practices (that's why I'm using yadr. hehe), so any better suggestion is welcome.

@skwp your thoughts?

@skwp
Copy link
Owner

skwp commented Jun 24, 2014

What's the actual issue that this is causing? I'm not sure I understand the solution fully so I don't want to fix a problem that's not actually bothering anyone. Are you having some issues due to this?

@maletor
Copy link
Contributor

maletor commented Jun 24, 2014

There is an issue with having the PATH duplicated onto itself twice because it can lead to unintended consequences when you pop or push something onto the PATH among other reasons, such as clarity of intent.

@padi
Copy link
Contributor Author

padi commented Jun 24, 2014

@skwp I discovered this while I was trying to clean my $PATH because I was having trouble using tmux + rbenv. This issue isn't likely to really cause any big problems for anyone, except that they'd have to deal with duplicate yadr dirs in the $PATH at the end when using any program that goes through that shell initialization again e.g. tmux, screen.

skwp added a commit that referenced this pull request Jul 4, 2014
0_path.zsh reinserts .yadr directories twice in $PATH when in tmux
@skwp skwp merged commit 5e4ff73 into skwp:master Jul 4, 2014
@padi padi deleted the patch-1 branch July 4, 2014 17:02
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 this pull request may close these issues.

4 participants