Skip to content

lints: Add --no-truncate flag to bootc container lint #1324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ pub(crate) enum ContainerOpts {
/// Example: --skip nonempty-boot --skip baseimage-root
#[clap(long)]
skip: Vec<String>,

/// Don't truncate the output. By default, only a limited number of entries are
/// shown for each lint, followed by a count of remaining entries.
#[clap(long)]
no_truncate: bool,
},
}

Expand Down Expand Up @@ -1095,6 +1100,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
fatal_warnings,
list,
skip,
no_truncate,
} => {
if list {
return lints::lint_list(std::io::stdout().lock());
Expand All @@ -1112,7 +1118,14 @@ async fn run_from_opt(opt: Opt) -> Result<()> {

let root = &Dir::open_ambient_dir(rootfs, cap_std::ambient_authority())?;
let skip = skip.iter().map(|s| s.as_str());
lints::lint(root, warnings, root_type, skip, std::io::stdout().lock())?;
lints::lint(
root,
warnings,
root_type,
skip,
std::io::stdout().lock(),
no_truncate,
)?;
Ok(())
}
},
Expand Down
10 changes: 6 additions & 4 deletions lib/src/fsck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@

use std::fmt::Write as _;
use std::future::Future;
use std::num::NonZeroUsize;
use std::pin::Pin;

use bootc_utils::iterator_split_nonempty_rest_count;
use bootc_utils::collect_until;
use camino::Utf8PathBuf;
use cap_std::fs::{Dir, MetadataExt as _};
use cap_std_ext::cap_std;
Expand Down Expand Up @@ -250,9 +251,10 @@ async fn check_fsverity_inner(storage: &Storage) -> FsckResult {
let verity_found_state =
verity_state_of_all_objects(&storage.repo(), verity_state.desired == Tristate::Enabled)
.await?;
let Some((missing, rest)) =
iterator_split_nonempty_rest_count(verity_found_state.missing.iter(), 5)
else {
let Some((missing, rest)) = collect_until(
verity_found_state.missing.iter(),
const { NonZeroUsize::new(5).unwrap() },
) else {
return fsck_ok();
};
let mut err = String::from("fsverity enabled, but objects without fsverity:\n");
Expand Down
Loading