aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-08-05 13:48:01 -0400
committerValentin Rothberg <rothberg@redhat.com>2020-08-11 11:15:38 +0200
commit729e0aa0d1fa00dc6452897dc57ccccaf04fc20c (patch)
treeb71053977d0a0a712a7b4a17faa6ba4d28ebad72 /test
parentd9c86fd0f2ea2d2587d470327192bd3d33875b2d (diff)
downloadpodman-729e0aa0d1fa00dc6452897dc57ccccaf04fc20c.tar.gz
podman-729e0aa0d1fa00dc6452897dc57ccccaf04fc20c.tar.bz2
podman-729e0aa0d1fa00dc6452897dc57ccccaf04fc20c.zip
Ensure that exec errors write exit codes to the DB
In local Podman, the frontend interprets the error and exit code given by the Exec API to determine the appropriate exit code to set for Podman itself; special cases like a missing executable receive special exit codes. Exec for the remote API, however, has to do this inside Libpod itself, as Libpod will be directly queried (via the Inspect API for exec sessions) to get the exit code. This was done correctly when the exec session started properly, but we did not properly handle cases where the OCI runtime fails before the exec session can properly start. Making two error returns that would otherwise not set exit code actually do so should resolve the issue. Fixes #6893 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'test')
-rw-r--r--test/system/075-exec.bats9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/system/075-exec.bats b/test/system/075-exec.bats
index f8c7f2766..019217d8f 100644
--- a/test/system/075-exec.bats
+++ b/test/system/075-exec.bats
@@ -21,6 +21,15 @@ load helpers
run_podman exec $cid sh -c "cat /$rand_filename"
is "$output" "$rand_content" "Can exec and see file in running container"
+
+ # Specially defined situations: exec a dir, or no such command.
+ # We don't check the full error message because runc & crun differ.
+ run_podman 126 exec $cid /etc
+ is "$output" ".*permission denied" "podman exec /etc"
+ run_podman 127 exec $cid /no/such/command
+ is "$output" ".*such file or dir" "podman exec /no/such/command"
+
+ # Done
run_podman exec $cid rm -f /$rand_filename
run_podman wait $cid