From 90f9c9d95429299242eea0898b3f2c8072886298 Mon Sep 17 00:00:00 2001 From: Sebastian Cabrera Date: Wed, 9 Sep 2026 20:59:01 -0400 Subject: [PATCH] Fix prompt() silently truncating multi-line pasted input `prompt()` used a single `read -r`, which stops at the first newline. If a pasted value (most notably join-data copied from the panel UI) arrives with an embedded newline, everything after it was silently dropped, and the leftover fragment would be consumed by the *next* prompt instead. The truncated-but-still-valid-looking base64 could still decode successfully, just missing trailing fields like `remote`, producing a config.yml that fails at startup with "invalid remote configuration, cannot connect to panel". prompt() now drains any additional lines already buffered on the TTY after the first read, so a multi-line paste is captured in full without blocking on further keystrokes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- install-wings.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/install-wings.sh b/install-wings.sh index 7e4c922..9828f1d 100644 --- a/install-wings.sh +++ b/install-wings.sh @@ -34,9 +34,19 @@ need_tty() { prompt() { local msg="$1" - local out + local out line printf "${BOLD}%s${RESET}" "$msg" >"$TTY" IFS= read -r out <"$TTY" + + # A pasted value (e.g. join-data copied from the panel UI) can arrive with an + # embedded newline. `read` stops at the first one, which would otherwise + # silently truncate the rest onto a "phantom" line consumed by a later + # prompt. Drain any additional lines that are already buffered so nothing + # gets lost; this never blocks waiting on new keystrokes. + while IFS= read -r -t 0.1 line <"$TTY" 2>/dev/null; do + out+="$line" + done + printf "%s" "$out" }