Browse Source

Resolve symlinks to cipd, vpython3

If we point a symlink at vpython3 (or various other tools), it will try
to resolve the depot_tools path to wherever that symlink is stored. We
should instead follow the symlink before determining the path.

Prior art:

* in python, we're doing Path.resolve() in many cases
* in shell, there's a "$(readlink "$(dirname "$0"))" (man/push_to_gs.sh)

BUG=b:270994985
TEST=symlink to vpython3 works

Change-Id: Ifee014d2571ccf58d830a2702c8a0ea225dd4821
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4295094
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Brian Norris <briannorris@chromium.org>
Brian Norris 2 năm trước cách đây
mục cha
commit
c962e86f7b
2 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 1 1
      cipd
  2. 1 1
      vpython3

+ 1 - 1
cipd

@@ -6,7 +6,7 @@
 
 set -e -o pipefail
 
-MYPATH=$(dirname "${BASH_SOURCE[0]}")
+MYPATH=$(dirname "$(realpath "${BASH_SOURCE[0]}")")
 CYGWIN=false
 
 # Make sure this starts empty

+ 1 - 1
vpython3

@@ -34,7 +34,7 @@ then
 fi
 
 
-base_dir=$(dirname "$0")
+base_dir=$(dirname "$(realpath "$0")")
 
 source "$base_dir/cipd_bin_setup.sh"
 cipd_bin_setup &> /dev/null