fix: remove Unix socket files before mackup backup

Mackup fails with shutil.Error [Errno 102] when it tries to copy Unix
socket files (e.g. iTerm2's iterm2-daemon-1.socket, sockets/secrets).
Sockets are ephemeral runtime artefacts — they cannot be meaningfully
backed up and are always recreated by the owning app on startup.

Purge all -type s files from $HOME before calling mackup backup.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-12 10:43:13 +02:00
parent 72516b864c
commit c6ac73bc83
+10
View File
@@ -182,6 +182,16 @@ ssr::mackup::backup() {
fi fi
[[ -n "$mackup_root" ]] && ssr::mackup::_materialize_icloud "$mackup_root" [[ -n "$mackup_root" ]] && ssr::mackup::_materialize_icloud "$mackup_root"
# Unix socket files (type s) cannot be copied and are always recreated
# by their owning app on startup. Remove them from $HOME before backup
# to prevent shutil.Error: [Errno 102] Operation not supported on socket.
local socket_count
socket_count="$(find "$HOME" -type s 2>/dev/null | wc -l | tr -d ' ')"
if [[ "$socket_count" -gt 0 ]]; then
ssr::log "Removing $socket_count Unix socket file(s) before mackup backup (runtime artefacts)"
find "$HOME" -type s -delete 2>/dev/null || true
fi
local attempt rc=0 local attempt rc=0
for attempt in 1 2 3; do for attempt in 1 2 3; do
if mackup -f backup; then if mackup -f backup; then