From 2f245c77e1489085305f8ed83fbb096ce8503b54 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 15 Jul 2026 16:49:56 +0000 Subject: [PATCH] fix(claude_desktop): keep the final tokensave path from bashio::config bashio::config prints its result via printf without a trailing newline, so a plain while-read loop drops the last (often only) configured project path and no TokenSave repository would be initialized. Use the read || [ -n ... ] idiom in the three path loops so the final unterminated record is still processed. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01KN8i26JrKSaBdvTrpVEyQ6 --- .../rootfs/etc/cont-init.d/81-tokensave_repositories.sh | 4 +++- claude_desktop/rootfs/etc/cont-init.d/82-claude_tools.sh | 4 +++- claude_desktop/rootfs/usr/local/bin/claude-tools-doctor.sh | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/claude_desktop/rootfs/etc/cont-init.d/81-tokensave_repositories.sh b/claude_desktop/rootfs/etc/cont-init.d/81-tokensave_repositories.sh index 7ff5292f28..1bb0e63c4a 100755 --- a/claude_desktop/rootfs/etc/cont-init.d/81-tokensave_repositories.sh +++ b/claude_desktop/rootfs/etc/cont-init.d/81-tokensave_repositories.sh @@ -8,7 +8,9 @@ if ! bashio::config.true 'install_tokensave' || ! command -v git > /dev/null 2>& fi declare -A REPOS_SEEN=() -while IFS= read -r configured_path; do +# bashio::config prints its result without a trailing newline, so the last record arrives +# with read returning non-zero; the extra test keeps that final path in the loop. +while IFS= read -r configured_path || [ -n "$configured_path" ]; do configured_path="${configured_path#"${configured_path%%[![:space:]]*}"}" configured_path="${configured_path%"${configured_path##*[![:space:]]}"}" if [ -z "$configured_path" ] || [ "$configured_path" = "null" ]; then diff --git a/claude_desktop/rootfs/etc/cont-init.d/82-claude_tools.sh b/claude_desktop/rootfs/etc/cont-init.d/82-claude_tools.sh index 719460c6bd..be6a8bf53d 100755 --- a/claude_desktop/rootfs/etc/cont-init.d/82-claude_tools.sh +++ b/claude_desktop/rootfs/etc/cont-init.d/82-claude_tools.sh @@ -167,7 +167,9 @@ PY # requires one-time per-project opt-in; an empty list therefore has no startup or storage cost. if $TOKENSAVE_ENABLED; then declare -A TOKENSAVE_REPOS_SEEN=() - while IFS= read -r configured_path; do + # bashio::config prints its result without a trailing newline, so the last record arrives + # with read returning non-zero; the extra test keeps that final path in the loop. + while IFS= read -r configured_path || [ -n "$configured_path" ]; do # Trim surrounding whitespace while preserving spaces inside paths. configured_path="${configured_path#"${configured_path%%[![:space:]]*}"}" configured_path="${configured_path%"${configured_path##*[![:space:]]}"}" diff --git a/claude_desktop/rootfs/usr/local/bin/claude-tools-doctor.sh b/claude_desktop/rootfs/usr/local/bin/claude-tools-doctor.sh index 1d2c3c8c6a..41a25e847b 100755 --- a/claude_desktop/rootfs/usr/local/bin/claude-tools-doctor.sh +++ b/claude_desktop/rootfs/usr/local/bin/claude-tools-doctor.sh @@ -149,7 +149,7 @@ section "TokenSave" if bashio::config.true 'install_tokensave'; then tokensave doctor --agent claude || true tokensave gain --all --range 30d || true - while IFS= read -r configured_path; do + while IFS= read -r configured_path || [ -n "$configured_path" ]; do if [ -z "$configured_path" ] || [ "$configured_path" = "null" ]; then continue fi