diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2024-10-28 15:26:21 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2024-12-09 11:17:14 +0100 |
commit | 87e60dcf0f7ef917b73353d8605188a420bd91f9 (patch) | |
tree | 4bbb50182e3f5dfc077458971933056268a01786 | |
parent | 175b8dda19022f5ca5b81f87248924817e7ea1cf (diff) | |
download | busybox-w32-87e60dcf0f7ef917b73353d8605188a420bd91f9.tar.gz busybox-w32-87e60dcf0f7ef917b73353d8605188a420bd91f9.tar.bz2 busybox-w32-87e60dcf0f7ef917b73353d8605188a420bd91f9.zip |
hexdump: fix regression with -n4 -e '"%u"'
Fix bug introduced in busybox 1.37.0 that broke kernel builds.
Fixes commit e2287f99fe6f (od: for !DESKTOP, match output more closely
to GNU coreutils 9.1, implement -s)
function old new delta
rewrite 967 976 +9
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libbb/dump.c | 6 | ||||
-rwxr-xr-x | testsuite/hexdump.tests | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/libbb/dump.c b/libbb/dump.c index b406a2428..2ca9919da 100644 --- a/libbb/dump.c +++ b/libbb/dump.c | |||
@@ -198,9 +198,11 @@ static NOINLINE void rewrite(priv_dumper_t *dumper, FS *fs) | |||
198 | if (!e) | 198 | if (!e) |
199 | goto DO_BAD_CONV_CHAR; | 199 | goto DO_BAD_CONV_CHAR; |
200 | pr->flags = F_INT; | 200 | pr->flags = F_INT; |
201 | if (e > int_convs + 1) /* not d or i? */ | ||
202 | pr->flags = F_UINT; | ||
203 | byte_count_str = "\010\004\002\001"; | 201 | byte_count_str = "\010\004\002\001"; |
202 | if (e > int_convs + 1) { /* not d or i? */ | ||
203 | pr->flags = F_UINT; | ||
204 | byte_count_str++; | ||
205 | } | ||
204 | goto DO_BYTE_COUNT; | 206 | goto DO_BYTE_COUNT; |
205 | } else | 207 | } else |
206 | if (strchr(int_convs, *p1)) { /* %d etc */ | 208 | if (strchr(int_convs, *p1)) { /* %d etc */ |
diff --git a/testsuite/hexdump.tests b/testsuite/hexdump.tests index be0379cfc..517ec508b 100755 --- a/testsuite/hexdump.tests +++ b/testsuite/hexdump.tests | |||
@@ -82,4 +82,10 @@ testing "hexdump -e /2 %d" \ | |||
82 | "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"\ | 82 | "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"\ |
83 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"\ | 83 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"\ |
84 | 84 | ||
85 | testing "hexdump -n4 -e '\"%u\"'" \ | ||
86 | "hexdump -n4 -e '\"%u\"'" \ | ||
87 | "12345678" \ | ||
88 | "" \ | ||
89 | "\x4e\x61\xbc\x00AAAA" | ||
90 | |||
85 | exit $FAILCOUNT | 91 | exit $FAILCOUNT |