mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
shred: correctly print zero-byte pass in verbose mode (#7800)
Fixes #7798. Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
This commit is contained in:
parent
b5e0e2342b
commit
d7d0f9da7a
2 changed files with 13 additions and 2 deletions
|
@ -376,8 +376,8 @@ fn get_size(size_str_opt: Option<String>) -> Option<u64> {
|
|||
fn pass_name(pass_type: &PassType) -> String {
|
||||
match pass_type {
|
||||
PassType::Random => String::from("random"),
|
||||
PassType::Pattern(Pattern::Single(byte)) => format!("{byte:x}{byte:x}{byte:x}"),
|
||||
PassType::Pattern(Pattern::Multi([a, b, c])) => format!("{a:x}{b:x}{c:x}"),
|
||||
PassType::Pattern(Pattern::Single(byte)) => format!("{byte:02x}{byte:02x}{byte:02x}"),
|
||||
PassType::Pattern(Pattern::Multi([a, b, c])) => format!("{a:02x}{b:02x}{c:02x}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -209,6 +209,17 @@ fn test_shred_fail_no_perm() {
|
|||
.stderr_contains("Couldn't rename to");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_shred_verbose_pass_single_0_byte_name() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let file = "foo";
|
||||
at.write(file, "non-empty");
|
||||
ucmd.arg("-vn200")
|
||||
.arg(file)
|
||||
.succeeds()
|
||||
.stderr_contains("/200 (000000)...\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_shred_verbose_no_padding_1() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue