Repository navigation
Shell.resolve: a backslash roots a path on Windows - #24
Conversation
`\dir` (the current drive's root) and `\\server\share` UNC paths were joined to the working directory as if relative, so `git push \\server\share\repo.git` (SwiftPorts) looked under the work tree. Like a drive-letter path, a backslash-rooted one is now absolute, outside the unix-style virtual namespace: as given without a mapping, voided under one. On other platforms a backslash stays an ordinary character. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b0097e752f
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex review on #24: on Windows, `\repo.git` (and `/repo.git`) is the root of the current drive, and a shell working on `D:\work` means `D:\repo.git`, whatever drive the process is on. Without a mapping, a path rooted at the current drive's root now takes the drive of the shell's working directory; UNC paths and drive-letter paths keep their own root, and a working directory without a drive leaves the path to the process as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit also gave `/x` the shell's drive. `Environment()` defaults the working directory to the process's, so on Windows every `/x` would have come back spelled `D:/x`, against resolve's contract that an absolute path without a mapping comes back as given (and resolveAbsolutePathPassesThrough). `/x` is the unix-style namespace and passes through unchanged again; only the backslash-rooted spelling, which this PR adds, is taken onto the shell's drive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
`Environment()` starts in the process's directory, which on the Windows runner is `D:\a\...`, so the "no drive to take" check took D:. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
On Windows,
Shell.resolve(_:)recognized only/and drive letters (C:\x) as absolute. A path rooted by a backslash, either\dir(the current drive's root) or a\\server\shareUNC path, was joined to the working directory as if it were relative.This came up in SwiftPorts (Cocoanetics/SwiftPorts#125, Codex review):
git push \\server\share\repo.gitresolved its repository under the work tree.Change
A backslash-rooted path is now handled like a drive-letter path. It is absolute and lives outside the unix-style virtual namespace, so it resolves to the unmapped sentinel under a path mapping, where
Sandbox.authorizerejects it. Without a mapping:\\server\share\x) comes back as given (normalizePathalready kept UNC roots, Preserve UNC roots when normalizing Windows paths #23);\x, the current drive's root, takes the drive of the shell's working directory, which can differ from the process's: a shell onQ:\workresolves\repo.gittoQ:\repo.git. With no drive in the working directory, the path comes back as given./xis unchanged: it is the unix-style namespace and still comes back as given. On other platforms a backslash stays an ordinary character.Tests
resolveBackslashRootedPathsAsAbsolute(Windows): UNC and drive-letter paths keep their root;\repo.gitand\take the drive of aQ:\workworking directory; without a drive they come back as given; a UNC path is voided under a mapping.resolveTakesABackslashAsAnOrdinaryCharacter(other platforms):\file.txtis still relative.swift testpasses on macOS (66 tests) andswiftlint lintis clean. The Windows test runs in CI.🤖 Generated with Claude Code