Skip to content

fix: Include failing paths in container lint errors - #2526

Merged
cgwalters merged 1 commit into
bootc-dev:mainfrom
mvanhorn:fix/2469-container-lint-path-errors
Oct 2, 2026
Merged

cgwalters merged 1 commit into
bootc-dev:mainfrom
mvanhorn:fix/2469-container-lint-path-errors

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

try_exists now uses with_context to attach "checking whether {candidate} exists" for the relative path under the image root. The runner returns that same error via e.context, so the outer message is "Unexpected runtime error running lint {name}" and the path context plus the original I/O error stay on err.chain(). bootc container lint aborts the runtime-deps check with "a path led outside of the filesystem" and the message never names the path that escaped. Turning logging up to debug or trace still does not identify it, so a root symlink such as /usr/local pointing at ../../var/usrlocal shows up as a generic lint failure.

No local test ran for crates/lib/src/lints.rs and crates/lib/src/utils.rs: the local Rust test run could not complete in this environment, for reasons outside the diff.

Closes #2469

AI was used for assistance.

`try_exists` now uses `with_context` to attach "checking whether
{candidate} exists" for the relative path under the image root. The
runner returns that same error via `e.context`, so the outer message is
"Unexpected runtime error running lint {name}" and the path context plus
the original I/O error stay on `err.chain()`. Symlinks that remain
inside the root still count as present, and a symlink that leaves the
root still fails. Tests cover an escaping `usr/bin` symlink on the
runtime-deps lint, and present, absent, escaping (`../../var/usrlocal`),
and contained (`../var/usrlocal`) cases for `have_executable_in_root`.

Fixes bootc-dev#2469

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
@bootc-bot
bootc-bot Bot requested a review from jeckersb October 2, 2026 09:29
Comment thread crates/lib/src/utils.rs
if root.try_exists(candidate)? {
if root
.try_exists(candidate)
.with_context(|| format!("checking whether {} exists", candidate.display()))?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nonblocking but we have our own little helper for this to quote file paths in a nicer way we should add to the Rust agent review checklist to use

@cgwalters
cgwalters enabled auto-merge (rebase) October 2, 2026 13:01
@cgwalters
cgwalters merged commit 62d1e4e into bootc-dev:main Oct 2, 2026
145 of 155 checks passed
@mvanhorn

mvanhorn commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Switched that error to bootc_utils::PathQuotedDisplay in 2ac7280.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request for more verbose erroring on bootc container lint

2 participants