-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
od: allow trailing characters in address radix #6674
od: allow trailing characters in address radix #6674
Conversation
882677b
to
6be3464
Compare
tests/by-util/test_od.rs
Outdated
.arg("-Anone") | ||
.run_piped_stdin(input) | ||
.success() | ||
.stderr_is("od: warning: Ignored superfluous character(s) after radix specifier 'n'\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you expect a warning? GNU od
doesn't seem to show a warning:
$ cat input.bin | od -Anone
000000 000000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I did not know that level of compatibility was the goal. I've removed the warning.
src/uu/od/src/od.rs
Outdated
0 => { | ||
return Err(USimpleError::new( | ||
1, | ||
"Radix must be one of [d, o, n, x]".to_string(), | ||
)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unreachable code because this case is caught by clap:
$ cat input.bin | cargo run -q od -A
error: a value is required for '--address-radix <RADIX>' but none was supplied
So I would use something like:
0 => unreachable!("should be caught by clap"),
6be3464
to
61e4bba
Compare
61e4bba
to
5ca995b
Compare
Thanks for your PR! |
POSIX only specifies the characters 'd', 'o', 'x', and 'n' as valid `od -A` argument values. [1] Pedantic implementations of `od` may expect the argument value to be a single character instead of ignoring these extra characters. [2] [1] https://pubs.opengroup.org/onlinepubs/9799919799/utilities/od.html [2] uutils/coreutils#6674
No description provided.