Skip socket files in backup conflicts check#43
Merged
fullstackjam merged 2 commits intomainfrom Apr 22, 2026
Merged
Conversation
backupConflicts walked stow packages and called os.ReadFile on any non-symlink, non-directory target. Unix domain sockets (e.g. the SSH agent socket at ~/.ssh/agent/*.agent.*) are not directories but also not readable as files, causing "operation not supported on socket". Replace info.IsDir() with !info.Mode().IsRegular() so only plain regular files are backed up; sockets, named pipes, and device files are silently skipped. https://claude.ai/code/session_01Dp7HMonM7Jc1PMcBZ4vL4P
|
👋 Thanks for opening this pull request! Before merging:
@fullstackjam will review this soon. Thanks for contributing! 🚀 |
…th limit
macOS enforces a 104-byte maximum path length for Unix domain sockets.
t.TempDir() embeds the full test name in the path, which pushes
TestBackupConflicts_SkipsSocketFiles over the limit and causes
net.Listen to return bind: invalid argument on the macOS CI runner.
Switch to os.MkdirTemp("", "ob") for the socket test so the base path
stays short enough for all platforms.
https://claude.ai/code/session_01Dp7HMonM7Jc1PMcBZ4vL4P
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Updates the
backupConflictsfunction to skip socket files (and other non-regular files) instead of only skipping directories, preventing attempts to back up Unix domain sockets and similar special files.Why?
The previous implementation only checked
info.IsDir()to determine whether to skip a file. This caused socket files and other special file types (named pipes, devices, etc.) to be treated as regular files and included in the backup process, which can cause errors or unexpected behavior. By checking!info.Mode().IsRegular()instead, we properly skip all non-regular files while still backing up actual files that need to be preserved.Testing
go vet ./...passesTestBackupConflicts_SkipsSocketFilesto verify socket files are not backed upNotes for reviewer
The change is minimal and focused: replacing the directory-only check with a more comprehensive non-regular-file check. This is safer and handles edge cases like socket files that may exist at conflict paths.
https://claude.ai/code/session_01Dp7HMonM7Jc1PMcBZ4vL4P