Skip to content

Commit 452d4e3

Browse files
committed
github: properly fix broken pipe error in blktests result collection
The previous commit f66bc7e attempted to fix the broken pipe error by removing an intermediate variable and piping find directly to head -1. However, this didn't actually solve the problem. With pipefail enabled, when find outputs many files to the pipe and head -1 closes the pipe after reading the first line, find still receives SIGPIPE and exits with an error, causing the entire script to fail. The proper solution is to use find's -print -quit option, which makes find exit immediately after finding the first match. This eliminates the pipe entirely and avoids SIGPIPE. Applied this fix to both the sample file collection and the failure detection logic. Generated-by: Claude AI Fixes: f66bc7e ("github: fix broken pipe error in blktests result collection") Signed-off-by: Daniel Gomez <[email protected]>
1 parent e93004f commit 452d4e3

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

.github/actions/test/action.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ runs:
146146
# Show sample test status files for passed tests
147147
if [ $passed_tests -gt 0 ]; then
148148
echo -e "\nSample passed test:" >> ci.commit_extra
149-
# Get first sample file directly without echo pipe to avoid SIGPIPE with set -o pipefail
150-
sample_file=$(find "$wpath/results/last-run" -type f -name "*" ! -name "*.out.bad" ! -name "*.dmesg" | head -1)
149+
sample_file=$(find "$wpath/results/last-run" -type f -name "*" ! -name "*.out.bad" ! -name "*.dmesg" -print -quit)
151150
if [ -n "$sample_file" ] && [ -f "$sample_file" ]; then
152151
cat "$sample_file" >> ci.commit_extra || echo "Failed to read sample file" >> ci.commit_extra
153152
else
@@ -160,7 +159,7 @@ runs:
160159
161160
# blktests success detection - look for .out.bad files (failures)
162161
if [ -d "$wpath/results/last-run" ]; then
163-
bad_check=$(find "$wpath/results/last-run" -name "*.out.bad" -type f | head -1)
162+
bad_check=$(find "$wpath/results/last-run" -name "*.out.bad" -type f -print -quit)
164163
if [ -n "$bad_check" ]; then
165164
echo "not ok" > ci.result
166165
else

0 commit comments

Comments
 (0)