Skip to content

Commit a0342cd

Browse files
authored
Unrolled build for rust-lang#116732
Rollup merge of rust-lang#116732 - onur-ozkan:resolve-linked-x, r=Mark-Simulacrum Make x capable of resolving symlinks When bootstrapping from outside of the rust source, instead of calling 'x' from the absolute path (like /home/user/rust/x), we should be able to link 'x' from the rust source to binary paths so it can be used easily. Before this change, 'x' was not capable of finding 'x.py' when called from the linked file.
2 parents f70779b + e0fe1d6 commit a0342cd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

x

+6-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ set -eu
1111
sh -n "$0"
1212

1313
realpath() {
14-
if [ -d "$1" ]; then
15-
CDPATH='' command cd "$1" && pwd -P
14+
local path="$1"
15+
if [ -L "$path" ]; then
16+
readlink -f "$path"
17+
elif [ -d "$path" ]; then
18+
(cd -P "$path" && pwd)
1619
else
17-
echo "$(realpath "$(dirname "$1")")/$(basename "$1")"
20+
echo "$(realpath "$(dirname "$path")")/$(basename "$path")"
1821
fi
1922
}
2023

0 commit comments

Comments
 (0)