Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
What version of Go are you using (go version)?
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
What did you do?
Run go test on a system with /tmp mounted as noexec.
What did you expect to see?
Tests run, or some helpful suggestion on how to fix the problem.
What did you see instead?
fork/exec /tmp/go-build/...: .permission denied
In #8451 the new GOTMPDIR was added, allowing a user to configure their system to fix this situation. Unfortunately the Go command does not provide that context or recommendation to me as a user if it runs into this situation.
On systems using systemd a reasonable choice could be to instead default to XDG_RUNTIME_DIR (with fallbacks to (GO)TMPDIR), which has the added benefit of being tied to the user session (instead of being a system-wide thing) and getting cleaned up somewhat regularly. Checking if that environment variable is defined ought to be enough, as it's set by pam-systemd (or was explicitly set by the user).
Regardless of potential changes to the default behaviour, I think it would be helpful to users if the go command could output the suggestion to configure GOTPMDIR in case it hits the permission denied case when launching the test binary.