From f7f2ae30477ffda3d2ba969626be74262136982f Mon Sep 17 00:00:00 2001 From: SamNet-dev Date: Tue, 10 Feb 2026 01:30:13 -0600 Subject: [PATCH] fix: load_servers() clobbering caller's local variables (#39) load_servers() used `label`, `conn`, `auth_type` as while-read loop variables, which clobbered identically-named locals in add_server_interactive() due to bash dynamic scoping. This caused the server label to be empty when adding a 2nd+ server. Rename loop variables to `_l`, `_c`, `_a` to avoid the collision. Closes #39 --- conduit.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/conduit.sh b/conduit.sh index b067e8f..d85ecef 100644 --- a/conduit.sh +++ b/conduit.sh @@ -8160,12 +8160,12 @@ load_servers() { SERVER_COUNT=0 local conf="$INSTALL_DIR/servers.conf" [ -f "$conf" ] || return - while IFS='|' read -r label conn auth_type _rest || [ -n "$label" ]; do - [[ "$label" =~ ^#.*$ ]] && continue - [ -z "$label" ] || [ -z "$conn" ] && continue - SERVER_LABELS+=("$label") - SERVER_CONNS+=("$conn") - SERVER_AUTHS+=("${auth_type:-key}") + while IFS='|' read -r _l _c _a _rest || [ -n "$_l" ]; do + [[ "$_l" =~ ^#.*$ ]] && continue + [ -z "$_l" ] || [ -z "$_c" ] && continue + SERVER_LABELS+=("$_l") + SERVER_CONNS+=("$_c") + SERVER_AUTHS+=("${_a:-key}") SERVER_COUNT=$((SERVER_COUNT + 1)) done < "$conf" }