From 15d50f147883a76bdf6222862e76b9396221340c Mon Sep 17 00:00:00 2001 From: KeiSei84 <2206745@gmail.com> Date: Fri, 22 May 2026 10:58:44 +0800 Subject: [PATCH] fix(web-install): don't hang after 'delegating' in interactive curl|bash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit curl|bash makes bash read THIS script byte-by-byte from the pipe. A bare `exec < /dev/tty` swapped stdin, then bash tried to read the NEXT line (the `exec ./bootstrap.sh`) from the keyboard → infinite hang after "delegating to bootstrap.sh", bootstrap never started, no profile/language menu. Fix: merge the redirect INTO the bootstrap exec (one command), so the process is replaced the instant stdin is swapped and bash never reads another script byte from the (now-wrong) stdin. Verified: piped-under-pty buggy=HANG, fixed=bootstrap starts with stdin=tty. Co-Authored-By: Claude Opus 4.7 (1M context) --- web-install.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/web-install.sh b/web-install.sh index ffa2dcf..e9d3ec7 100755 --- a/web-install.sh +++ b/web-install.sh @@ -91,16 +91,20 @@ say "delegating to $KEISEI_ROOT/bootstrap.sh ${PASS_THROUGH[*]:-}" cd "$KEISEI_ROOT" # curl|bash сценарий: stdin = pipe от curl, поэтому wizard'у read нечего читать. -# Если /dev/tty реально ОТКРЫВАЕТСЯ (сессия интерактивная), переподключаем stdin -# к терминалу — иначе onboarding/whiptail падают на первом prompt. -# ВАЖНО: `[ -r /dev/tty ]` недостаточно — путь может stat'иться readable, но +# Если /dev/tty реально ОТКРЫВАЕТСЯ (сессия интерактивная), запускаем bootstrap +# со stdin = терминал — иначе onboarding/whiptail падают на первом prompt. +# ВАЖНО #1: `[ -r /dev/tty ]` недостаточно — путь может stat'иться readable, но # `exec < /dev/tty` падает с "No such device or address" когда нет управляющего # терминала (ssh non-interactive, CI, cron). Поэтому пробуем реально открыть его -# через `{ : < /dev/tty; }` и реаттачим ТОЛЬКО при успехе. Иначе установка идёт -# неинтерактивно (рассчитано на --yes / KEISEI_SKIP_ONBOARD). -# audit 2026-05-18 bug #4; non-TTY e2e fix 2026-05-21. +# через `{ : < /dev/tty; }` и реаттачим ТОЛЬКО при успехе. +# ВАЖНО #2: bash читает ЭТОТ скрипт из трубы curl ПОБАЙТНО. Отдельный +# `exec < /dev/tty` заставил бы bash читать СЛЕДУЮЩУЮ строку (сам запуск +# bootstrap) уже с клавиатуры → вечный висяк после "delegating". Поэтому редирект +# и exec ОБЯЗАНЫ быть ОДНОЙ командой: подменили stdin и сразу заменили процесс — +# bash больше не читает ни байта скрипта из (уже не той) трубы. +# audit 2026-05-18 bug #4; non-TTY e2e fix 2026-05-21; curl|bash hang fix 2026-05-22. if [ ! -t 0 ] && { : < /dev/tty; } 2>/dev/null; then - exec < /dev/tty + exec ./bootstrap.sh "${PASS_THROUGH[@]}" < /dev/tty fi exec ./bootstrap.sh "${PASS_THROUGH[@]}"