Skip to content

Commit b55167e

Browse files
committed
tests/int/exec --user: check default HOME
Historically, when HOME is not explicitly set in process.Env, and UID to run as doesn't have a corresponding entry in container's /etc/passwd, runc sets HOME=/ as a fallback. Add the corresponding check, for the sake of backward compatibility preservation. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent a5bfdc9 commit b55167e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/integration/exec.bats

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ function teardown() {
126126
runc exec --user 1000:1000 test_busybox id
127127
[ "$status" -eq 0 ]
128128
[[ "${output}" == "uid=1000 gid=1000"* ]]
129+
130+
# Check the default value of HOME ("/") is set even in case when
131+
# - HOME is not set in process.Env, and
132+
# - there is no entry in container's /etc/passwd for a given UID.
133+
#
134+
# NOTE this is not a standard runtime feature, but rather
135+
# a historical de facto behavior we're afraid to change.
136+
137+
# shellcheck disable=SC2016
138+
runc exec --user 1000 test_busybox sh -u -c 'echo $HOME'
139+
[ "$status" -eq 0 ]
140+
[[ "$output" = "/" ]]
129141
}
130142

131143
# https://github.com/opencontainers/runc/issues/3674.

0 commit comments

Comments
 (0)