Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions tests/test-hup-parser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ end=$((SECONDS + 2))
case "$mode" in
plain) while (( SECONDS < end )); do :; done ;;
command) while (( SECONDS < end )); do value=$(printf x); [[ $value == x ]]; done ;;
pipeline)
while (( SECONDS < end )); do
probe_status=0
jobs -pr | grep -Fx -- 1 > /dev/null || probe_status=$?
# No fixture job has PID 1: only grep no-match is expected.
[[ $probe_status == 1 ]] || exit 93
done
;;
snapshot) while (( SECONDS < end )); do active_jobs=$(jobs -pr); while IFS= read -r value; do :; done <<< "$active_jobs"; done ;;
process) while (( SECONDS < end )); do while IFS= read -r value; do :; done < <(jobs -pr); done ;;
*) exit 90 ;;
Expand Down Expand Up @@ -49,10 +57,11 @@ printf "DIAG: mode=%s round=%s delay=%s exit=%s\n" "$mode" "$round" "$delay" "$s
CONTROL
# 3 modes x 6 cases, at most 5 seconds per case (including forced teardown).
# Do not retry failures. Delay varies delivery, not a claim of exact parser timing.
# Legacy process mode already reproduced EOF in run 34226553908.
# Process mode failed in 34226553908; snapshot failed in 34245125939.
# Keep both failed implementations as explicit diagnostic controls.
# Keep it available explicitly; the default gate validates the replacement.
modes="plain command snapshot"
if [[ ${HUP_PARSER_INCLUDE_LEGACY:-false} == true ]]; then modes="$modes process"; fi
modes="plain command pipeline"
if [[ ${HUP_PARSER_INCLUDE_LEGACY:-false} == true ]]; then modes="$modes process snapshot"; fi
for mode in $modes; do
round=0
for delay in 0 0.001 0.005 0.01 0.02 0.05; do
Expand Down
13 changes: 5 additions & 8 deletions tools/push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -941,14 +941,11 @@ process_identity_matches() {
}

job_is_active() {
local expected="$1" pid active_jobs
# Bash 5.2 can report a trap parser EOF when HUP interrupts process substitution.
# Snapshot the inherited job table without process substitution or word splitting.
active_jobs=$(jobs -pr) || return 1
while IFS= read -r pid; do
[[ "$pid" == "$expected" ]] && return 0
done <<< "$active_jobs"
return 1
local expected="$1"
[[ "$expected" =~ ^[1-9][0-9]*$ ]] || return 1
# Both process and command substitution reproduced HUP parser EOF on Bash 5.2.
# Drain the entire jobs stream: grep -q could close early and cause SIGPIPE.
jobs -pr | grep -Fx -- "$expected" > /dev/null
}

worker_registration_begin_critical() {
Expand Down