-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Different behaviour when invoking .py script through symlink #404
Labels
Comments
blueyed
added a commit
to blueyed/pyenv
that referenced
this issue
Jul 8, 2015
`PYENV_FILE_ARG` is used here to make use of `abs_dirname` later in `libexec/pyenv`. Fixes pyenv#404
I've added a proposed fix for this to #379: blueyed@dab4742 |
If that's the way to go there should be some test for this then. |
blueyed
added a commit
to blueyed/pyenv
that referenced
this issue
Jul 8, 2015
`PYENV_FILE_ARG` is used here to make use of `abs_dirname` later in `libexec/pyenv`. Fixes pyenv#404
Thanks for reporting. Please provide me some minimum script to reproduce the issue (or, test case) if you're available. |
Create a
|
yyuu
added a commit
that referenced
this issue
Sep 22, 2015
yyuu
added a commit
to yyuu/rbenv
that referenced
this issue
Nov 21, 2015
I believe there are 2 weird behaviour relating to `RBENV_DIR`. This should fix both 2. 1. file argument does not follow symlink (pyenv/pyenv#404) 2. file argument works weirdly if first argument doesn't contain `/` (pyenv/pyenv#479) Both can be reproduced with the following setup. ```sh $ mkdir -p ./foo $ echo 2.2.3 > ./foo/.ruby-version $ echo 'puts(RUBY_DESCRIPTION)' > ./foo/test.rb $ mkdir -p ./foo/bar $ echo jruby-9.0.0.0 > ./foo/bar/.ruby-version $ ln -sf ${PWD}/foo/test.rb ./foo/bar/ ``` If the first file argument to `ruby` interpreter is a symlink, it'd be better to follow the link. ```sh $ ruby ./foo/test.rb ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux] $ ruby ./foo/bar/test.rb jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 OpenJDK 64-Bit Server VM 25.72-b05 on 1.8.0_72-internal-b05 +jit [linux-amd64] ``` `RBENV_DIR` just not working if the first file argument doesn't contain `/`. ```sh $ cd ./foo $ ruby test.rb ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux] $ ruby test.rb ./bar/test.rb jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 OpenJDK 64-Bit Server VM 25.72-b05 on 1.8.0_72-internal-b05 +jit [linux-amd64] # <-- this would be better to be 2.2.3 ```
yyuu
added a commit
to yyuu/rbenv
that referenced
this issue
Nov 25, 2015
I believe there are 2 weird behaviour relating to `RBENV_DIR`. This should fix both 2. 1. file argument does not follow symlink (pyenv/pyenv#404) 2. file argument works weirdly if first argument doesn't contain `/` (pyenv/pyenv#479) Both can be reproduced with the following setup. ```sh $ mkdir -p ./foo $ echo 2.2.3 > ./foo/.ruby-version $ echo 'puts(RUBY_DESCRIPTION)' > ./foo/test.rb $ mkdir -p ./foo/bar $ echo jruby-9.0.0.0 > ./foo/bar/.ruby-version $ ln -sf ${PWD}/foo/test.rb ./foo/bar/ ``` If the first file argument to `ruby` interpreter is a symlink, it'd be better to follow the link. ```sh $ ruby ./foo/test.rb ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux] $ ruby ./foo/bar/test.rb jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 OpenJDK 64-Bit Server VM 25.72-b05 on 1.8.0_72-internal-b05 +jit [linux-amd64] ``` `RBENV_DIR` just not working if the first file argument doesn't contain `/`. ```sh $ cd ./foo $ ruby test.rb ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux] $ ruby test.rb ./bar/test.rb jruby 9.0.0.0 (2.2.2) 2015-07-21 e10ec96 OpenJDK 64-Bit Server VM 25.72-b05 on 1.8.0_72-internal-b05 +jit [linux-amd64] # <-- this would be better to be 2.2.3 ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When calling a Python script via its shebang line, the following part in the
python
shim kicks in:However, that should resolve symlinks probably:
Otherwise calling it via a symlink from e.g.
~/bin
pyenv-version-file
will not pick up a.python-version
file from the final destination, but only from~/bin
.The current behaviour could be seen as a feature: by using symlinks you could have different Python versions (depending on where the symlink's file is), but I think it makes more sense to use the real script's dir.
btw: this code currently does not handle
python2
/python3
in the shebang line properly (#379) - I will re-open that PR.The text was updated successfully, but these errors were encountered: