[Build] purely-lexical URL operations for resolving symlinks#31
Merged
Conversation
wlan0
commented
Jun 7, 2025
| #expect(false == fileURL.parentOf(httpURL)) | ||
| } | ||
|
|
||
| @Test func testParentOfRelativePaths() throws { |
Contributor
Author
There was a problem hiding this comment.
This test wasn't covering a valid condition in our logic. So, it has been removed
katiewasnothere
approved these changes
Jun 7, 2025
adityaramani
approved these changes
Jun 7, 2025
Contributor
adityaramani
left a comment
There was a problem hiding this comment.
Tested locally on my Mac
owenarthur
pushed a commit
to owenarthur/container
that referenced
this pull request
Jun 10, 2025
`BuildFSSync.walk` relied on an implementation detail to skip traversing the path ".", relative to the build context dir. Specifically, it assumed that: - `URL.parentOf()` would return false when the parent argument was relative. - `URL.path(percentEncoded: false)` would preserve the relativity of an input path. These assumptions held on earlier macOS releases, so the context directory silently remained untouched. In some versions of macOS , `URL.path(percentEncoded: false)` always returns an absolute path, regardless of how the URL was created. Because of this change, `URL.parentOf()` now returns true for ".", and BuildFSSync.walk begins descending into the context directory—something it was never meant to do. This solution: - Remove the hidden dependency on `URL.parentOf()` for context‑directory detection. - Add an explicit check for "." inside BuildFSSync.walk and bail out early. Replace fragile calls to `URL.path(percentEncoded: false`) with the stable, documented `URL.relativePath`, which preserves relativity when the original path was relative.
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.
BuildFSSync.walkrelied on an implementation detail to skip traversing the path ".", relative to the build context dir.Specifically, it assumed that:
URL.parentOf()would return false when the parent argument was relative.URL.path(percentEncoded: false)would preserve the relativity of an input path.These assumptions held on earlier macOS releases, so the context directory silently remained untouched.
In some versions of macOS ,
URL.path(percentEncoded: false)always returns an absolute path, regardless of how the URL was created. Because of this change,URL.parentOf()now returns true for ".", and BuildFSSync.walk begins descending into the context directory—something it was never meant to do.This solution:
URL.parentOf()for context‑directory detection.Replace fragile calls to
URL.path(percentEncoded: false) with the stable, documentedURL.relativePath, which preserves relativity when the original path was relative.