Skip to content

cmd/dist: set buildvcs=false when building go-bootstrap #61621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

paralin
Copy link
Contributor

@paralin paralin commented Jul 27, 2023

When building go-bootstrap as part of the make.bash process, the cmd/dist invokes the bootstrap Go compiler to build the go_bootstrap tool:

${GOROOT_BOOTSTRAP}/bin/go install -tags=math_big_pure_go compiler_bootstrap purego bootstrap/cmd/...

If there is an invalid .git directory in a parent of ${GOROOT_BOOTSTRAP}, make.bash will fail. Reproduction of the issue:

mkdir go-issue-61620
cd ./go-issue-61620
wget https://go.dev/dl/go1.19.11.src.tar.gz
mkdir go-bootstrap
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
cd ./go-bootstrap/src/
bash make.bash
cd ../../
wget https://go.dev/dl/go1.20.6.src.tar.gz
mkdir go
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
printf "gitdir: ../../does/not/exist/.git" > ./.git
cd ./go/src/
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash

The build fails with the following error:

Building Go toolchain1 using [snip]/go-1.19.10.
error obtaining VCS status: exit status 128
Use -buildvcs=false to disable VCS stamping.
go tool dist: FAILED: [snip]/go-1.19.10/bin/go install -tags=math_big_pure_go
compiler_bootstrap purego bootstrap/cmd/...: exit status 1

This change unconditionally sets -buildvcs=false when compiling go-bootstrap. We don't need the revision information in those binaries anyway. Setting this flag was previously not done as we were unsure if the go-bootstrap compiler would be new enough to support the buildvcs build flag. However, since Go 1.20.x, Go 1.19.x is the minimum version for go-bootstrap, and supports -buildvcs=false. We can now set -buildvcs=false without worrying about compatibility.

Related: #54852
Fixes: #61620

@gopherbot
Copy link
Contributor

This PR (HEAD: ec6af18) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/go/+/513835.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to register for Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

paralin added a commit to skiffos/buildroot that referenced this pull request Jul 27, 2023
When compiling without a Git repository, "go install" returns an error:

error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.

Set -buildvcs=false in go install when isGitDir() returns false.

Set GOBOOTSTRAP_BUILDVCS=0 to force isGitDir() to return false and thereby set
buildvcs=false in "go install" within make.bash (which runs cmd/dist).

Report: https://lists.buildroot.org/pipermail/buildroot/2023-July/671344.html
Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/4725186525
Upstream: golang/go#61621

Signed-off-by: Christian Stewart <[email protected]>
@gopherbot
Copy link
Contributor

Message from Gopher Robot:

Patch Set 1:

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
A maintainer will review your change and provide feedback. See
https://go.dev/doc/contribute#review for more info and tips to get your
patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11 or adds a tag like "wait-release", it means that this CL will be
reviewed as part of the next development cycle. See https://go.dev/s/release
for more details.


Please don’t reply on this GitHub thread. Visit golang.org/cl/513835.
After addressing review feedback, remember to publish your drafts!

paralin added a commit to skiffos/buildroot that referenced this pull request Jul 27, 2023
When compiling without a Git repository, "go install" returns an error:

error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.

Set -buildvcs=false in go install when isGitDir() returns false.

Set GOBOOTSTRAP_BUILDVCS=0 to force isGitDir() to return false and thereby set
buildvcs=false in "go install" within make.bash (which runs cmd/dist).

Report: https://lists.buildroot.org/pipermail/buildroot/2023-July/671344.html
Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/4725186525
Upstream: golang/go#61621

Signed-off-by: Christian Stewart <[email protected]>

---

v1 -> v2:

 - sort HOST_GO_MAKE_ENV alphabetically
@gopherbot
Copy link
Contributor

Message from Dmitri Shuralyov:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/513835.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Christian Stewart:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/513835.
After addressing review feedback, remember to publish your drafts!

@paralin paralin changed the title cmd/dist: set buildvcs=false if not within a git repository cmd/dist: set buildvcs=false when building go-bootstrap Jul 28, 2023
@gopherbot
Copy link
Contributor

This PR (HEAD: bc8159e) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/go/+/513835.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to register for Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

When building go-bootstrap as part of the make.bash process, the cmd/dist
invokes the bootstrap Go compiler to build the go_bootstrap tool:

${GOROOT_BOOTSTRAP}/bin/go install -tags=math_big_pure_go compiler_bootstrap purego bootstrap/cmd/...

If there is an invalid .git directory in a parent of ${GOROOT_BOOTSTRAP},
make.bash will fail. Reproduction of the issue:

  mkdir go-issue-61620
  cd ./go-issue-61620
  wget https://go.dev/dl/go1.19.11.src.tar.gz
  mkdir go-bootstrap
  tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
  cd ./go-bootstrap/src/
  bash make.bash
  cd ../../
  wget https://go.dev/dl/go1.20.6.src.tar.gz
  mkdir go
  tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
  printf "gitdir: ../../does/not/exist/.git" > ./.git
  cd ./go/src/
  GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash

