diff options
author | Paul Holzinger <pholzing@redhat.com> | 2021-10-05 11:13:49 +0200 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2021-10-19 14:08:58 -0400 |
commit | 2cd206d0fce477d123ab8b7acf19fdf34ca0a7aa (patch) | |
tree | c4e853dafd956eb34c0264fa7de4d097cc2528bb /test/system | |
parent | 37347c3216a1e613f470fbd933a4257f472b3d2f (diff) | |
download | podman-2cd206d0fce477d123ab8b7acf19fdf34ca0a7aa.tar.gz podman-2cd206d0fce477d123ab8b7acf19fdf34ca0a7aa.tar.bz2 podman-2cd206d0fce477d123ab8b7acf19fdf34ca0a7aa.zip |
libpod: fix race when closing STDIN
There is a race where `conn.Close()` was called before `conn.CloseWrite()`.
In this case `CloseWrite` will fail and an useless error is printed. To
fix this we move the the `CloseWrite()` call to the same goroutine to
remove the race. This ensures that `CloseWrite()` is called before
`Close()` and never afterwards.
Also fixed podman-remote run where the STDIN was never was closed.
This is causing flakes in CI testing.
[NO TESTS NEEDED]
Fixes #11856
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
<MH: Fixed cherry-pick conflicts>
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'test/system')
-rw-r--r-- | test/system/030-run.bats | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 3d9d834b3..8640d427a 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -723,4 +723,10 @@ EOF is "$output" "Error: strconv.ParseInt: parsing \"a\": invalid syntax" } +@test "podman run closes stdin" { + random_1=$(random_string 25) + run_podman run -i --rm $IMAGE cat <<<"$random_1" + is "$output" "$random_1" "output matches STDIN" +} + # vim: filetype=sh |