From d432d98723be26ef5e71abe1a3c3d470c65028c3 Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Tue, 6 Jan 2026 19:31:45 +0100 Subject: [PATCH] iptag: fix syntax error in VM config file parsing (#10598) * fix(iptag): Fix syntax error in VM config file parsing The array assignment was using an invalid pipe construct inside the loop: vmids+=("${conf##*/}" | sed 's/\.conf$//') This caused a bash syntax error: syntax error near unexpected token '2' Fixed by using: - shopt -s nullglob to handle empty directories gracefully - Parameter expansion ${filename%.conf} instead of sed pipe Fixes #10595 * fix(iptag): Fix syntax error in VM config file parsing The array assignment was using an invalid pipe construct inside the loop: vmids+=("${conf##*/}" | sed 's/\.conf$//') This caused a bash syntax error: syntax error near unexpected token '2' Fixed by using parameter expansion ${basename%.conf} instead of sed pipe. Fixes #10595 --- tools/pve/add-iptag.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/pve/add-iptag.sh b/tools/pve/add-iptag.sh index e00e4ee69..bd4353d55 100644 --- a/tools/pve/add-iptag.sh +++ b/tools/pve/add-iptag.sh @@ -842,8 +842,10 @@ update_all_tags() { else # More efficient: direct file listing instead of ls+sed vmids=() - for conf in /etc/pve/qemu-server/*.conf 2>/dev/null; do - [[ -f "$conf" ]] && vmids+=("${conf##*/}" | sed 's/\.conf$//') + for conf in /etc/pve/qemu-server/*.conf; do + [[ -f "$conf" ]] || continue + local basename="${conf##*/}" + vmids+=("${basename%.conf}") done fi