Skip to content

Commit 51123ab

Browse files
authored
Merge pull request #1324 from cgwalters/lint-truncate
lints: Add --no-truncate flag to bootc container lint
2 parents 2445e8d + 840a235 commit 51123ab

File tree

5 files changed

+369
-173
lines changed

5 files changed

+369
-173
lines changed

lib/src/cli.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ pub(crate) enum ContainerOpts {
279279
/// Example: --skip nonempty-boot --skip baseimage-root
280280
#[clap(long)]
281281
skip: Vec<String>,
282+
283+
/// Don't truncate the output. By default, only a limited number of entries are
284+
/// shown for each lint, followed by a count of remaining entries.
285+
#[clap(long)]
286+
no_truncate: bool,
282287
},
283288
}
284289

@@ -1097,6 +1102,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
10971102
fatal_warnings,
10981103
list,
10991104
skip,
1105+
no_truncate,
11001106
} => {
11011107
if list {
11021108
return lints::lint_list(std::io::stdout().lock());
@@ -1114,7 +1120,14 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
11141120

11151121
let root = &Dir::open_ambient_dir(rootfs, cap_std::ambient_authority())?;
11161122
let skip = skip.iter().map(|s| s.as_str());
1117-
lints::lint(root, warnings, root_type, skip, std::io::stdout().lock())?;
1123+
lints::lint(
1124+
root,
1125+
warnings,
1126+
root_type,
1127+
skip,
1128+
std::io::stdout().lock(),
1129+
no_truncate,
1130+
)?;
11181131
Ok(())
11191132
}
11201133
},

lib/src/fsck.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88

99
use std::fmt::Write as _;
1010
use std::future::Future;
11+
use std::num::NonZeroUsize;
1112
use std::pin::Pin;
1213

13-
use bootc_utils::iterator_split_nonempty_rest_count;
14+
use bootc_utils::collect_until;
1415
use camino::Utf8PathBuf;
1516
use cap_std::fs::{Dir, MetadataExt as _};
1617
use cap_std_ext::cap_std;
@@ -250,9 +251,10 @@ async fn check_fsverity_inner(storage: &Storage) -> FsckResult {
250251
let verity_found_state =
251252
verity_state_of_all_objects(&storage.repo(), verity_state.desired == Tristate::Enabled)
252253
.await?;
253-
let Some((missing, rest)) =
254-
iterator_split_nonempty_rest_count(verity_found_state.missing.iter(), 5)
255-
else {
254+
let Some((missing, rest)) = collect_until(
255+
verity_found_state.missing.iter(),
256+
const { NonZeroUsize::new(5).unwrap() },
257+
) else {
256258
return fsck_ok();
257259
};
258260
let mut err = String::from("fsverity enabled, but objects without fsverity:\n");

0 commit comments

Comments
 (0)