From a23555e857e89f1cd7a9c08429886b102e95f01a Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Thu, 20 May 2021 23:19:58 -0400 Subject: [PATCH] truncate: fix character used to indicate round up Fix a bug in which the incorrect character was being used to indicate "round up to the nearest multiple" mode. The character was "*" but it should be "%". This commit corrects that. --- src/uu/truncate/src/truncate.rs | 2 +- tests/by-util/test_truncate.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/truncate/src/truncate.rs b/src/uu/truncate/src/truncate.rs index 3190e6ad4..7537987e0 100644 --- a/src/uu/truncate/src/truncate.rs +++ b/src/uu/truncate/src/truncate.rs @@ -147,7 +147,7 @@ fn truncate( '<' => TruncateMode::AtMost, '>' => TruncateMode::AtLeast, '/' => TruncateMode::RoundDown, - '*' => TruncateMode::RoundUp, + '%' => TruncateMode::RoundUp, _ => TruncateMode::Absolute, /* assume that the size is just a number */ }; diff --git a/tests/by-util/test_truncate.rs b/tests/by-util/test_truncate.rs index b1f806f82..7fa3df98c 100644 --- a/tests/by-util/test_truncate.rs +++ b/tests/by-util/test_truncate.rs @@ -206,7 +206,7 @@ fn test_round_up() { let (at, mut ucmd) = at_and_ucmd!(); let mut file = at.make_file(TFILE2); file.write_all(b"1234567890").unwrap(); - ucmd.args(&["--size", "*4", TFILE2]).succeeds(); + ucmd.args(&["--size", "%4", TFILE2]).succeeds(); file.seek(SeekFrom::End(0)).unwrap(); let actual = file.seek(SeekFrom::Current(0)).unwrap(); assert!(