Skip to content
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

test: "buildrundir", "builddir" directives leave untracked go_asm.h files #28781

Closed
giuscri opened this issue Nov 13, 2018 · 3 comments
Assignees
Milestone

Comments

@giuscri
Copy link

@giuscri giuscri commented Nov 13, 2018

What version of Go are you using (go version)?

$ go version
go version devel +62b850f1c5 Tue Nov 13 18:11:58 2018 +0000 linux/amd64

Does this issue reproduce with the latest release?

I didn't test it with the latest release.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/g/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/g/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build188977799=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ git clone git@github.com:golang/go.git
$ cd go/src
$ ./all.bash

What did you expect to see?

$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

What did you see instead?

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	test/fixedbugs/issue22877.dir/go_asm.h
	test/retjmp.dir/go_asm.h

nothing added to commit but untracked files present (use "git add" to track)
@ALTree

This comment has been minimized.

Copy link
Member

@ALTree ALTree commented Nov 13, 2018

I can reproduce this. Quick way:

$ cd test
$ gotip run run.go -- fixedbugs/issue22877.go
$ gotip run run.go -- retjmp.go

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	fixedbugs/issue22877.dir/go_asm.h
	retjmp.dir/go_asm.h

nothing added to commit but untracked files present (use "git add" to track)
@ALTree ALTree added this to the Go1.12 milestone Nov 13, 2018
@ALTree ALTree changed the title Untracked .h files after running all.bash script test: untracked .h files after running all.bash script Nov 13, 2018
@odeke-em odeke-em changed the title test: untracked .h files after running all.bash script test: "buildrundir" directive leaves untracked go_asm.h files Nov 13, 2018
@odeke-em odeke-em changed the title test: "buildrundir" directive leaves untracked go_asm.h files test: "buildrundir", "builddir" directives leave untracked go_asm.h files Nov 13, 2018
@odeke-em

This comment has been minimized.

Copy link
Member

@odeke-em odeke-em commented Nov 13, 2018

Thanks for reporting this @giuscri and @ALTree for the investigation!

I've updated the issue title, it seems to come from "builddir", "buildrundir" directives not cleaning up created files as per

go/test/run.go

Line 811 in 0098f8a

if err := ioutil.WriteFile(filepath.Join(longdir, "go_asm.h"), nil, 0666); err != nil {

which unfortunately doesn't clean up its content on defer. The update below fixes it

diff --git a/test/run.go b/test/run.go
index a01fd6a957..d7fa430f2b 100644
--- a/test/run.go
+++ b/test/run.go
@@ -808,7 +808,10 @@ func (t *test) run() {
 
 		}
 		if len(asms) > 0 {
-			if err := ioutil.WriteFile(filepath.Join(longdir, "go_asm.h"), nil, 0666); err != nil {
+			emptyASMFile := filepath.Join(longdir, "go_asm.h")
+			defer os.RemoveAll(emptyASMFile)
+
+			if err := ioutil.WriteFile(emptyASMFile, nil, 0666); err != nil {
 				t.err = fmt.Errorf("write empty go_asm.h: %s", err)
 				return
 			}

and this seems to stem from https://go-review.googlesource.com/c/146999

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 13, 2018

Change https://golang.org/cl/149458 mentions this issue: test: cleanup empty ASM file on builddir, buildrundir directives

@odeke-em odeke-em self-assigned this Nov 13, 2018
@gopherbot gopherbot closed this in 6d620fc Nov 14, 2018
@golang golang locked and limited conversation to collaborators Nov 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants
You can’t perform that action at this time.