Skip to content

cmd/go: Don't put executables in TMPDIR #8451

@gopherbot

Description

@gopherbot

by merlin:

By default go will compile things in /tmp and try to run them from there.
This will get denied and fail on a properly configured system where /tmp does not allow
execution.

I can get 
go run ./environ1/environ1.go
fork/exec /tmp/go-build163060459/command-line-arguments/_obj/exe/environ1: permission
denied

/tmp on any securely setup system does not allow execution, hence the
error above.

I found that go support TMPDIR, but I'd rather not set TMPDIR to
~/go/src/tmp and have all temp files go there.
Would it be possible for go to also support GOTEMP to allow setting its
tmpdir and not everything else to something that allows execution?

(I modified my binary to do so for now, but this would be good to
support for all)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeSuggestedIssues that may be good for new contributors looking for work to do.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions