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

Use realpath of scripts to determine relative locations #308

Merged
merged 1 commit into from
Oct 14, 2022

Conversation

andrew-christianson
Copy link
Contributor

Just using paths relative to ${BASH_SOURCE} fails if the scripts are
symlinked to a location, as that variable reports the path at which
the script is invoked, not where it actually resides. This commit
implements a simple version of the realpath functionality in order to
determine the path to the more comprehensive realpath script

This should resolve my issue #307

Just using paths relative to ${BASH_SOURCE} fails if the scripts are
symlinked to a location, as that variable reports the path at which
the script is invoked, not where it actually resides.  This commit
implements a simple version of the realpath functionality in order to
determine the path to the more comprehensive realpath script
@j9ac9k
Copy link

j9ac9k commented Jul 3, 2019

I think this issue and associated PR would fix this downstream issue: Homebrew/homebrew-core#40810

@bosr
Copy link

bosr commented Aug 3, 2019

Is there any news? This prevents the use of homebrew-installed pyenv-virtualenv for managing miniconda3. Thanks!

@frankhinek
Copy link

I have the same issue with Homebrew-installed pyenv-virtual not working for managing miniconda3. The issue with this PR, at least for me, is that it depends on a user having installed GNU coreutils. For other reasons I don't have this package installed and the readlink version at /usr/bin/readlink doesn't support the -f parameter so the suggested fix fails with:

/usr/bin/readlink: illegal option -- f
usage: readlink [-n] [file ...]

@j9ac9k
Copy link

j9ac9k commented Aug 23, 2019

Having coreutils installed I would suspect is fine on its own, however if we mandate they be added in the PATH with their non "g" prefix, this causes all sorts of other issues.

Here is a stack overflow post for getting equivalent behavior of readlink -f on macOS

https://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac

@Arbitrageur
Copy link

Please review and merge PR from @andrew-christianson

@andrew-christianson
Copy link
Contributor Author

@frankhinek at least in my understanding, pyenv expects macOS users to have coretutils installed but not linked, as there are other points in the main project where the same READLINK=$(type ...) construction is used.

@j9ac9k I'm not good enough shell to determine whether the linked answer is sufficiently portable for this project - I'd rather defer to a system- or homebrew-provided readlink instead of re-implementing.

@yyuu could you merge this? I've been my version since this PR, and haven't had issues with the change.

@native-api native-api merged commit c4de255 into pyenv:master Oct 14, 2022
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.

6 participants