diff --git a/run.go b/run.go index 6c85d735bec..51dd5107c13 100644 --- a/run.go +++ b/run.go @@ -705,7 +705,7 @@ func setupNamespaces(g *generate.Generator, namespaceOptions NamespaceOptions, i // Run runs the specified command in the container's root filesystem. func (b *Builder) Run(command []string, options RunOptions) error { var user specs.User - p, err := ioutil.TempDir(os.TempDir(), Package) + p, err := ioutil.TempDir("", Package) if err != nil { return err } diff --git a/tests/run.bats b/tests/run.bats index b9f4a1f6aa6..ecdcfa79f84 100644 --- a/tests/run.bats +++ b/tests/run.bats @@ -335,3 +335,17 @@ load helpers echo "$output" [ "$status" -ne 0 ] } + +@test "run symlinks" { + if ! which runc ; then + skip + fi + runc --version + cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json alpine) + mkdir -p ${TESTDIR}/tmp + ln -s tmp ${TESTDIR}/tmp2 + export TMPDIR=${TESTDIR}/tmp2 + run buildah --debug=false run $cid id + echo "$output" + [ "$status" -eq 0 ] +}