Skip to content

Commit 58a599d

Browse files
committed
merge #4593 into opencontainers/runc:main
Kir Kolyshkin (1): tests/int: add hooks argv[0] test LGTMs: rata cyphar
2 parents ef9830a + c283ed1 commit 58a599d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/integration/hooks.bats

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,20 @@ function teardown() {
6363
runc run ct1
6464
[ "$status" -eq 0 ]
6565
}
66+
67+
# https://github.com/opencontainers/runc/issues/1663
68+
@test "runc run [hook's argv is preserved]" {
69+
# Check that argv[0] and argv[1] passed to the hook's binary
70+
# exactly as set in config.json.
71+
update_config '.hooks |= {"startContainer": [{"path": "/bin/busybox", "args": ["cat", "/nosuchfile"]}]}'
72+
runc run ct1
73+
[ "$status" -ne 0 ]
74+
[[ "$output" == *"cat: can't open"*"/nosuchfile"* ]]
75+
76+
# Busybox also accepts commands where argv[0] is "busybox",
77+
# and argv[1] is applet name. Test this as well.
78+
update_config '.hooks |= {"startContainer": [{"path": "/bin/busybox", "args": ["busybox", "cat", "/nosuchfile"]}]}'
79+
runc run ct1
80+
[ "$status" -ne 0 ]
81+
[[ "$output" == *"cat: can't open"*"/nosuchfile"* ]]
82+
}

0 commit comments

Comments
 (0)