The build fails with the following error:

  Building Go toolchain1 using [snip]/go-1.19.10.
  error obtaining VCS status: exit status 128
    Use -buildvcs=false to disable VCS stamping.
  go tool dist: FAILED: [snip]/go-1.19.10/bin/go install -tags=math_big_pure_go \
    compiler_bootstrap purego bootstrap/cmd/...: exit status 1

This change unconditionally sets -buildvcs=false when compiling go-bootstrap. We
don't need the revision information in those binaries anyway. Setting this flag
was previously not done as we were unsure if the go-bootstrap compiler would be
new enough to support the buildvcs build flag. Since Go 1.20.x, Go 1.19.x is the
minimum version for go-bootstrap, and supports -buildvcs=false. We can now set
-buildvcs=false without worrying about compatibility.

Related: golang#54852
Fixes: golang#61620
@gopherbot
Copy link
Contributor

Message from Christian Stewart:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/513835.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: 6b05378) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/go/+/513835.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to register for Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

paralin added a commit to skiffos/buildroot that referenced this pull request Jul 28, 2023
Building host-go within docker fails:

error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.

Reproduction of the issue:

mkdir go-issue-61620
cd ./go-issue-61620
wget https://go.dev/dl/go1.19.11.src.tar.gz
mkdir go-bootstrap
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
cd ./go-bootstrap/src/
bash make.bash
cd ../../
wget https://go.dev/dl/go1.20.6.src.tar.gz
mkdir go
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
printf "gitdir: ../../does/not/exist/.git" > ./.git
cd ./go/src/
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash

The error only occurs when the .git that git detects in the parent directory of
the GOROOT_BOOTSTRAP is invalid or not present causing errors when running `git`
commands within GOROOT_BOOTSTRAP.

Report: https://lists.buildroot.org/pipermail/buildroot/2023-July/671344.html
Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/4725186525
Upstream issue: golang/go#61620
Upstream PR: golang/go#61621

Signed-off-by: Christian Stewart <[email protected]>

---

v1 -> v2:

 - sort HOST_GO_MAKE_ENV alphabetically
 - simplify the patch to set buildvcs=false unconditionally for go-bootstrap
 - create a minimal reproduction of the issue
 - simplify the commit message with the minimal reproduction
paralin added a commit to skiffos/buildroot that referenced this pull request Jul 28, 2023
Building host-go within docker fails:

error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.

Reproduction of the issue:

mkdir go-issue-61620
cd ./go-issue-61620
wget https://go.dev/dl/go1.19.11.src.tar.gz
mkdir go-bootstrap
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
cd ./go-bootstrap/src/
bash make.bash
cd ../../
wget https://go.dev/dl/go1.20.6.src.tar.gz
mkdir go
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
printf "gitdir: ../../does/not/exist/.git" > ./.git
cd ./go/src/
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash

The error only occurs when the .git that git detects in the parent directory of
the GOROOT_BOOTSTRAP is invalid or not present causing errors when running `git`
commands within GOROOT_BOOTSTRAP.

Report: https://lists.buildroot.org/pipermail/buildroot/2023-July/671344.html
Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/4725186525
Upstream issue: golang/go#61620
Upstream PR: golang/go#61621

Signed-off-by: Christian Stewart <[email protected]>

---

v1 -> v2:

 - sort HOST_GO_MAKE_ENV alphabetically
 - simplify the patch to set buildvcs=false unconditionally for go-bootstrap
 - create a minimal reproduction of the issue
 - simplify the commit message with the minimal reproduction
paralin added a commit to skiffos/buildroot that referenced this pull request Jul 28, 2023
Building host-go within docker fails:

error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.

Reproduction of the issue:

mkdir go-issue-61620
cd ./go-issue-61620
wget https://go.dev/dl/go1.19.11.src.tar.gz
mkdir go-bootstrap
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
cd ./go-bootstrap/src/
bash make.bash
cd ../../
wget https://go.dev/dl/go1.20.6.src.tar.gz
mkdir go
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
printf "gitdir: ../../does/not/exist/.git" > ./.git
cd ./go/src/
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash

The error only occurs when the .git that git detects in the parent directory of
the GOROOT_BOOTSTRAP is invalid or not present causing errors when running `git`
commands within GOROOT_BOOTSTRAP.

Report: https://lists.buildroot.org/pipermail/buildroot/2023-July/671344.html
Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/4725186525
Upstream issue: golang/go#61620
Upstream PR: golang/go#61621

Signed-off-by: Christian Stewart <[email protected]>

---

