From e571efbea1ba1d63864a4b7b4c8b7a37d85ede28 Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Fri, 3 Jul 2026 04:38:31 +0000 Subject: [PATCH] fix(backup): read remote backup list from stdin in selector select_newest_remote_backup_from_list was sorting an empty process substitution instead of the piped list-backups.sh output. Co-authored-by: Cursor --- volume-utils.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/volume-utils.sh b/volume-utils.sh index a201b9f6..43105b6c 100755 --- a/volume-utils.sh +++ b/volume-utils.sh @@ -66,9 +66,20 @@ select_newest_remote_backup_from_list() { local remote_source=$1 local volume_name=$2 local newest="" f size + local -a files=() while IFS= read -r f; do - [[ -z "$f" ]] && continue + [[ -n "$f" ]] && files+=("$f") + done + + if (( ${#files[@]} == 0 )); then + return 0 + fi + + IFS=$'\n' files=( $(printf '%s\n' "${files[@]}" | sort) ) + unset IFS + + for f in "${files[@]}"; do [[ "$f" == "${volume_name}-"* ]] || continue [[ "$f" == *.tar.zst ]] || continue size=$(remote_backup_archive_size_bytes "$remote_source" "$f") @@ -77,7 +88,7 @@ select_newest_remote_backup_from_list() { continue fi newest="$f" - done < <(sort) + done if [[ -n "$newest" ]]; then echo "$newest"