Fix Windows unix socket URL round-trip - #6416
Merged
Merged
Conversation
ListenURL prepended a slash onto POSIX paths and emitted unix:////tmp/.... Health tests concatenated unix:// onto drive-letter paths, which url.Parse rejects as an invalid port. One helper now emits both forms. The parser keeps POSIX paths in slash form on Windows and still accepts the old four-slash alias. Signed-off-by: stantheman0128 <stanshih888@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
stantheman0128
requested review from
JAORMX,
amirejaz,
aponcedeleonch,
rdimitrov and
reyortiz3
as code owners
August 23, 2026 17:10
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6416 +/- ##
==========================================
+ Coverage 77.70% 77.72% +0.01%
==========================================
Files 756 760 +4
Lines 72788 72907 +119
==========================================
+ Hits 56563 56669 +106
- Misses 16220 16233 +13
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…r .. paths. Signed-off-by: stantheman0128 <stanshih888@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
samuv
reviewed
Aug 24, 2026
samuv
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the focused fix and the coverage for both POSIX and drive-letter round trips. I found one path-validation edge case where a drive-relative Windows path is accepted as absolute, so I left an inline comment. The current PR checks are green.
Checklist:
- Tests: New regression tests cover the intended paths, and CI is green.
- Docs: No additional docs needed for this internal compatibility fix.
- Registry impact: None.
- Security: One path-validation issue noted inline.
- Backwards compatibility: The legacy four-slash alias remains supported.
Signed-off-by: Po-Han Shih <stanshih888@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
samuv
approved these changes
Aug 25, 2026
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.
Summary
I reproduced this on Windows 11 with
go test ./pkg/api ./pkg/server/discovery. Drive-letter emit was alreadyunix:///C:%5C.... What still failed:ListenURLfor/tmp/test.sockcame out asunix:////tmp/test.sock(extra slash).ParseUnixSocketPath("unix:///var/run/thv.sock")ran the path throughfilepath.Clean, so Windows turned it into\var\run\thv.sockand rejected it as not absolute."unix://"+socketPath, whichurl.Parserejects on a drive letter (invalid port).I put emit on one helper (
discovery.UnixSocketURL) and taught the parser the two absolute forms instead of three one-off patches.net/urlneeds.unix:///stays slash-form on Windows. The old four-slash alias still parses.Fixes #6291
Type of change
Test plan
task test)task test-e2e)task lint-fix)Win11, go1.26.5, worktree at
origin/maine25de16. I did not run fulltask test(whole-repo-race). Focused:TestListenURL/Unix_socket_returns_unix_URL,TestUnixSocketURL, POSIX/drive-letter round-trip, andTestParseUnixSocketPath_FourSlashAliasare in that set.API Compatibility
v1beta1API, OR theapi-break-allowedlabel is applied and the migration guidance is described above.Changes
pkg/server/discovery/unix_url.goUnixSocketURLplus POSIX vs drive-letter parsepkg/server/discovery/health.goParseUnixSocketPathdelegates to that parsepkg/api/socket_windows.go/socket_unix.gosocketURLcallsUnixSocketURL(npipe branch unchanged)*_test.goDoes this introduce a user-facing change?
Yes, for AF_UNIX discovery URLs. A POSIX socket path on Windows is now
unix:///tmp/...(three slashes), notunix:////tmp/.... Drive-letter URLs are unchanged (unix:///C:%5C...). Named pipes are unchanged.Special notes for reviewers
I left
pkg/container/docker/sdk/client_unix.go(unix://+docker socket into mobyWithHost) alone. That is a different host string, unix-only build.I used Cursor to write the patch after reproducing the failures on this box.
Claimed and assigned on #6291.