Skip to content

Commit

Permalink
run.bats: check that we can run with symlinks in the bundle path
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nalind authored and rh-atomic-bot committed Jun 2, 2018
1 parent 03686e5 commit 70641ee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
14 changes: 14 additions & 0 deletions tests/run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
}

0 comments on commit 70641ee

Please sign in to comment.