Skip to content

Commit 70641ee

Browse files
nalindrh-atomic-bot
authored andcommitted
run.bats: check that we can run with symlinks in the bundle path
Make sure that we don't trigger error messages in runc when $TMPDIR, which affects os.TempDir(), is itself a symbolic link. Signed-off-by: Nalin Dahyabhai <[email protected]> Closes: #746 Approved by: rhatdan
1 parent 03686e5 commit 70641ee

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ func setupNamespaces(g *generate.Generator, namespaceOptions NamespaceOptions, i
705705
// Run runs the specified command in the container's root filesystem.
706706
func (b *Builder) Run(command []string, options RunOptions) error {
707707
var user specs.User
708-
p, err := ioutil.TempDir(os.TempDir(), Package)
708+
p, err := ioutil.TempDir("", Package)
709709
if err != nil {
710710
return err
711711
}

tests/run.bats

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,3 +335,17 @@ load helpers
335335
echo "$output"
336336
[ "$status" -ne 0 ]
337337
}
338+
339+
@test "run symlinks" {
340+
if ! which runc ; then
341+
skip
342+
fi
343+
runc --version
344+
cid=$(buildah from --pull --signature-policy ${TESTSDIR}/policy.json alpine)
345+
mkdir -p ${TESTDIR}/tmp
346+
ln -s tmp ${TESTDIR}/tmp2
347+
export TMPDIR=${TESTDIR}/tmp2
348+
run buildah --debug=false run $cid id
349+
echo "$output"
350+
[ "$status" -eq 0 ]
351+
}

0 commit comments

Comments
 (0)