]> Cypherpunks repositories - gostls13.git/commitdiff
make.bash: preserve GOROOT_BOOTSTRAP
authorMateusz Poliwczak <mpoliwczak34@gmail.com>
Sun, 26 May 2024 18:27:53 +0000 (18:27 +0000)
committerGopher Robot <gobot@golang.org>
Wed, 29 May 2024 13:48:46 +0000 (13:48 +0000)
CL 582076 made the GOROOT_BOOTSTRAP set to "", which in turn
causes the next iteration to return true. "$GOROOT_BOOTSTRAP/bin/go"
becomes "/bin/go", which always exists.

Fixes #67654

Change-Id: I290bd4a7defc58e4b34d5bf955ef4f34569ff0ed
GitHub-Last-Rev: 9c7134fa44874b0a9d03807aa583b1088cc13922
GitHub-Pull-Request: golang/go#67655
Reviewed-on: https://go-review.googlesource.com/c/go/+/588436
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/make.bash
src/make.rc

index 5b49fcccf73aa8b5e3037a2d2bebf5f52ef725e8..814b7e87e1d31309438ec1cb0d421035781a93fa 100755 (executable)
@@ -166,8 +166,10 @@ bootstrapenv() {
 export GOROOT="$(cd .. && pwd)"
 IFS=$'\n'; for go_exe in $(type -ap go); do
        if [[ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]]; then
+               goroot_bootstrap=$GOROOT_BOOTSTRAP
                GOROOT_BOOTSTRAP=""
                goroot=$(bootstrapenv "$go_exe" env GOROOT)
+               GOROOT_BOOTSTRAP=$goroot_bootstrap
                if [[ "$goroot" != "$GOROOT" ]]; then
                        if [[ "$goroot_bootstrap_set" == "true" ]]; then
                                printf 'WARNING: %s does not exist, found %s from env\n' "$GOROOT_BOOTSTRAP/bin/go" "$go_exe" >&2
index 27456f759d27dd2c97ef35f75907839d9f9180c9..54250011dcedf7c366cf9c0b96c750ffb9c831af 100755 (executable)
@@ -60,9 +60,11 @@ if(! ~ $#GOROOT_BOOTSTRAP 1){
 }
 for(p in $path){
        if(! test -x $GOROOT_BOOTSTRAP/bin/go){
-               GOROOT_BOOTSTRAP = ()
                if(go_exe = `{path=$p whatis go}){
+                       goroot_bootstrap = $GOROOT_BOOTSTRAP
+                       GOROOT_BOOTSTRAP = ()
                        goroot = `{bootstrapenv $go_exe env GOROOT}
+                       GOROOT_BOOTSTRAP = $goroot_bootstrap
                        if(! ~ $goroot $GOROOT){
                                if(~ $goroot_bootstrap_set 'true'){
                                        echo 'WARNING: '$GOROOT_BOOTSTRAP'/bin/go does not exist, found '$go_exe' from env' >[1=2]