1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

shred: remove unwanted padding in verbose messages

This is tested for in the GNU shred-passes test, so we don't have a
choice if we want to stay compatible.
This commit is contained in:
Ben Wiederhake 2025-04-20 18:28:23 +02:00
parent f92ee6a519
commit af7a939b62
2 changed files with 23 additions and 1 deletions

View file

@ -484,7 +484,7 @@ fn wipe_file(
if verbose { if verbose {
let pass_name = pass_name(&pass_type); let pass_name = pass_name(&pass_type);
show_error!( show_error!(
"{}: pass {:2}/{total_passes} ({pass_name})...", "{}: pass {}/{total_passes} ({pass_name})...",
path.maybe_quote(), path.maybe_quote(),
i + 1, i + 1,
); );

View file

@ -208,3 +208,25 @@ fn test_shred_fail_no_perm() {
.fails() .fails()
.stderr_contains("Couldn't rename to"); .stderr_contains("Couldn't rename to");
} }
#[test]
fn test_shred_verbose_no_padding_1() {
let (at, mut ucmd) = at_and_ucmd!();
let file = "foo";
at.write(file, "non-empty");
ucmd.arg("-vn1")
.arg(file)
.succeeds()
.stderr_only("shred: foo: pass 1/1 (random)...\n");
}
#[test]
fn test_shred_verbose_no_padding_10() {
let (at, mut ucmd) = at_and_ucmd!();
let file = "foo";
at.write(file, "non-empty");
ucmd.arg("-vn10")
.arg(file)
.succeeds()
.stderr_contains("shred: foo: pass 1/10 (random)...\n");
}