Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: stop a hung system node or npm from stalling setup (#12165)
oobaboogac176530f3ed3
diff --git a/studio/setup.sh b/studio/setup.shindex da9b4268606..7b75b116a30 100755--- a/studio/setup.sh+++ b/studio/setup.sh@@ -113,6 +113,115 @@ _remove_agent_instruction_files() {done}+# ── Bounded `--version` probe for binaries setup does not own (uv candidates, the system Node) ──+_SETUP_PROBE_TARGET=""+_SETUP_PROBE_PID=""+_SETUP_PROBE_PREV_TRAP=""++# Bash needs `--` before a negative process-group ID.+# Omit it for positive PIDs to support dash, which rejects `--`.+_setup_probe_signal_target() {+ case "$2" in+ -*) kill "-$1" -- "$2" 2>/dev/null || : ;;+ *) kill "-$1" "$2" 2>/dev/null || : ;;+ esac+}++# Send TERM, then KILL after $3 seconds. $1 is the target PID/group; $2 is the PID to watch.+_setup_probe_terminate() {+ _supt_grace=0+ _setup_probe_signal_target TERM "$1"+ while [ "$_supt_grace" -lt "$3" ] && kill -0 "$2" 2>/dev/null; do+ sleep 1+ _supt_grace=$((_supt_grace + 1))+ done+ # Recheck before KILL to reduce the risk of signalling a reused PID.+ if kill -0 "$2" 2>/dev/null; then _setup_probe_signal_target KILL "$1"; fi+ unset _supt_grace+}++# Preserve the caller's signal handlers while the watchdog owns probe cleanup.+_setup_probe_restore_trap() {+ _SETUP_PROBE_TARGET=""+ _SETUP_PROBE_PID=""+ if [ -n "${_SETUP_PROBE_PREV_TRAP:-}" ]; then+ eval "$_SETUP_PROBE_PREV_TRAP"+ else+ trap - HUP INT TERM+ fi+ _SETUP_PROBE_PREV_TRAP=""+}++_setup_probe_on_signal() {+ # Stop the probe on cancellation, with a shorter grace period.+ if [ -n "${_SETUP_PROBE_TARGET:-}" ] && [ -n "${_SETUP_PROBE_PID:-}" ]; then+ _setup_probe_terminate "$_SETUP_PROBE_TARGET" "$_SETUP_PROBE_PID" 2+ wait "$_SETUP_PROBE_PID" 2>/dev/null || :+ fi+ _setup_probe_restore_trap+ # Re-deliver the signal to the restored handler or default action.+ kill -s "$1" "$$" 2>/dev/null || :+}++# Probe $1 with stdin closed and a 20 s timeout, plus 5 s to terminate.+# Save stdout to $2 (default /dev/null) to avoid re-probing for the version.+# Use a file so lingering children cannot hold an output pipe open.+_setup_probe_version() {+ _supe_secs="${_SETUP_PROBE_SECONDS:-20}"+ _supe_out="${2:-/dev/null}"+ # Use GNU timeout when available, otherwise the watchdog below.+ if command -v timeout >/dev/null 2>&1 && timeout -k 1 5 true >/dev/null 2>&1; then+ timeout -k 5 "$_supe_secs" "$1" --version >"$_supe_out" 2>/dev/null </dev/null+ _supe_rc=$?+ # Normalize SIGKILL after the grace period to the watchdog's timeout status.+ if [ "$_supe_rc" -eq 137 ]; then _supe_rc=124; fi+ return $_supe_rc+ fi+ # Temporarily enable monitor mode to signal the probe and its children as a group.+ _supe_monitor=off+ case "$-" in *m*) _supe_monitor=on ;; esac+ [ "$_supe_monitor" = on ] || set -m 2>/dev/null || :+ "$1" --version >"$_supe_out" 2>/dev/null </dev/null &+ _supe_pid=$!+ [ "$_supe_monitor" = on ] || set +m 2>/dev/null || :+ # Signal a group only if it differs from setup's own group; otherwise use the PID.+ # Strip spaces without external tools so this works on a minimal PATH.+ _supe_target="$_supe_pid"+ if command -v ps >/dev/null 2>&1; then+ _supe_pgid=$(ps -o pgid= -p "$_supe_pid" 2>/dev/null)+ _supe_self=$(ps -o pgid= -p $$ 2>/dev/null)+ _supe_pgid=${_supe_pgid##* }+ _supe_self=${_supe_self##* }+ case "$_supe_pgid$_supe_self" in+ ''|*[!0-9]*) : ;;+ *) [ "$_supe_pgid" = "$_supe_self" ] || _supe_target="-$_supe_pgid" ;;+ esac+ fi+ _SETUP_PROBE_TARGET="$_supe_target"+ _SETUP_PROBE_PID="$_supe_pid"+ _SETUP_PROBE_PREV_TRAP=$(trap -p HUP INT TERM 2>/dev/null) || _SETUP_PROBE_PREV_TRAP=""+ trap '_setup_probe_on_signal HUP' HUP+ trap '_setup_probe_on_signal INT' INT+ trap '_setup_probe_on_signal TERM' TERM+ _supe_waited=0+ while kill -0 "$_supe_pid" 2>/dev/null; do+ if [ "$_supe_waited" -ge "$_supe_secs" ]; then+ _setup_probe_terminate "$_supe_target" "$_supe_pid" 5+ wait "$_supe_pid" 2>/dev/null+ _setup_probe_restore_trap+ unset _supe_pid _supe_waited _supe_target _supe_pgid _supe_self+ return 124+ fi+ sleep 1+ _supe_waited=$((_supe_waited + 1))+ done+ wait "$_supe_pid"+ _supe_rc=$?+ _setup_probe_restore_trap+ unset _supe_pid _supe_waited _supe_target _supe_pgid _supe_self+ return $_supe_rc+}+# ── BEGIN mirror fallback (kept identical in install.sh and studio/setup.sh) ──# Only in mainland China (or UNSLOTH_MIRROR_FALLBACK=1): swaps a default host below 1 MiB/s or unreachable for its mirror when faster; user-set sources untouched; UNSLOTH_MIRROR_FALLBACK=0 disables._MIRROR_CERNET="https://tuna.mirrors.cernet.edu.cn"@@ -2059,13 +2168,34 @@ elsefiNODE_DIR="$_NODE_PARENT/node"-_SYS_NODE_VER="$(node -v 2>/dev/null || true)"-_SYS_NPM_VER="$(npm -v 2>/dev/null || true)"+# Bound system node/npm probes so a broken binary on PATH cannot stall setup (#11709).+# Sets _PROBED_VER, or leaves it empty if the tool is missing, fails or times out.+_probe_system_node_tool() {+ _PROBED_VER=""+ command -v "$1" >/dev/null 2>&1 || return 0+ _pnt_out="$(mktemp)"+ _pnt_rc=0+ _setup_probe_version "$1" "$_pnt_out" || _pnt_rc=$?+ if [ "$_pnt_rc" -eq 0 ]; then+ _PROBED_VER="$(head -n 1 "$_pnt_out")"+ elif [ "$_pnt_rc" -eq 124 ]; then+ substep "system $1 ($(command -v "$1")) did not answer --version within ${_SETUP_PROBE_SECONDS:-20}s; not using it" "$C_WARN"+ fi+ rm -f "$_pnt_out"+}+_probe_system_node_tool node+_SYS_NODE_VER="$_PROBED_VER"+_SYS_NPM_VER=""+# npm requires Node, so skip its probe if Node failed.+if [ -n "$_SYS_NODE_VER" ]; then+ _probe_system_node_tool npm+ _SYS_NPM_VER="$_PROBED_VER"+fiNODE_SOURCE="$(decide_node_source "$_SYS_NODE_VER" "$_SYS_NPM_VER" "${UNSLOTH_SKIP_NODE_INSTALL:-0}")"_FRONTEND_SKIP=falseif [ "$NODE_SOURCE" = system ]; then- step "node" "$(node -v) | npm $(npm -v) (system)"+ step "node" "$_SYS_NODE_VER | npm $_SYS_NPM_VER (system)"elif [ "$NODE_SOURCE" = bundled ]; thenmkdir -p "$_NODE_PARENT"# install_node_prebuilt.py uses os.replace(); guard a custom-home dir so we@@ -2482,123 +2612,6 @@ _setup_uv_sha256() {fi}-_SETUP_UV_PROBE_TARGET=""-_SETUP_UV_PROBE_PID=""-_SETUP_UV_PROBE_PREV_TRAP=""--# A process group is signalled as a negative pid, and the two shells that get here disagree about-# how to write one: bash reads a bare `-123` as a signal spec and refuses it, dash refuses the-# `--` that fixes bash. Only a shell that made a group can produce a negative target, so the sign-# picks the spelling. Measured both ways: the wrong one fails silently under 2>/dev/null and the-# group survives the ceiling.-_setup_uv_signal_target() {- case "$2" in- -*) kill "-$1" -- "$2" 2>/dev/null || : ;;- *) kill "-$1" "$2" 2>/dev/null || : ;;- esac-}--# TERM, then KILL what ignored it, exactly as `timeout -k` does on the hosts that have it.-# $1 target (a group when one was made, else the pid), $2 pid to watch, $3 seconds of grace.-_setup_uv_probe_terminate() {- _supt_grace=0- _setup_uv_signal_target TERM "$1"- while [ "$_supt_grace" -lt "$3" ] && kill -0 "$2" 2>/dev/null; do- sleep 1- _supt_grace=$((_supt_grace + 1))- done- # Only if it is still there: the loop also ends when TERM worked, and an unconditional KILL- # then goes to a number this shell no longer owns. Narrows the window, not closes it.- if kill -0 "$2" 2>/dev/null; then _setup_uv_signal_target KILL "$1"; fi- unset _supt_grace-}--# The watchdog's ceiling lives in the calling shell, so a cancel during the wait would leave the-# candidate, and under monitor mode its whole group, running with nobody left to stop it. These-# two chain rather than replace: the pinned installer's own handlers still have to run.-_setup_uv_probe_restore_trap() {- _SETUP_UV_PROBE_TARGET=""- _SETUP_UV_PROBE_PID=""- if [ -n "${_SETUP_UV_PROBE_PREV_TRAP:-}" ]; then- eval "$_SETUP_UV_PROBE_PREV_TRAP"- else- trap - HUP INT TERM- fi- _SETUP_UV_PROBE_PREV_TRAP=""-}--_setup_uv_probe_on_signal() {- # The same TERM/KILL the ceiling uses, on a shorter leash: a cancel that waited the full five- # seconds for a binary ignoring TERM would read as a setup that ignored the cancel.- if [ -n "${_SETUP_UV_PROBE_TARGET:-}" ] && [ -n "${_SETUP_UV_PROBE_PID:-}" ]; then- _setup_uv_probe_terminate "$_SETUP_UV_PROBE_TARGET" "$_SETUP_UV_PROBE_PID" 2- wait "$_SETUP_UV_PROBE_PID" 2>/dev/null || :- fi- _setup_uv_probe_restore_trap- # Hand the signal back to whoever had it: the installer's handler, or the default action.- kill -s "$1" "$$" 2>/dev/null || :-}--# Bounded liveness probe: no stdin (a prompting build reads EOF), 20 s ceiling held by GNU-# timeout or, without it (stock macOS), a background job killed when the ceiling passes.-# $2 takes the binary's stdout, /dev/null by default: reuse needs the version line, and running-# the binary again to read it would be a second chance to hang.-_setup_uv_probe_exec() {- _supe_secs="${_SETUP_UV_PROBE_SECONDS:-20}"- _supe_out="${2:-/dev/null}"- # KILL after TERM (TERM can be ignored): `timeout -k` where supported, else the watchdog below.- if command -v timeout >/dev/null 2>&1 && timeout -k 1 5 true >/dev/null 2>&1; then- timeout -k 5 "$_supe_secs" "$1" --version >"$_supe_out" 2>/dev/null </dev/null- return $?- fi- # Monitor mode gives the probe a process group of its own, so the signals below reach what IT- # started, as `timeout`'s setpgid does. Off again at once: it changes how later jobs report.- _supe_monitor=off- case "$-" in *m*) _supe_monitor=on ;; esac- [ "$_supe_monitor" = on ] || set -m 2>/dev/null || :- "$1" --version >"$_supe_out" 2>/dev/null </dev/null &- _supe_pid=$!- [ "$_supe_monitor" = on ] || set +m 2>/dev/null || :- # The group only where it is provably not this shell's own (zsh shares them, and a group TERM- # there kills setup); otherwise the single pid, as before. Parameter expansion, not `tr`: this- # branch has to hold on a PATH as bare as the shell and sleep.- _supe_target="$_supe_pid"- if command -v ps >/dev/null 2>&1; then- _supe_pgid=$(ps -o pgid= -p "$_supe_pid" 2>/dev/null)- _supe_self=$(ps -o pgid= -p $$ 2>/dev/null)- _supe_pgid=${_supe_pgid##* }- _supe_self=${_supe_self##* }- case "$_supe_pgid$_supe_self" in- ''|*[!0-9]*) : ;;- *) [ "$_supe_pgid" = "$_supe_self" ] || _supe_target="-$_supe_pgid" ;;- esac- fi- _SETUP_UV_PROBE_TARGET="$_supe_target"- _SETUP_UV_PROBE_PID="$_supe_pid"- _SETUP_UV_PROBE_PREV_TRAP=$(trap -p HUP INT TERM 2>/dev/null) || _SETUP_UV_PROBE_PREV_TRAP=""- trap '_setup_uv_probe_on_signal HUP' HUP- trap '_setup_uv_probe_on_signal INT' INT- trap '_setup_uv_probe_on_signal TERM' TERM- _supe_waited=0- while kill -0 "$_supe_pid" 2>/dev/null; do- if [ "$_supe_waited" -ge "$_supe_secs" ]; then- # Escalate as timeout -k does: a binary ignoring TERM would hold the wait.- _setup_uv_probe_terminate "$_supe_target" "$_supe_pid" 5- wait "$_supe_pid" 2>/dev/null- _setup_uv_probe_restore_trap- unset _supe_pid _supe_waited _supe_target _supe_pgid _supe_self- return 124- fi- sleep 1- _supe_waited=$((_supe_waited + 1))- done- wait "$_supe_pid"- _supe_rc=$?- _setup_uv_probe_restore_trap- unset _supe_pid _supe_waited _supe_target _supe_pgid _supe_self- return $_supe_rc-}-# The function's own cleanup only runs when it returns, so an interrupt left the unpacked# archive behind plus a staging file inside a directory on PATH. No trap is active here (the# gitignore EXIT trap is cleared well above), so the pinned install owns these four for its@@ -2700,7 +2713,7 @@ https://github.com/astral-sh/uv/releases/download/$_SETUP_UV_PINNED_VERSION"chmod 0755 "$_siup_stage" 2>/dev/null || true# Validate before publishing: the rename destroys the incumbent, so a binary that# cannot run here must never replace one that could.- if [ "$_siup_exe" = "uv" ] && ! _setup_uv_probe_exec "$_siup_stage"; then _siup_ready=0; break; fi+ if [ "$_siup_exe" = "uv" ] && ! _setup_probe_version "$_siup_stage"; then _siup_ready=0; break; fidoneif [ "$_siup_ready" = "1" ] &&mv -f "$_SIUP_STAGE" "$_siup_dest/uv" 2>/dev/null &&@@ -3008,8 +3021,8 @@ _setup_find_installed_uv() {# Bounded, like the pinned installer's probe. Asked twice: one miss (an antivirus scan# holding a fresh binary) sent setup to the pinned download, which put an OLDER uv# over this one and moved the manifest's uv_version on the next pass.- if _setup_uv_probe_exec "$_sfu_dir/uv" "${_sfu_ver_file:-/dev/null}" ||- { sleep 2; _setup_uv_probe_exec "$_sfu_dir/uv" "${_sfu_ver_file:-/dev/null}"; }; then+ if _setup_probe_version "$_sfu_dir/uv" "${_sfu_ver_file:-/dev/null}" ||+ { sleep 2; _setup_probe_version "$_sfu_dir/uv" "${_sfu_ver_file:-/dev/null}"; }; then# `read`, not `cat`: this branch has to hold on a bare PATH, and an empty file# returning non-zero is not a reason for `set -e` to end setup._sfu_ver=""diff --git a/tests/sh/test_setup_reuse_installed_uv.sh b/tests/sh/test_setup_reuse_installed_uv.shindex f7363eef1b0..b54c833ea31 100755--- a/tests/sh/test_setup_reuse_installed_uv.sh+++ b/tests/sh/test_setup_reuse_installed_uv.sh@@ -16,11 +16,11 @@ WORK=$(mktemp -d)trap 'rm -rf "$WORK"' EXIT INT TERMHELPER=$(awk '- /^_setup_uv_signal_target\(\) \{/ { grab = 1 }- /^_setup_uv_probe_terminate\(\) \{/ { grab = 1 }- /^_setup_uv_probe_restore_trap\(\) \{/ { grab = 1 }- /^_setup_uv_probe_on_signal\(\) \{/ { grab = 1 }- /^_setup_uv_probe_exec\(\) \{/ { grab = 1 }+ /^_setup_probe_signal_target\(\) \{/ { grab = 1 }+ /^_setup_probe_terminate\(\) \{/ { grab = 1 }+ /^_setup_probe_restore_trap\(\) \{/ { grab = 1 }+ /^_setup_probe_on_signal\(\) \{/ { grab = 1 }+ /^_setup_probe_version\(\) \{/ { grab = 1 }/^_setup_uv_version_at_least\(\) \{/ { grab = 1 }/^_setup_find_installed_uv\(\) \{/ { grab = 1 }grab { print }@@ -29,7 +29,7 @@ HELPER=$(awk '# The floor the finder compares against lives beside the function, not inside it.HELPER="$(grep '^_SETUP_UV_MIN_VERSION=' "$SETUP_SH")$HELPER"-for _fn in _setup_uv_signal_target _setup_uv_probe_terminate _setup_uv_probe_restore_trap _setup_uv_probe_on_signal _setup_uv_probe_exec \+for _fn in _setup_probe_signal_target _setup_probe_terminate _setup_probe_restore_trap _setup_probe_on_signal _setup_probe_version \_setup_uv_version_at_least _setup_find_installed_uv; doprintf '%s\n' "$HELPER" | grep -q "^$_fn() {" || {echo "FATAL: could not extract $_fn from setup.sh" >&2; exit 1; }@@ -174,7 +174,7 @@ BODYchmod +x "$HANG/uv"HANG_PROBE="$WORK/$shell hang probe.sh"# The 20 s ceiling is the helper's; the test only needs it finite.- { echo '_SETUP_UV_PROBE_SECONDS=2'; cat "$PROBE"; } > "$HANG_PROBE"+ { echo '_SETUP_PROBE_SECONDS=2'; cat "$PROBE"; } > "$HANG_PROBE"_hang_started=$(date +%s)assert_eq "$shell: a uv that never answers is not reused" \"none" "$(env -i PATH="$BARE_PATH" HOME="$HOME_DIR" UV_INSTALL_DIR="$HANG" "$shell" "$HANG_PROBE")"@@ -205,9 +205,9 @@ BODYCANCEL="$WORK/$shell cancel probe.sh"{printf '%s\n' "$HELPER"- printf '_setup_uv_probe_exec "%s/uv"\n' "$HANG"+ printf '_setup_probe_version "%s/uv"\n' "$HANG"} > "$CANCEL"- env -i PATH="$NOTO" HOME="$HOME_DIR" _SETUP_UV_PROBE_SECONDS=30 \+ env -i PATH="$NOTO" HOME="$HOME_DIR" _SETUP_PROBE_SECONDS=30 \"$shell" "$CANCEL" >/dev/null 2>&1 &_cancel_sup=$!sleep 3@@ -255,7 +255,7 @@ while [ ! -f "$_t_ready" ] && [ "$_t_waited" -lt 10 ]; do_t_waited=$((_t_waited + 1))done[ -f "$_t_ready" ] || { printf 'never armed'; exit 0; }-_setup_uv_probe_terminate "$_t_pid" "$_t_pid" 1+_setup_probe_terminate "$_t_pid" "$_t_pid" 1# How it ended, not whether it is still listed: a killed child sits as a zombie until it is# waited for, and `kill -0` answers yes for one of those.wait "$_t_pid" 2>/dev/null@@ -320,7 +320,7 @@ elsefi# Only a uv that answered counts on both sides: the bounded probe here, an "ok" verdict in setup.ps1.-if printf '%s\n' "$HELPER" | grep -q '_setup_uv_probe_exec "\$_sfu_dir/uv"'; then+if printf '%s\n' "$HELPER" | grep -q '_setup_probe_version "\$_sfu_dir/uv"'; thenok "setup.sh probes the candidate through the bounded helper"elsebad "setup.sh probes the candidate through the bounded helper"diff --git a/tests/sh/test_system_node_probe_bounded.sh b/tests/sh/test_system_node_probe_bounded.shnew file mode 100644index 00000000000..e96f44e9c91--- /dev/null+++ b/tests/sh/test_system_node_probe_bounded.sh@@ -0,0 +1,96 @@+#!/bin/bash+# SPDX-License-Identifier: AGPL-3.0-only+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0+#+# Verify hung probes and lingering children cannot stall setup (#11709),+# with GNU timeout and the watchdog used on stock macOS.+set -e++SCRIPT_DIR=$(CDPATH= cd -- "$(dirname "$0")" && pwd)+. "$SCRIPT_DIR/_harness.sh"+SETUP_SH="$SCRIPT_DIR/../../studio/setup.sh"++WORK=$(mktemp -d)+# Unique, so cleanup reaches only the children these fakes started.+SLEEP_MARK=$((300000 + $$ % 10000))+cleanup() { pkill -f "sleep $SLEEP_MARK" 2>/dev/null || true; rm -rf "$WORK"; }+trap cleanup EXIT INT TERM++HELPER=$(awk '+ /^_setup_probe_signal_target\(\) \{/ { grab = 1 }+ /^_setup_probe_terminate\(\) \{/ { grab = 1 }+ /^_setup_probe_restore_trap\(\) \{/ { grab = 1 }+ /^_setup_probe_on_signal\(\) \{/ { grab = 1 }+ /^_setup_probe_version\(\) \{/ { grab = 1 }+ /^_probe_system_node_tool\(\) \{/ { grab = 1 }+ grab { print }+ grab && /^}/ { grab = 0 }+' "$SETUP_SH")+for _fn in _setup_probe_signal_target _setup_probe_terminate _setup_probe_restore_trap \+ _setup_probe_on_signal _setup_probe_version _probe_system_node_tool; do+ printf '%s\n' "$HELPER" | grep -q "^$_fn() {" || {+ echo "FATAL: could not extract $_fn from setup.sh" >&2; exit 1; }+done+printf '%s\n' "$HELPER" > "$WORK/helper.sh"++mkdir -p "$WORK/hang" "$WORK/stubborn" "$WORK/leak" "$WORK/good" "$WORK/notimeout" "$WORK/tools"+printf '#!/bin/sh\nexec sleep %s\n' "$SLEEP_MARK" > "$WORK/hang/node"+# Ignores TERM, so only the KILL after the grace period stops it (GNU timeout then exits 137).+printf '#!/bin/sh\ntrap "" TERM\nsleep %s\n' "$SLEEP_MARK" > "$WORK/stubborn/node"+printf '#!/bin/sh\n( sleep %s ) &\necho v24.0.0\n' "$SLEEP_MARK" > "$WORK/leak/node"+printf '#!/bin/sh\necho v22.17.1\n' > "$WORK/good/node"+# Stock macOS has no GNU timeout; a failing stand-in sends the probe down its watchdog branch.+printf '#!/bin/sh\nexit 1\n' > "$WORK/notimeout/timeout"+chmod +x "$WORK"/*/*+# Exclude the host's Node. Include an external `true` for the GNU timeout check;+# `type -P` resolves its binary rather than the shell builtin.+for _t in bash sh mktemp head rm sleep ps cat timeout true; do+ _src=$(type -P "$_t") && ln -s "$_src" "$WORK/tools/$_t"+done++# probe <fake dir> <with|without timeout>: prints "<seconds> <version>|<output>"+probe() {+ _p="$WORK/$1:$WORK/tools"+ [ "$2" = without ] && _p="$WORK/notimeout:$_p"+ _start=$(date +%s)+ # Catch children that keep the caller's output pipe open.+ _res=$(env PATH="$_p" _SETUP_PROBE_SECONDS=2 bash -c '+ substep() { printf "%s\n" "$1"; }+ C_WARN=+ . "$1/helper.sh"+ _probe_system_node_tool node > "$1/said" 2>&1+ printf "%s|%s" "$_PROBED_VER" "$(cat "$1/said")"+ ' _ "$WORK" | cat)+ echo "$(( $(date +%s) - _start )) $_res"+}++for _mode in with without; do+ echo "$_mode GNU timeout"++ _out=$(probe hang "$_mode")+ _secs=${_out%% *}; _rest=${_out#* }+ [ "$_secs" -le 10 ] && ok "hung node: probe returns ($_secs s)" || bad "hung node: probe returns ($_secs s)"+ assert_eq "hung node: counts as no system Node" "" "${_rest%%|*}"+ assert_contains "hung node: says which node it gave up on" "${_rest#*|}" "$WORK/hang/node) did not answer --version within 2s"++ _out=$(probe stubborn "$_mode")+ _secs=${_out%% *}; _rest=${_out#* }+ [ "$_secs" -le 12 ] && ok "node ignoring TERM: probe returns ($_secs s)" || bad "node ignoring TERM: probe returns ($_secs s)"+ assert_eq "node ignoring TERM: counts as no system Node" "" "${_rest%%|*}"+ assert_contains "node ignoring TERM: still says which node it gave up on" "${_rest#*|}" "$WORK/stubborn/node) did not answer --version within 2s"++ _out=$(probe leak "$_mode")+ _secs=${_out%% *}; _rest=${_out#* }+ [ "$_secs" -le 3 ] && ok "node leaving a child running: probe returns ($_secs s)" \+ || bad "node leaving a child running: probe returns ($_secs s)"+ assert_eq "node leaving a child running: its answer is kept" "v24.0.0" "${_rest%%|*}"++ _out=$(probe good "$_mode"); _rest=${_out#* }+ assert_eq "healthy node: version read" "v22.17.1" "${_rest%%|*}"+ assert_eq "healthy node: nothing printed" "" "${_rest#*|}"++ _out=$(probe missing "$_mode"); _rest=${_out#* }+ assert_eq "no node on PATH: empty, silently" "|" "$_rest"+done++summarydiff --git a/tests/sh/test_uv_pinned_release.sh b/tests/sh/test_uv_pinned_release.shindex 181d8099c28..6850d133f84 100755--- a/tests/sh/test_uv_pinned_release.sh+++ b/tests/sh/test_uv_pinned_release.sh@@ -1118,7 +1118,10 @@ mkdir -p "$WORK/whl/uv-0.12.1.data/scripts" && cp "$WORK/src/uv-fake-triple/uv"WHEEL_SHA=$( (sha256sum "$WORK/uv-fake.whl" 2>/dev/null || shasum -a 256 "$WORK/uv-fake.whl") | awk '{print $1}')_sa=$(grep -n '^_SETUP_UV_PINNED_VERSION=' "$SETUP_SH" | cut -d: -f1)_sb=$(awk -v s="$(grep -n '^_setup_install_uv_pinned() {' "$SETUP_SH" | cut -d: -f1)" 'NR > s && /^}$/ { print NR; exit }' "$SETUP_SH")-sed -n "${_sa},${_sb}p" "$SETUP_SH" > "$WORK/uvfns_setup.sh"+# Include the shared probe used to validate the pinned uv binary.+_pa=$(grep -n '^_SETUP_PROBE_TARGET=' "$SETUP_SH" | cut -d: -f1)+_pb=$(awk -v s="$(grep -n '^_setup_probe_version() {' "$SETUP_SH" | cut -d: -f1)" 'NR > s && /^}$/ { print NR; exit }' "$SETUP_SH")+{ sed -n "${_pa},${_pb}p" "$SETUP_SH"; sed -n "${_sa},${_sb}p" "$SETUP_SH"; } > "$WORK/uvfns_setup.sh"cp "$WORK/uvfns.sh" "$WORK/uvfns_install.sh"for _run in install:good install:bad setup:good setup:bad; do_wh="$WORK/wheel_${_run%:*}_${_run#*:}"; mkdir -p "$_wh"; _want=$WHEEL_SHA; [ "${_run#*:}" = good ] || _want=$(printf '0%.0s' $(seq 64))