From b1ee6c93c45869623c0b15b3489cfe05894c4735 Mon Sep 17 00:00:00 2001 From: Shengqi Chen Date: Tue, 28 Mar 2023 16:25:27 +0800 Subject: [PATCH] Try locate `readlink` first in pyenv-hooks, fix #2654 (#2655) * Remove all use of `greadlink`, fix #2654 Signed-off-by: Harry Chen * revert greadlink back in tests --------- Signed-off-by: Harry Chen Co-authored-by: Anton Petrov --- libexec/pyenv | 2 +- libexec/pyenv-hooks | 2 +- libexec/pyenv-versions | 2 +- plugins/python-build/bin/python-build | 7 ++++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/libexec/pyenv b/libexec/pyenv index 35161cf2..fdea4911 100755 --- a/libexec/pyenv +++ b/libexec/pyenv @@ -29,7 +29,7 @@ if enable -f "${BASH_SOURCE%/*}"/../libexec/pyenv-realpath.dylib realpath 2>/dev else [ -z "$PYENV_NATIVE_EXT" ] || abort "failed to load \`realpath' builtin" - READLINK=$(type -P greadlink readlink | head -n1) + READLINK=$(type -P readlink) [ -n "$READLINK" ] || abort "cannot find readlink - are you missing GNU coreutils?" resolve_link() { diff --git a/libexec/pyenv-hooks b/libexec/pyenv-hooks index 7d620d4c..8e55b079 100755 --- a/libexec/pyenv-hooks +++ b/libexec/pyenv-hooks @@ -26,7 +26,7 @@ if ! enable -f "${BASH_SOURCE%/*}"/pyenv-realpath.dylib realpath 2>/dev/null; th echo "pyenv: failed to load \`realpath' builtin" >&2 exit 1 fi -READLINK=$(type -P greadlink readlink | head -n1) +READLINK=$(type -P readlink) if [ -z "$READLINK" ]; then echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2 exit 1 diff --git a/libexec/pyenv-versions b/libexec/pyenv-versions index 71f77190..93f5b13c 100755 --- a/libexec/pyenv-versions +++ b/libexec/pyenv-versions @@ -34,7 +34,7 @@ if ! enable -f "${BASH_SOURCE%/*}"/pyenv-realpath.dylib realpath 2>/dev/null; th exit 1 fi - READLINK=$(type -P greadlink readlink | head -n1) + READLINK=$(type -P readlink) if [ -z "$READLINK" ]; then echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2 exit 1 diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index f7f525c1..2dc6d068 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -56,9 +56,14 @@ lib() { } lib "$1" +READLINK=$(type -P readlink) +if [ -z "$READLINK" ]; then + echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2 + exit 1 +fi resolve_link() { - $(type -P greadlink readlink | head -n1) "$1" + $READLINK "$1" } abs_dirname() {