something filters out TMPDIR, even for classic snaps

Bug #1682308 reported by Michael Hudson-Doyle
10
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"))
}
$ TMPDIR=/tmp go run tmpdir.go
"/tmp"
$ TMPDIR=/tmp /snap/bin/go run tmpdir.go
""

This is surprising.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

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.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :
Changed in snapd:
status: New → Fix Committed
Michael Vogt (mvo)
Changed in snapd:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.