@@ -44,18 +44,22 @@ jobs:
4444 # -short skips 3 known-slow stress tests in pkg/daemon and
4545 # pkg/daemon/udpio; everything else runs.
4646 #
47- # macOS runners hand out a $RUNNER_TEMP (/Users/runner/work/_temp)
48- # whose ACLs make t.TempDir() fail with "mkdir ...: permission
49- # denied" (a recurring GitHub macos-runner issue, seen on #304/
50- # #306/#308) — and a writable subdir under it inherits the same
51- # restriction, so pointing TMPDIR there is not enough. Use a fresh
52- # mktemp dir under /tmp instead, which is writable by the test
53- # process. Ubuntu keeps the default $RUNNER_TEMP behaviour.
47+ # Both hosted runners have started handing out a $RUNNER_TEMP
48+ # (/Users/runner/work/_temp on macOS, /home/runner/work/_temp on
49+ # ubuntu) whose ACLs make t.TempDir() fail with "mkdir ...:
50+ # permission denied" — a recurring GitHub-runner issue (seen on
51+ # #304/#306/#308 for macOS and now hitting ubuntu too). A writable
52+ # subdir under it inherits the same restriction, so redirecting
53+ # TMPDIR *into* $RUNNER_TEMP is not enough; it must point at a
54+ # freshly-created dir outside that tree. Create one under /tmp
55+ # (writable by the test process on both Linux and macOS), chmod it
56+ # so t.TempDir()'s sub-dirs are creatable, and point $TMPDIR there
57+ # for THIS run block so go test's os.TempDir() -> t.TempDir()
58+ # lands somewhere writable. No job/step-level `env: TMPDIR:` is set
59+ # anywhere in this workflow, so nothing overrides this export.
5460 run : |
55- if [ "${RUNNER_OS}" = "macOS" ]; then
56- TMPDIR="$(mktemp -d /tmp/gotmp.XXXXXX)"
57- export TMPDIR
58- else
59- export TMPDIR="${RUNNER_TEMP}"
60- fi
61+ TMPDIR="$(mktemp -d /tmp/gotmpXXXXXX 2>/dev/null || mktemp -d "${RUNNER_TEMP:-.}/gotmpXXXXXX")"
62+ chmod 777 "$TMPDIR"
63+ export TMPDIR
64+ echo "using TMPDIR=$TMPDIR"
6165 go test -short -count=1 -timeout 600s ./pkg/... ./cmd/... ./internal/...
0 commit comments