Skip to content

lib: Deny (e)println! in bootc-lib, routing status output via ProgressWriter - #63

Draft
cgwalters-bot wants to merge 1 commit into
cgwalters-forge:mainfrom
cgwalters-bot:dispatch/implement/agent-run-41165532659
Draft

cgwalters-bot wants to merge 1 commit into
cgwalters-forge:mainfrom
cgwalters-bot:dispatch/implement/agent-run-41165532659

Conversation

@cgwalters-bot

Copy link
Copy Markdown
Collaborator

Library code printing directly to stdout/stderr bypasses --progress-fd and can corrupt machine-readable output, so this denies clippy::print_stdout and print_stderr (and anstream's print macros) in bootc-lib. User-facing status output now goes through ProgressWriter, which prints it as before and, when a progress fd is attached, also sends it as a new generic Message event (protocol 0.2.0). A command's actual results go to an explicit stdout writer. Output without --progress-fd is byte-for-byte unchanged.

This is the series from #1 rebased onto current main, which includes bootc-dev#2449, and supersedes #1. It also converts the prints that landed since #1's base: the UKI addon CLI, the global addon removal notice in the composefs update path, and bootc usroverlay. The two eprintln! calls bootc-dev#2449 added in delta_ostree.rs are in tests, which the clippy.toml allow-print-in-tests setting covers. The fsck commit from #1 dropped out because main already writes passing checks to the provided output. Two pre-existing str::len disallowed-method hits in test code (ostree-ext fixture.rs, a deploy.rs test) are fixed so cargo clippy --all-targets passes.

The issue asked to keep the series as small commits. This run hands back a single patch, so it lands as one commit. #1's branch keeps the per-commit split for reference.

Verified with cargo fmt --check, cargo clippy -p bootc-lib --all-targets (default lints and the Makefile's CLIPPY_CONFIG), cargo test -p bootc-lib (333 passed), and cargo check --workspace --all-targets. The tmt test change was not run.

Review: one pass, no blockers. Follow-ups it left open:

  • Writes to the progress fd now block, which stalls the current-thread runtime, pull included, if the reader stops draining it. Consider a writer thread.
  • With a closed stdout, message() ignores the write error where println! panicked, so that edge case now exits 0 instead of 101.
  • install_container still uses ProgressWriter::default() for PullProgress instead of state.prog.
  • The progress-fd man page says status messages are "also sent" as Message events. Spinner text and pull step descriptions are not sent.
  • No test checks the bytes message() writes to stdout/stderr.

Closes #61

Generated by dispatch · ◷

…sWriter

Library code printing directly to stdout/stderr bypasses --progress-fd and can corrupt machine-readable output, so this denies clippy::print_stdout and print_stderr (and anstream's print macros) in bootc-lib. User-facing status output now goes through ProgressWriter, which prints it as before and, when a progress fd is attached, also sends it as a new generic `Message` event (protocol 0.2.0). A command's actual results go to an explicit stdout writer. Output without --progress-fd is byte-for-byte unchanged.

This is the series from #1 rebased onto current main, which includes bootc-dev#2449, and supersedes #1. It also converts the prints that landed since #1's base: the UKI addon CLI, the global addon removal notice in the composefs update path, and `bootc usroverlay`. The two `eprintln!` calls bootc-dev#2449 added in delta_ostree.rs are in tests, which the clippy.toml `allow-print-in-tests` setting covers. The fsck commit from #1 dropped out because main already writes passing checks to the provided output. Two pre-existing `str::len` disallowed-method hits in test code (ostree-ext fixture.rs, a deploy.rs test) are fixed so `cargo clippy --all-targets` passes.

The issue asked to keep the series as small commits. This run hands back a single patch, so it lands as one commit. #1's branch keeps the per-commit split for reference.

Verified with cargo fmt --check, cargo clippy -p bootc-lib --all-targets (default lints and the Makefile's CLIPPY_CONFIG), cargo test -p bootc-lib (333 passed), and cargo check --workspace --all-targets. The tmt test change was not run.

Review: one pass, no blockers. Follow-ups it left open:
- Writes to the progress fd now block, which stalls the current-thread runtime, pull included, if the reader stops draining it. Consider a writer thread.
- With a closed stdout, `message()` ignores the write error where `println!` panicked, so that edge case now exits 0 instead of 101.
- install_container still uses ProgressWriter::default() for PullProgress instead of state.prog.
- The progress-fd man page says status messages are "also sent" as Message events. Spinner text and pull step descriptions are not sent.
- No test checks the bytes `message()` writes to stdout/stderr.

Generated-by: https://github.com/cgwalters/#llms
@cgwalters-bot cgwalters-bot added the needs-human The poll stopped here; a person decides what is next label Oct 31, 2026
@cgwalters-bot

Copy link
Copy Markdown
Collaborator Author

The poll stopped following this pull request: a draft with no checkpoint; mark it ready if the work is complete. It is labelled needs-human; remove the label to have the poll start again on it, with fresh fix rounds.

Generated-by: https://github.com/cgwalters/#llms

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

Labels

needs-human The poll stopped here; a person decides what is next

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant