From 7079c9bf6265dffd42ce6a17c0acd398f647db7d Mon Sep 17 00:00:00 2001 From: Joshua Hoblitt Date: Wed, 1 Jul 2026 09:17:20 -0700 Subject: [PATCH] ci: fix broken-pipe race in find_extra_block_dev find_extra_block_dev piped find_extra_block_devs into head -1. Since find_extra_block_devs prints every eligible disk and ends with echo "$devs", head closes the pipe after the first line and the producer's echo races into SIGPIPE (echo: write error: Broken pipe), failing the command substitution under pipefail/errexit. The race only fires reliably now that the runners present two data disks (sdb and sdc), so find_extra_block_devs emits multiple lines; with a single disk the one-line output almost never triggered it. Read the producer to completion with mapfile via process substitution and return the first element, mirroring find_second_block_dev, so there is no downstream head to close the pipe early. Signed-off-by: Joshua Hoblitt --- tests/scripts/github-action-helper.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/scripts/github-action-helper.sh b/tests/scripts/github-action-helper.sh index 80cd2aa29..d15d8a7d2 100755 --- a/tests/scripts/github-action-helper.sh +++ b/tests/scripts/github-action-helper.sh @@ -83,7 +83,9 @@ function create_extra_disk() { # iSCSI disk if none exist. Thin wrapper over find_extra_block_devs(); kept as a # convenience for its many callers that expect a single basename. function find_extra_block_dev() { - find_extra_block_devs 1 | head -1 + local devs + mapfile -t devs < <(find_extra_block_devs 1) + echo "${devs[0]}" # the first disk } # find_extra_block_devs [min_count]