something filters out TMPDIR, even for classic snaps
Bug #1682308 reported by
Michael Hudson-Doyle
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
snapd |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
After snap install --classic go:
$ cat tmpdir.go
package main
import (
"fmt"
"os"
)
func main() {
fmt.Printf("%q\n", os.Getenv(
}
$ TMPDIR=/tmp go run tmpdir.go
"/tmp"
$ TMPDIR=/tmp /snap/bin/go run tmpdir.go
""
This is surprising.
Changed in snapd: | |
status: | New → Fix Committed |
Changed in snapd: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
This turns out to be the program loader, it removes certain environment variables when AT_SECURE is set (in this case because snap-confine is setuid). The list of variables is in https:/ /sourceware. org/git/ ?p=glibc. git;a=blob_ plain;f= sysdeps/ generic/ unsecvars. h;hb=HEAD, maybe snap run could shuffle TMPDIR (or HOSTALIASES) into SNAP_TMDIR (or SNAP_HOSTALIASES) and snap-exec could shuffle them back again.