v1 -> v2:

 - sort HOST_GO_MAKE_ENV alphabetically
 - simplify the patch to set buildvcs=false unconditionally for go-bootstrap
 - create a minimal reproduction of the issue
 - simplify the commit message with the minimal reproduction
paralin added a commit to skiffos/buildroot that referenced this pull request Jul 28, 2023
Building host-go within docker fails:

error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.

Reproduction of the issue:

mkdir go-issue-61620
cd ./go-issue-61620
wget https://go.dev/dl/go1.19.11.src.tar.gz
mkdir go-bootstrap
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
cd ./go-bootstrap/src/
bash make.bash
cd ../../
wget https://go.dev/dl/go1.20.6.src.tar.gz
mkdir go
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
printf "gitdir: ../../does/not/exist/.git" > ./.git
cd ./go/src/
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash

The error only occurs when the .git that git detects in the parent directory of
the GOROOT_BOOTSTRAP is invalid or not present causing errors when running `git`
commands within GOROOT_BOOTSTRAP.

Report: https://lists.buildroot.org/pipermail/buildroot/2023-July/671344.html
Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/4725186525
Upstream issue: golang/go#61620
Upstream PR: golang/go#61621

Signed-off-by: Christian Stewart <[email protected]>

---

v1 -> v2:

 - sort HOST_GO_MAKE_ENV alphabetically
 - simplify the patch to set buildvcs=false unconditionally for go-bootstrap
 - create a minimal reproduction of the issue
 - simplify the commit message with the minimal reproduction

v2 -> v3:

 - drop unnecessary go.mk change
@gopherbot
Copy link
Contributor

Message from Christian Stewart:

Patch Set 3:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/513835.
After addressing review feedback, remember to publish your drafts!

paralin added a commit to skiffos/buildroot that referenced this pull request Jul 28, 2023
Building host-go within docker fails:

error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.

Reproduction of the issue:

mkdir go-issue-61620
cd ./go-issue-61620
wget https://go.dev/dl/go1.19.11.src.tar.gz
mkdir go-bootstrap
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
cd ./go-bootstrap/src/
bash make.bash
cd ../../
wget https://go.dev/dl/go1.20.6.src.tar.gz
mkdir go
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
printf "gitdir: ../../does/not/exist/.git" > ./.git
cd ./go/src/
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash

The error only occurs when the .git that git detects in the parent directory of
the GOROOT_BOOTSTRAP is invalid or not present causing errors when running `git`
commands within GOROOT_BOOTSTRAP.

Report: https://lists.buildroot.org/pipermail/buildroot/2023-July/671344.html
Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/4725186525
Upstream issue: golang/go#61620
Upstream PR: golang/go#61621

Signed-off-by: Christian Stewart <[email protected]>

---

v1 -> v2:

 - sort HOST_GO_MAKE_ENV alphabetically
 - simplify the patch to set buildvcs=false unconditionally for go-bootstrap
 - create a minimal reproduction of the issue
 - simplify the commit message with the minimal reproduction

v2 -> v3:

 - drop unnecessary go.mk change
paralin added a commit to skiffos/buildroot that referenced this pull request Jul 28, 2023
Building host-go within docker fails:

error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.

Reproduction of the issue:

mkdir go-issue-61620
cd ./go-issue-61620
wget https://go.dev/dl/go1.19.11.src.tar.gz
mkdir go-bootstrap
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
cd ./go-bootstrap/src/
bash make.bash
cd ../../
wget https://go.dev/dl/go1.20.6.src.tar.gz
mkdir go
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
printf "gitdir: ../../does/not/exist/.git" > ./.git
cd ./go/src/
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash

The error only occurs when the .git that git detects in the parent directory of
the GOROOT_BOOTSTRAP is invalid or not present causing errors when running `git`
commands within GOROOT_BOOTSTRAP.

Report: https://lists.buildroot.org/pipermail/buildroot/2023-July/671344.html
Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/4725186525
Upstream issue: golang/go#61620
Upstream PR: golang/go#61621

Signed-off-by: Christian Stewart <[email protected]>

---

v1 -> v2:

 - sort HOST_GO_MAKE_ENV alphabetically
 - simplify the patch to set buildvcs=false unconditionally for go-bootstrap
 - create a minimal reproduction of the issue
 - simplify the commit message with the minimal reproduction

v2 -> v3:

 - drop unnecessary go.mk change
arnout pushed a commit to buildroot/buildroot that referenced this pull request Jul 28, 2023
Building host-go within docker fails:

error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.

Reproduction of the issue:

mkdir go-issue-61620
cd ./go-issue-61620
wget https://go.dev/dl/go1.19.11.src.tar.gz
mkdir go-bootstrap
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
cd ./go-bootstrap/src/
bash make.bash
cd ../../
wget https://go.dev/dl/go1.20.6.src.tar.gz
mkdir go
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
printf "gitdir: ../../does/not/exist/.git" > ./.git
cd ./go/src/
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash

The error only occurs when the .git that git detects in the parent directory of
the GOROOT_BOOTSTRAP is invalid or not present causing errors when running `git`
commands within GOROOT_BOOTSTRAP.

Report: https://lists.buildroot.org/pipermail/buildroot/2023-July/671344.html
Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/4725186525
Upstream issue: golang/go#61620
Upstream PR: golang/go#61621

Signed-off-by: Christian Stewart <[email protected]>
Signed-off-by: Thomas Petazzoni <[email protected]>
@gopherbot
Copy link
Contributor

Message from Bryan Mills:

Patch Set 3:

(3 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/513835.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Christian Stewart:

Patch Set 3:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/513835.
After addressing review feedback, remember to publish your drafts!

citral23 pushed a commit to citral23/buildroot that referenced this pull request Sep 18, 2023
Building host-go within docker fails:

error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.

Reproduction of the issue:

mkdir go-issue-61620
cd ./go-issue-61620
wget https://go.dev/dl/go1.19.11.src.tar.gz
mkdir go-bootstrap
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
cd ./go-bootstrap/src/
bash make.bash
cd ../../
wget https://go.dev/dl/go1.20.6.src.tar.gz
mkdir go
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
printf "gitdir: ../../does/not/exist/.git" > ./.git
cd ./go/src/
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash

The error only occurs when the .git that git detects in the parent directory of
the GOROOT_BOOTSTRAP is invalid or not present causing errors when running `git`
commands within GOROOT_BOOTSTRAP.

Report: https://lists.buildroot.org/pipermail/buildroot/2023-July/671344.html
Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/4725186525
Upstream issue: golang/go#61620
Upstream PR: golang/go#61621

Signed-off-by: Christian Stewart <[email protected]>
Signed-off-by: Thomas Petazzoni <[email protected]>
arnout pushed a commit to buildroot/buildroot that referenced this pull request Oct 8, 2023
Building host-go within docker fails:

error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.

Reproduction of the issue:

mkdir go-issue-61620
cd ./go-issue-61620
wget https://go.dev/dl/go1.19.11.src.tar.gz
mkdir go-bootstrap
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
cd ./go-bootstrap/src/
bash make.bash
cd ../../
wget https://go.dev/dl/go1.20.6.src.tar.gz
mkdir go
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
printf "gitdir: ../../does/not/exist/.git" > ./.git
cd ./go/src/
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash

The error only occurs when the .git that git detects in the parent directory of
the GOROOT_BOOTSTRAP is invalid or not present causing errors when running `git`
commands within GOROOT_BOOTSTRAP.

Report: https://lists.buildroot.org/pipermail/buildroot/2023-July/671344.html
Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/4725186525
Upstream issue: golang/go#61620
Upstream PR: golang/go#61621

Signed-off-by: Christian Stewart <[email protected]>
Signed-off-by: Thomas Petazzoni <[email protected]>
(cherry picked from commit bc8e70a)
Signed-off-by: Peter Korsgaard <[email protected]>
agners pushed a commit to home-assistant/buildroot that referenced this pull request Oct 17, 2023
Building host-go within docker fails:

error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.

Reproduction of the issue:

mkdir go-issue-61620
cd ./go-issue-61620
wget https://go.dev/dl/go1.19.11.src.tar.gz
mkdir go-bootstrap
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
cd ./go-bootstrap/src/
bash make.bash
cd ../../
wget https://go.dev/dl/go1.20.6.src.tar.gz
mkdir go
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
printf "gitdir: ../../does/not/exist/.git" > ./.git
cd ./go/src/
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash

The error only occurs when the .git that git detects in the parent directory of
the GOROOT_BOOTSTRAP is invalid or not present causing errors when running `git`
commands within GOROOT_BOOTSTRAP.

Report: https://lists.buildroot.org/pipermail/buildroot/2023-July/671344.html
Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/4725186525
Upstream issue: golang/go#61620
Upstream PR: golang/go#61621

Signed-off-by: Christian Stewart <[email protected]>
Signed-off-by: Thomas Petazzoni <[email protected]>
(cherry picked from commit bc8e70a)
Signed-off-by: Peter Korsgaard <[email protected]>
@gopherbot
Copy link
Contributor

Message from Christian Stewart:

Patch Set 3:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/513835.
After addressing review feedback, remember to publish your drafts!

@paralin
Copy link
Contributor Author

paralin commented Feb 16, 2025

@seankhliao this is still applicable, can we reopen?

@seankhliao
Copy link
Member

yes, sorry I looked at the wrong linked issue

@seankhliao seankhliao reopened this Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cmd/dist: fails with buildvcs=false errors if invalid .git exists in parent of GOROOT_BOOTSTRAP
3 participants