Repository navigation
macos: recover paths that restart at a symbolic link - #31
Draft
LalitMaganti wants to merge 1 commit into
Draft
LalitMaganti wants to merge 1 commit into
LalitMaganti wants to merge 1 commit into
Conversation
LalitMaganti
added this pull request to stack #32
September 16, 2026 12:57
LalitMaganti
force-pushed
the
macos-record-5
branch
from
September 16, 2026 13:04
96994ce to
3cccce3
Compare
LalitMaganti
force-pushed
the
macos-record-5
branch
from
September 16, 2026 13:11
3cccce3 to
b27e891
Compare
LalitMaganti
force-pushed
the
macos-record-5
branch
from
September 16, 2026 13:17
b27e891 to
006edb6
Compare
LalitMaganti
force-pushed
the
macos-record-5
branch
from
September 16, 2026 13:20
006edb6 to
90b3fec
Compare
LalitMaganti
force-pushed
the
macos-record-5
branch
from
September 16, 2026 13:22
90b3fec to
4fbe979
Compare
LalitMaganti
force-pushed
the
macos-record-5
branch
2 times, most recently
from
September 16, 2026 13:31
bbd2501 to
d342da5
Compare
LalitMaganti
force-pushed
the
macos-record-5
branch
from
October 18, 2026 02:20
d342da5 to
82f1b97
Compare
LalitMaganti
removed this pull request from stack #32
October 18, 2026 02:40
LalitMaganti
added this pull request to stack #48
October 18, 2026 02:40
This was referenced Oct 18, 2026
LalitMaganti
force-pushed
the
macos-record-5
branch
from
October 18, 2026 02:42
82f1b97 to
8eb7a11
Compare
LalitMaganti
force-pushed
the
macos-record-5
branch
from
October 18, 2026 04:22
8eb7a11 to
48d7780
Compare
LalitMaganti
force-pushed
the
macos-record-5
branch
from
October 18, 2026 04:44
48d7780 to
bc41f53
Compare
LalitMaganti
force-pushed
the
macos-record-5
branch
2 times, most recently
from
October 18, 2026 06:13
e25a613 to
7fecd8b
Compare
LalitMaganti
force-pushed
the
macos-record-5
branch
from
October 18, 2026 06:49
7fecd8b to
52c55ad
Compare
LalitMaganti
force-pushed
the
macos-record-5
branch
2 times, most recently
from
October 18, 2026 06:57
514c37b to
52c55ad
Compare
LalitMaganti
force-pushed
the
macos-record-5
branch
from
October 18, 2026 08:23
52c55ad to
3cfceb1
Compare
The kernel reports the path a lookup ended with. Following a relative symbolic link therefore loses where the lookup started. A read through Homebrew's links or the SDK's link arrives as the text after the link. Resolving that against the process's directory invents a path that does not exist. This adds two recoveries. - The kernel reports a vnode with each lookup. When any process looks a file up by its absolute path, Buildprof remembers that path for the vnode, and a later lookup through a link matches it. For a name that does not exist yet, the vnode identifies the directory instead. A match then also needs the file names to agree. - A link near the root, like /var, points at private/var. Buildprof checks whether the first name exists in the process's directory or at the root. It checks every time, because a build creates and deletes directories as it goes. On a clean cargo build, the share of paths that match what Endpoint Security reports goes from 68% to 83%. On a make build it goes from 64% to 92%.
LalitMaganti
force-pushed
the
macos-record-5
branch
from
October 18, 2026 08:45
3cfceb1 to
c226e8b
Compare
This branch has not been deployed
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.
Summary
Recovers the paths of files opened through a relative symbolic link. Without this, #29 resolves them against the wrong directory.
Fifth of seven steps towards #2. Stacked on #30.
Why
When a lookup follows a relative link, the kernel reports the link's text and the rest of the path. It does not report the directory that holds the link. A read through Homebrew's
../Cellarlinks or the SDK'sMacOSX.sdklink therefore arrives as a path with no starting point. Resolving it against the process's directory produces a path that does not exist.Changes
/var, which points atprivate/var, makes a path continue from the root. Buildprof checks whether the first name exists in the process's directory or at the root. It checks again every time, because a build creates and deletes directories as it goes.Links that no process ever looks up by absolute path are still resolved against the process's directory. #49 records those as unknown instead.
Benchmarks
Share of paths that match what Endpoint Security reports for the same build:
cargo buildmakeWith the whole stack, build outputs, crate sources and project files match 99 to 100% of the time. The paths that still differ are reads of toolchain files.
Testing
Unit tests cover recovering a lookup that restarted at a symbolic link, and resolving one that restarted at a link near the root.