Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Use realpath instead of readlink in binary wrappers
Browse files Browse the repository at this point in the history
Summary:
Readlink directly returns the target of a symlink. If
the symlink is relative, readlink only returns the
relative path. This path is relative to the buck executable
on $PATH, not to the current working directory, so the
Python invocation fails.

Using realpath instead directly resolves the full absolute
path referred to by the symlink, allowing users to use
relative symlinks in their bin/ directory on $PATH.
Closes #930

Reviewed By: Coneko

fbshipit-source-id: f537e70
  • Loading branch information
aarongable authored and Facebook Github Bot committed Oct 12, 2016
1 parent 66d5b89 commit 7568a46
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/buck
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# systems don't have this flag. *sigh*
BUCK_PATH="$0"
while [ -h "$BUCK_PATH" ]; do
BUCK_PATH=$(readlink "$BUCK_PATH")
BUCK_PATH=$(realpath "$BUCK_PATH")
done
BUCK_DIR=$(dirname "$BUCK_PATH")

Expand Down
2 changes: 1 addition & 1 deletion bin/buckd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# systems don't have this flag. *sigh*
BUCK_PATH="$0"
while [ -h "$BUCK_PATH" ]; do
BUCK_PATH=$(readlink "$BUCK_PATH")
BUCK_PATH=$(realpath "$BUCK_PATH")
done
BUCK_DIR=$(dirname "$BUCK_PATH")

Expand Down

0 comments on commit 7568a46

Please sign in to comment.