od: allow trailing characters in address radix#6674
Merged
cakebaker merged 1 commit intouutils:mainfrom Sep 1, 2024
Merged
Conversation
882677b to
6be3464
Compare
cakebaker
reviewed
Aug 31, 2024
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") |
Contributor
There was a problem hiding this comment.
Why do you expect a warning? GNU od doesn't seem to show a warning:
$ cat input.bin | od -Anone
000000 000000
Contributor
Author
There was a problem hiding this comment.
Thanks, I did not know that level of compatibility was the goal. I've removed the warning.
cakebaker
reviewed
Aug 31, 2024
src/uu/od/src/od.rs
Outdated
Comment on lines
+180
to
+185
| 0 => { | ||
| return Err(USimpleError::new( | ||
| 1, | ||
| "Radix must be one of [d, o, n, x]".to_string(), | ||
| )); | ||
| } |
Contributor
There was a problem hiding this comment.
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
Contributor
|
Thanks for your PR! |
andrewliebenow
added a commit
to andrewliebenow/toybox
that referenced
this pull request
Sep 8, 2024
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.