[Toybox] [PATCH] xxd: better error message.
enh
enh at google.com
Tue Aug 29 19:15:49 PDT 2023
`xxd -r` with `-p` format input (rather than the `xxd -r -p` that
you actually need to decode that) doesn't work because the input
isn't in the expected
<address/offset> : <byte...>
format. "real" xxd silently outputs nothing. toybox complains about
an invalid seek.
This patch outputs a clear error if we don't see the leading
address/offset and either ' ' or ':' as a separator (and tests for
both kinds of input).
Looking at the other use of scanf() in this code and testing against
"real" xxd, the fact that toybox allows `-r -i` to parse input
without commas actually matches (undocumented) xxd behavior, so
I've just added a test for that.
Bug: https://github.com/landley/toybox/issues/452
---
tests/xxd.test | 8 ++++++++
toys/other/xxd.c | 8 ++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-xxd-better-error-message.patch
Type: application/octet-stream
Size: 3208 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20230829/089f60aa/attachment.obj>
More information about the Toybox
mailing list