fix(plugin): skip sockets when copying repositories - #32637
fix(plugin): skip sockets when copying repositories#32637ruslan-shaydullin wants to merge 1 commit into
Conversation
Signed-off-by: Ruslan Shaydullin <shaydullin.r.d@outlook.com>
|
Thanks @ruslan-shaydullin for the clear fix! Reviewed the change—skipping os.ModeSocket during CopyDir makes total sense to prevent FSMonitor socket errors. The regression test looks solid too. |
Karthik-Chowdary
left a comment
There was a problem hiding this comment.
The narrow behavior is appropriate for #12125: a Unix-domain socket is live IPC state and cannot be meaningfully copied, while checking the DirEntry type before the existing directory/file paths preserves regular files, directories, and symlinks. The regression uses a real AF_UNIX listener and verifies both the positive copy and socket omission. I also checked the prior broader #12372 approach, CopyDir call sites/history, and special-file/symlink implications; I found no new traversal or dereference behavior here. Locally, go test -race ./internal/third_party/dep/fs ./internal/plugin/installer and 100 repetitions of the socket regression pass at c2689c9. Upstream unit/build, lint, CodeQL, and DCO checks are green for the same SHA.
What this PR does / why we need it:
Git's FSMonitor daemon can leave a Unix-domain socket inside a plugin repository's
.gitdirectory. Copying that repository currently fails whenCopyFileattempts to open the socket, which prevents plugin installation.Skip directory entries marked
os.ModeSocketduring recursiveCopyDiroperations. Add a regression test with a real Unix-domain socket that verifies the regular file reaches the destination while the socket is omitted.Fixes #12125.
Special notes for your reviewer:
The change preserves
.gitcopying, theCopyDirAPI, and existing handling of regular files, directories and symlinks. It only filters socket entries.Validation on Go 1.27.0:
make test-unit, filesystem/installer-racetests,make test-style(0 issues; golangci-lint 2.13.2),go mod tidy -diff, and CLI build pass.syscall.Umask. A baseline-versus-patch Windows comparison confirms identical failing test sets on main and this patch, while the new socket test and production package builds pass. The full Windows suite is not claimed green.The native checks explicitly test contribution commit
c2689c955; the validation-only workflow stays in the fork and is not part of this PR.AI assistance: Codex assisted with implementation, review, testing and preparation of this description.
If applicable:
docs neededlabel should be applied if so)