Repository navigation
fix: end a symlink loop in the glob walk and print cache errors once - #3109
Merged
Merged
Conversation
match_files_for_glob follows symlinked directories, and op's subset copy needs that: a file under usr/lib64 -> lib is copied at both paths. Nothing stopped a link back to a directory the walk was inside, so loop -> . with bin/up -> .. doubled the walk at each level up to the kernel's 40-link limit. The walk now keeps the device and inode of each directory from the root down and does not enter a link to one of them; a link elsewhere is still walked. The test checks both: the lib64 path is kept and the two-link loop ends with three files. Raised in review on #2652. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
op::Error::Cache and orchestrator::Error::Cache put the CacheErr in their message and, through
#[from], also returned it as source(), so {:#} printed "cache error: not found: not found".
The message keeps the cause for callers that print with {}, a hand-written From replaces
#[from], and source() is None. Nothing downcasts to CacheErr; the variant matches in check and
orchestrator are unchanged. Raised in review on #2652.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
bryan-minimal
marked this pull request as ready for review
November 13, 2026 04:48
Contributor
|
Approved: no findings at Nothing to do. Clobber: none seen. |
…cache-error # Conflicts: # crates/common/src/lib.rs
norrietaylor
approved these changes
Nov 13, 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.
Summary
Two pre-existing defects that Norrie (norrietaylor) noted in his approval of #2652. He listed them as "Known and not raised again", and they were kept out of that PR so its approved diff did not change.
The glob walk no longer loops (
crates/common/src/lib.rs).common::match_files_for_globfollows symlinked directories. op's subset copy (crates/op/src/subsets.rs) relies on that: a file underusr/lib64 -> libis copied at both paths. Nothing stopped a link back to a directory the walk was already inside. An output withloop -> .andbin/up -> ..doubled the walk at each level, up to the kernel's 40-link limit. The walk now keeps the device and inode of each directory from the root down to where it is, and does not enter a link that points back to one of them. A link to a directory elsewhere is still followed. As Norrie asked, thelib64/foopaths the subset copy takes today are kept. On main the check cache uses the same walk, sooutput types valid,missing runtime_depsand the library lookup also stop looping; #2652 moves those to a walk that follows no links.A cache error prints its cause once (
crates/op/src/error.rs,crates/orchestrator/src/error.rs).Cache(#[from] CacheErr)put the error in the message and also returned it assource(), so{:#}printedcache error: not found: not found.StandaloneTestCheckreaches this through check'sError::Other. The message keeps the cause, because most callers print with{}. A hand-writtenFromreplaces#[from], andsource()isNone. Nothing downcasts toCacheErr. #2652 makes the same choice forCacheErritself.Not in this PR
The same
#[from]shape makesIOandSandboxinop::Errorandorchestrator::Errorprint their cause twice under{:#}. So do orchestrator'sBuildFailed({1}plus#[source]), bothPlanvariants and common'sFileCacheError. Droppingsource()there is not purely cosmetic:minimal/src/main.rs:314,minimal/src/diag/collect.rs:883andminimald/src/diag.rs:901walk error chains looking for anio::Error. Each path into those walkers needs checking first, so that is a separate change.Order with #2652
Both PRs change
match_files_for_glob's inner walk, so whichever merges second needs a small rebase there. #2652 is approved, so this PR goes after it.Testing
common: one tree withusr/lib64 -> lib,loop -> .andbin/up -> ..yields exactlybin/ 8000 x,usr/lib/libfoo.so.1andusr/lib64/libfoo.so.1. The old walk returns far more.op,orchestrator:Cache(NotFound)has no source and printsreading foo: cache error: not found. This covers one made in orchestrator and one converted from op.PREPUSH: PASSED (8 steps)).🤖 Generated with Claude Code
Summary by CodeRabbit