From fbce7584d786ed99354a4b33a9c127abd673c3bb Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 5 Oct 2021 11:13:49 +0200 Subject: 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 --- test/system/030-run.bats | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 4080f08b4..44c2ee509 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -725,4 +725,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 -- cgit v1.2.3-54-g00ecf