Skip to content

Commit b836fe5

Browse files
committed
fix(bootstrap): resolve relative symlinks
A symlink to a bootstrap script can be relative. Resolve a relative symlink target to the linkname parent directory.
1 parent 43a5acf commit b836fe5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

python/private/stage1_bootstrap_template.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ else
9797
if [[ ! -L "$stub_filename" ]]; then
9898
break
9999
fi
100-
stub_filename=$(readlink $stub_filename)
100+
stub_filename_target=$(readlink $stub_filename)
101+
if [[ "$stub_filename_target" == /* ]]; then
102+
stub_filename="$target"
103+
else
104+
stub_filename="${stub_filename%/*}/$stub_filename_target"
105+
fi
106+
unset stub_filename_target
101107
done
102108
echo >&2 "Unable to find runfiles directory for $1"
103109
exit 1

0 commit comments

Comments
 (0)