[openwrt/openwrt] busybox: Fix hexdump applet

LEDE Commits lede-commits at lists.infradead.org
Fri Dec 20 10:54:41 PST 2024


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/69582e71fabfb42aa2842d24eecb1f4392048404

commit 69582e71fabfb42aa2842d24eecb1f4392048404
Author: Hannu Nyman <hannu.nyman at iki.fi>
AuthorDate: Thu Dec 19 20:45:40 2024 +0200

    busybox: Fix hexdump applet
    
    Fix the hexdump applet's formatting with certain format types
    by applying the upstream fix for 1.37.0.
    
    Also refresh patches.
    
    Signed-off-by: Hannu Nyman <hannu.nyman at iki.fi>
    Link: https://github.com/openwrt/openwrt/pull/17308
    [Changed to 002- patch file name prefix]
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/utils/busybox/Makefile                     |  2 +-
 .../busybox/patches/001-fix-non-x86-build.patch    |  6 +--
 .../busybox/patches/002-upstream-fix-hexdump.patch | 49 ++++++++++++++++++++++
 3 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index c2fc609610..cda3be9f2f 100644
--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=busybox
 PKG_VERSION:=1.37.0
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 PKG_FLAGS:=essential
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
diff --git a/package/utils/busybox/patches/001-fix-non-x86-build.patch b/package/utils/busybox/patches/001-fix-non-x86-build.patch
index b33ec98bf2..7a47292474 100644
--- a/package/utils/busybox/patches/001-fix-non-x86-build.patch
+++ b/package/utils/busybox/patches/001-fix-non-x86-build.patch
@@ -1,7 +1,5 @@
-Index: busybox-1.37.0/libbb/hash_md5_sha.c
-===================================================================
---- busybox-1.37.0.orig/libbb/hash_md5_sha.c
-+++ busybox-1.37.0/libbb/hash_md5_sha.c
+--- a/libbb/hash_md5_sha.c
++++ b/libbb/hash_md5_sha.c
 @@ -1313,7 +1313,9 @@ unsigned FAST_FUNC sha1_end(sha1_ctx_t *
  	hash_size = 8;
  	if (ctx->process_block == sha1_process_block64
diff --git a/package/utils/busybox/patches/002-upstream-fix-hexdump.patch b/package/utils/busybox/patches/002-upstream-fix-hexdump.patch
new file mode 100644
index 0000000000..a123fe3a5f
--- /dev/null
+++ b/package/utils/busybox/patches/002-upstream-fix-hexdump.patch
@@ -0,0 +1,49 @@
+From 87e60dcf0f7ef917b73353d8605188a420bd91f9 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa at alpinelinux.org>
+Date: Mon, 28 Oct 2024 15:26:21 +0100
+Subject: 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 at alpinelinux.org>
+Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
+---
+ libbb/dump.c            | 6 ++++--
+ testsuite/hexdump.tests | 6 ++++++
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+--- a/libbb/dump.c
++++ b/libbb/dump.c
+@@ -198,9 +198,11 @@ static NOINLINE void rewrite(priv_dumper
+ 				if (!e)
+ 					goto DO_BAD_CONV_CHAR;
+ 				pr->flags = F_INT;
+-				if (e > int_convs + 1) /* not d or i? */
+-					pr->flags = F_UINT;
+ 				byte_count_str = "\010\004\002\001";
++				if (e > int_convs + 1) { /* not d or i? */
++					pr->flags = F_UINT;
++					byte_count_str++;
++				}
+ 				goto DO_BYTE_COUNT;
+ 			} else
+ 			if (strchr(int_convs, *p1)) { /* %d etc */
+--- a/testsuite/hexdump.tests
++++ b/testsuite/hexdump.tests
+@@ -82,4 +82,10 @@ testing "hexdump -e /2 %d" \
+ "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"\
+ "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"\
+ 
++testing "hexdump -n4 -e '\"%u\"'" \
++	"hexdump -n4 -e '\"%u\"'" \
++	"12345678" \
++	"" \
++	"\x4e\x61\xbc\x00AAAA"
++
+ exit $FAILCOUNT




More information about the lede-commits mailing list