Coming here from https://go-review.googlesource.com/c/go/+/229357/3#message-c7922ea647b703faa8e858428f47221a6d921275 and https://storage.googleapis.com/go-build-log/b49db1e9/linux-amd64_454ff41f.log in which we have an odd test failure
# go run run.go -- fixedbugs/issue36437.go
incorrect output
Expected a non-nil error, but got:
""
want
"open /workdir/tmp/33921360662258/main.go: permission denied\n"
FAIL fixedbugs/issue36437.go 0.291s
2020/04/22 23:32:59 Failed: exit status 1
go tool dist: FAILED
in which the relevant test is
package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
)
func main() {
tmpDir, err := ioutil.TempDir("", "issue36437")
if err != nil {
panic(err)
}
defer os.RemoveAll(tmpDir)
msgOrErr := func(bmsg []byte, err error) string {
msg := string(bmsg)
if msg == "" && err != nil {
msg = err.Error()
}
return msg
}
// 2. Invoke the compiler with a file that we don't have read permissions to.
path := filepath.Join(tmpDir, "main.go")
if err := ioutil.WriteFile(path, []byte("package p"), 0222); err != nil {
panic(err)
}
output, err = exec.Command("go", "tool", "compile", path).CombinedOutput()
want := fmt.Sprintf("open %s: permission denied\n", path)
if g, w := msgOrErr(output, err), want; g != w {
panic(fmt.Sprintf("Expected a non-nil error, but got:\n\t%q\nwant\n\t%q", g, w))
}
}
Is this perhaps just a problem with the builder? I'd expect that 0222 would make a file writable but would error on reading; other GOOS-GOARCH combinations work properly but not this one.
Coming here from https://go-review.googlesource.com/c/go/+/229357/3#message-c7922ea647b703faa8e858428f47221a6d921275 and https://storage.googleapis.com/go-build-log/b49db1e9/linux-amd64_454ff41f.log in which we have an odd test failure
in which the relevant test is
Is this perhaps just a problem with the builder? I'd expect that 0222 would make a file writable but would error on reading; other GOOS-GOARCH combinations work properly but not this one.