Skip to content

Skip socket files in backup conflicts check#43

Merged
fullstackjam merged 2 commits intomainfrom
claude/setup-dev-environment-57xnQ
Apr 22, 2026
Merged

Skip socket files in backup conflicts check#43
fullstackjam merged 2 commits intomainfrom
claude/setup-dev-environment-57xnQ

Conversation

@fullstackjam
Copy link
Copy Markdown
Collaborator

What does this PR do?

Updates the backupConflicts function 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 ./... passes
  • Relevant tests added or updated
  • Added TestBackupConflicts_SkipsSocketFiles to verify socket files are not backed up

Notes 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

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
@github-actions
Copy link
Copy Markdown

👋 Thanks for opening this pull request!

Before merging:

  • Code follows existing patterns in the codebase
  • go build ./... and go vet ./... pass
  • Commit message is clear and descriptive

@fullstackjam will review this soon. Thanks for contributing! 🚀

@github-actions github-actions Bot added the tests Tests only label Apr 22, 2026
…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
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fullstackjam fullstackjam merged commit 368b1f7 into main Apr 22, 2026
9 checks passed
@fullstackjam fullstackjam deleted the claude/setup-dev-environment-57xnQ branch April 22, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Tests only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants