Skip to content

Commit

Permalink
bail out early if readlink is not available
Browse files Browse the repository at this point in the history
readlink comes from GNU coreutils.  On systems without it, rbenv used to
spin out of control when it didn't have readlink or greadlink available
because it would re-exec the frontend script over and over instead of the
worker script in libexec.

Fixes #389
  • Loading branch information
James FitzGibbon authored and mislav committed Jun 7, 2013
1 parent e93ab45 commit 81bb14e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
8 changes: 7 additions & 1 deletion libexec/rbenv
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ if [ -n "$RBENV_DEBUG" ]; then
set -x
fi

READLINK=$(type -p greadlink readlink | head -1)
if [ -z "$READLINK" ]; then
echo "rbenv: cannot find readlink - are you missing GNU coreutils?" >&2
exit 1
fi

resolve_link() {
$(type -p greadlink readlink | head -1) "$1"
$READLINK "$1"
}

abs_dirname() {
Expand Down
8 changes: 7 additions & 1 deletion libexec/rbenv-hooks
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ if [ -z "$RBENV_COMMAND" ]; then
exit 1
fi

READLINK=$(type -p greadlink readlink | head -1)
if [ -z "$READLINK" ]; then
echo "rbenv: cannot find readlink - are you missing GNU coreutils?" >&2
exit 1
fi

resolve_link() {
$(type -p greadlink readlink | head -1) $1
$READLINK "$1"
}

realpath() {
Expand Down
8 changes: 7 additions & 1 deletion libexec/rbenv-init
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ if [ -z "$shell" ]; then
shell="$(basename "$SHELL")"
fi

READLINK=$(type -p greadlink readlink | head -1)
if [ -z "$READLINK" ]; then
echo "rbenv: cannot find readlink - are you missing GNU coreutils?" >&2
exit 1
fi

resolve_link() {
$(type -p greadlink readlink | head -1) $1
$READLINK "$1"
}

abs_dirname() {
Expand Down

0 comments on commit 81bb14e

Please sign in to comment.