mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07: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:
co-authored by
Sylvestre Ledru
parent
b5e0e2342b
commit
d7d0f9da7a
@@ -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!();
|
||||
|
||||
Reference in New Issue
Block a user