mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
dd: do not show zero multiplier warning when zero is the multiplicand (#11673)
* dd: do not show zero multiplier warning when zero is the multiplicand * tests/dd: test zero multiplier warning when zero is the multiplicand
This commit is contained in:
@@ -524,8 +524,8 @@ pub fn parse_bytes_with_opt_multiplier(s: &str) -> Result<u64, ParseError> {
|
||||
parse_bytes_no_x(s, parts[0])
|
||||
} else {
|
||||
let mut total: u64 = 1;
|
||||
for part in parts {
|
||||
if part == "0" {
|
||||
for (i, part) in parts.iter().enumerate() {
|
||||
if *part == "0" && i != parts.len() - 1 {
|
||||
show_zero_multiplier_warning();
|
||||
}
|
||||
let num = parse_bytes_no_x(s, part)?;
|
||||
|
||||
@@ -263,6 +263,13 @@ fn test_zero_multiplier_warning() {
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.stderr_contains("warning: '0x' is a zero multiplier; use '00x' if that is intended");
|
||||
|
||||
new_ucmd!()
|
||||
.args(&[format!("{arg}=0x0x0").as_str(), "status=none"])
|
||||
.pipe_in("")
|
||||
.succeeds()
|
||||
.no_stdout()
|
||||
.stderr_is("dd: warning: '0x' is a zero multiplier; use '00x' if that is intended\ndd: warning: '0x' is a zero multiplier; use '00x' if that is intended\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user