diff --git a/tests/integration/userns.bats b/tests/integration/userns.bats index 78583ba4d45..4cbefbd38a2 100644 --- a/tests/integration/userns.bats +++ b/tests/integration/userns.bats @@ -36,6 +36,26 @@ function teardown() { fi } +@test "runc check stdio in userns [terminal=false]" { + update_config ' (.. | select(.terminal? != null)) .terminal |= false + | (.. | select(.[]? == "sh")) += ["-c", "touch /dev/stderr"]' + + touch log + __runc create test_busybox >log 2>&1 + + runc start test_busybox + [ "$status" -eq 0 ] + + out=$(cat log) + # We should let stdio could be accessed in user ns container. + # Please see https://github.com/opencontainers/runc/issues/4475 + # We should not get error: touch: /dev/stderr: Permission denied. + [[ "$out" = "" ]] + + runc kill test_busybox + runc delete test_busybox +} + @test "userns with simple mount" { update_config ' .process.args += ["-c", "stat /tmp/mount-1/foo.txt"] | .mounts += [{"source": "source-accessible/dir", "destination": "/tmp/mount-1", "options": ["bind"]}] '