Repository navigation
NAR: both walks open a regular file without following a symlink, as upstream's dump does - #118
Merged
Merged
Conversation
AniAthena
marked this pull request as ready for review
December 4, 2026 21:11
aoinoikaz
previously approved these changes
Dec 4, 2026
AniAthena
force-pushed
the
nar/open-without-following
branch
from
December 4, 2026 21:31
4bbbc52 to
3225260
Compare
…s place, as upstream's dump does
AniAthena
force-pushed
the
nar/open-without-following
branch
from
December 4, 2026 21:42
3225260 to
e0a6a48
Compare
aoinoikaz
approved these changes
Dec 4, 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.
Both walks opened a regular file by name through GHC's
openFile, which follows a symlink, so a regular file replaced by a symlink to another regular file between itslstatand its open was archived as a regular file holding the target's bytes. Upstream's dump opens without following one in the file's place:O_NOFOLLOWat 2.24.9 andopenFileEnsureBeneathNoSymlinksat 2.36.0 (posix-source-accessor.cc).A new
openWalkedFileopens the file for both walks: on POSIX by its raw path bytes withO_NOFOLLOW, non-blocking so a FIFO swapped in is still refused by the size read rather than waiting for a writer, and on Windows by name as before. A symlink is refused at the open as aNarWalkErrorforWalkReadFile. Tests swap the file for a symlink through the executable-bit resolver, which runs after the classification and before the open, for each walk.readFileBytes's comment now names where upstream reads the recorded size.O_NOFOLLOWcovers only the file's own place: upstream also refuses a symlink among its ancestors, which needs a walk by directory descriptors in both walks and is #119.Closes #117