Skip to content

Fix control socket paths with special characters - #1328

Merged
yzhuang-oai merged 1 commit into
mainfrom
dev/yzhuang/fix-control-socket-paths
Sep 7, 2026
Merged

yzhuang-oai merged 1 commit into
mainfrom
dev/yzhuang/fix-control-socket-paths

Conversation

@yzhuang-oai

@yzhuang-oai yzhuang-oai commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

URL.path() percent-encodes VM directory names and, on older macOS releases, can return only the relative part of a URL with a base. These behaviors can prevent stale control-socket cleanup or directory changes; in Tart 2.36.0, the resulting bind error aborts VM startup.

Remove stale sockets with FileManager.removeItem(at:) and use .absoluteURL.path(percentEncoded: false) for directory changes in run, exec, and agent IP lookup. Add one regression test for a stale socket in a long path containing spaces, %, #, and Unicode.

Fixes #1319. See also #1224 and swiftlang/swift-foundation#1011 for the older relative-URL behavior.

Validation

  • All 126 Swift tests passed on macOS 26.6.2.
  • Manual macOS VM starts succeeded with spaces in TART_HOME and the VM name. Host Virtualization shutdown errors and VM limits prevented completing the remaining runtime checks.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-07T16:45:41.503599Z d798a89 New commits
🔒 Security Review ✅ Completed 2026-09-07T16:46:53.912865Z d798a89 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the decoded URL.path at the filesystem boundary is the right fix here. The control socket logic operates on POSIX paths, so percent-encoding from URL presentation should never reach chdir, unlink, or socket-path handling.

The regression is good because it combines characters that force URL encoding with the Unix-socket path-length constraint and a stale socket entry. One small strengthening would be to assert in the fixture that the encoded URL representation actually differs from .path, so the test remains explicitly tied to this regression if Foundation URL behavior changes.

@edi-oai

edi-oai commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

edi-oai
edi-oai previously approved these changes Sep 7, 2026

@edi-oai edi-oai left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since .path is deprecated, should we just use the .path(percentEncoded: false) instead?

There's also removeItem(at:) that directly takes a URL.

@yzhuang-oai

Copy link
Copy Markdown
Contributor Author

Since .path is deprecated, should we just use the .path(percentEncoded: false) instead?

There's also removeItem(at:) that directly takes a URL.

Fixed, thanks @edi-oai

@yzhuang-oai
yzhuang-oai merged commit cdb3579 into main Sep 7, 2026
1 check passed
@yzhuang-oai
yzhuang-oai deleted the dev/yzhuang/fix-control-socket-paths branch September 7, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Address already in use" in 2.36.0

3 participants