Repository navigation
Ask the file system for the real path of a name that holds a backslash - #683
Merged
ronleizrowice-ant merged 4 commits intoOct 12, 2026
Merged
Conversation
Off Windows a backslash is a character of a file name like any other, and runtimes differ in what fs.realpathSync does with one. realPathOf is the one place the library asks for a real path: a name without a backslash, and every name on Windows, goes to realpathSync as it is; any other is resolved component by component, split at '/' alone. Dot segments in the given name are folded in text first, as realpathSync folds them. It stands at all eleven call sites, an ESLint rule keeps the raw call out of src/, and the package exports it.
The case asked its own helper, which goes to fs.realpathSync and falls back to the spelling. Where the temp directory is reached through a link, as on macOS, the walk gives the real path. The expectation is built from the real temp directory.
…ernel's The property compares realPathOf with the kernel, and in a Node child with Node's fs.realpathSync. Runtimes differ in how they read a link's target that goes up from behind a name, and for a name with no backslash realPathOf gives the runtime's answer. So on a tree with such a link the child is asked about names that hold a backslash alone. The child has a time limit, and its error output is part of the expectation.
One conflict, with #575, at two call sites in the walk: main's side, asking realPathOf.
ronleizrowice-ant
deleted the
fix/real-path-of-a-name-with-a-backslash
branch
October 12, 2026 14:14
This was referenced Oct 12, 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.
Off Windows a backslash is a character of a file name like any other, and runtimes differ in what
fs.realpathSyncdoes with one.realPathOf(src/utils/real-path.ts) is the one place the library asks for a real path.realpathSyncas it is: the same calls, one for one./alone, withlstatandreadlink. Errors keep the kernel'scode;ELOOPpast 40 links..and..in the given name are folded in text first, asrealpathSyncfolds them. In a link's target they are read as the kernel reads them.It replaces
fs.realpathSyncat all eleven call sites. An ESLint rule keeps the raw call out ofsrc/.New export:
realPathOf, for a caller that judges paths itself and wants the library's answer.Testing
denyRead,denyWrite,allowRead,allowWrite,credentials.filesdeny and mask, a**pattern) on names that hold a backslash, in the real sandbox on Linux and macOS: 69 rows, on bubblewrap 0.11.2 and 0.4.1.main's, call for call. 34 mutations, each failing a test.The macOS rows have their first run in this pull request's CI.
Merge order
#575 rewrites two of the call sites. Whichever lands second takes the two lines; the ESLint rule names them.