Harden step_snap: dedupe Set ids (multi-snap sets)

Local flow verified end-to-end (macOS guards). Remote Ubuntu/Arch
verification deferred to user (interactive, destructive on real hosts).

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-22 00:20:20 +07:00
co-authored by Claude
parent a49f26adc8
commit ce49f1ce5c
+2 -1
View File
@@ -278,7 +278,8 @@ step_snap() {
return return
fi fi
local saved local saved
saved=$(sudo snap saved 2>/dev/null | awk 'NR>1{print $1}') # Cột đầu (Set) là id cần forget; một Set có thể có nhiều Snap → dedupe.
saved=$(sudo snap saved 2>/dev/null | awk 'NR>1{print $1}' | awk '!seen[$0]++')
if [ -z "$saved" ]; then if [ -z "$saved" ]; then
echo "${C_OK} ✓ Không có snap snapshot nào.${C_RESET}" echo "${C_OK} ✓ Không có snap snapshot nào.${C_RESET}"
echo "" echo ""