Skip to contentSkip to conversation

busybox: Make high ASCII chars printable

PATCH In review Nikhil R 4 participants 4 messages Mar 29, 2023 – Mar 30, 2023

lore
Share & tools
lore

Nikhil R

author
#0 lore raw

PATCH 1/1 busybox: Make high ASCII chars printable

Currently busybox utilty "ls" fails to display filenames contains UTF-8 characters and replaces with "?".

Steps to reproduce:
bin/busybox touch utf_test-Ü
bin/busybox ls utf_test-* > sample.log
bin/busybox cat sample.log
utf_test-??
bin/busybox hexdump -C sample.log | grep "c3 9c"

Therefore, above hexdump command is unable to find matching hex value for the umlaute character.
Hence, change the libbb's printable_string() function to allow high ASCII characters so that unicode filenames are displayed correctly. This issue is not observed in upstream busybox.

---
 .../270-libbb_make_unicode_printable.patch    | 39 +++++++++++++++++++
 meta/recipes-core/busybox/busybox_1.31.1.bb   |  1 +
 2 files changed, 40 insertions(+)
 create mode 100644 meta/recipes-core/busybox/busybox/270-libbb_make_unicode_printable.patch
meta/recipes-core/busybox/busybox/270-libbb_make_unicode_printable.patch new file +39 -0
new file mode 100644
index 0000000000..001d2847fe
@@ -0,0 +1,39 @@
+busybox: make high ASCII chars printable (#7993)
+
+Currently busybox utils like "ls" fail to display filenames containing UTF-8
+characters, replacing any special characters with "?".
+
+Change libbb's printable_string() function to allow high ASCII characters so
+that unicode filenames are displayed correctls.
+
+Signed-off-by: Jo-Philipp Wich <[email protected]>
+Upstream-Status: Pending [https://git.openwrt.org/?p=openwrt/svn-archive/archive.git;a=patch;h=bbca780ca657d894fc457cac8eaaaec9d414bfc8]
+
+SVN-Revision: 43084
+---
+ .../270-libbb_make_unicode_printable.patch    | 20 +++++++++++++++++++
+ create mode 100644 package/utils/busybox/patches/270-libbb_make_unicode_printable.patch
+
+diff --git a/package/utils/busybox/patches/270-libbb_make_unicode_printable.patch b/package/utils/busybox/patches/270-libbb_make_unicode_printable.patch
+--- a/libbb/printable_string.c
++++ b/libbb/printable_string.c
+@@ -28,8 +28,6 @@
+ 		}
+ 		if (c < ' ')
+ 			break;
+-		if (c >= 0x7f)
+-			break;
+ 		s++;
+ 	}
+ 
+@@ -42,7 +40,7 @@
+ 			unsigned char c = *d;
+ 			if (c == '\0')
+ 				break;
+-			if (c < ' ' || c >= 0x7f)
++                        if (c < ' ')
+ 				*d = '?';
+ 			d++;
+ 		}
+--
+2.20.1
meta/recipes-core/busybox/busybox_1.31.1.bb +1 -0
index d062f0f7dd..3e0d888b05 100644
@@ -57,6 +57,7 @@ SRC_URI = "https://busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://CVE-2021-423xx-awk.patch \
            file://0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch \
            file://0002-nslookup-sanitize-all-printed-strings-with-printable.patch \
+           file://270-libbb_make_unicode_printable.patch \
            "
 SRC_URI_append_libc-musl = " file://musl.cfg "
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 32 lines · nikhil

Currently busybox utilty "ls" fails to display filenames contains UTF-8 characters and replaces with "?".

Steps to reproduce:
bin/busybox touch utf_test-Ü
bin/busybox ls utf_test-* > sample.log
bin/busybox cat sample.log
utf_test-??
bin/busybox hexdump -C sample.log | grep "c3 9c"

Therefore, above hexdump command is unable to find matching hex value for the umlaute character.
Hence, change the libbb's printable_string() function to allow high ASCII characters so that unicode filenames are displayed correctly. This issue is not observed in upstream busybox.

---
 .../270-libbb_make_unicode_printable.patch    | 39 +++++++++++++++++++
 meta/recipes-core/busybox/busybox_1.31.1.bb   |  1 +
 2 files changed, 40 insertions(+)
 create mode 100644 meta/recipes-core/busybox/busybox/270-libbb_make_unicode_printable.patch
meta/recipes-core/busybox/busybox/270-libbb_make_unicode_printable.patch new file +1 -0
new file mode 100644
index 0000000000..001d2847fe
@@ -0,0 +1,39 @@
+busybox: make high ASCII chars printable (#7993)

meta/recipes-core/busybox/busybox/270-libbb_make_unicode_printable.patch line 11

Quoted 10 lines
meta/recipes-core/busybox/busybox/270-libbb_make_unicode_printable.patch new file +10 -0
+
+Currently busybox utils like "ls" fail to display filenames containing UTF-8
+characters, replacing any special characters with "?".
+
+Change libbb's printable_string() function to allow high ASCII characters so
+that unicode filenames are displayed correctls.
+
+Signed-off-by: Jo-Philipp Wich <[email protected]>
+Upstream-Status: Pending [https://git.openwrt.org/?p=openwrt/svn-archive/archive.git;a=patch;h=bbca780ca657d894fc457cac8eaaaec9d414bfc8]
+

Has the patch been submitted to busybox? The upstream we refer to here is really busybox. The link to openwrt is helpful but we should limit to any submission to busybox itself for the purposes of upstream- status.

Cheers,

Richard

#2 lore raw
Quoted 41 lines · Richard Purdie
Quoted 39 lines · nikhil

Currently busybox utilty "ls" fails to display filenames contains UTF-8 characters and replaces with "?".

Steps to reproduce:
bin/busybox touch utf_test-Ü
bin/busybox ls utf_test-* > sample.log
bin/busybox cat sample.log
utf_test-??
bin/busybox hexdump -C sample.log | grep "c3 9c"

Therefore, above hexdump command is unable to find matching hex value for the umlaute character.
Hence, change the libbb's printable_string() function to allow high ASCII characters so that unicode filenames are displayed correctly. This issue is not observed in upstream busybox.

---
 .../270-libbb_make_unicode_printable.patch    | 39 +++++++++++++++++++
 meta/recipes-core/busybox/busybox_1.31.1.bb   |  1 +
 2 files changed, 40 insertions(+)
 create mode 100644 meta/recipes-core/busybox/busybox/270-libbb_make_unicode_printable.patch
meta/recipes-core/busybox/busybox/270-libbb_make_unicode_printable.patch new file +8 -0
new file mode 100644
index 0000000000..001d2847fe
@@ -0,0 +1,39 @@
+busybox: make high ASCII chars printable (#7993)
+
+Currently busybox utils like "ls" fail to display filenames containing UTF-8
+characters, replacing any special characters with "?".
+
+Change libbb's printable_string() function to allow high ASCII characters so
+that unicode filenames are displayed correctls.
+
Quoted 8 lines

meta/recipes-core/busybox/busybox/270-libbb_make_unicode_printable.patch line 11

Quoted 3 lines
meta/recipes-core/busybox/busybox/270-libbb_make_unicode_printable.patch new file +3 -0
+Signed-off-by: Jo-Philipp Wich <[email protected]>
+Upstream-Status: Pending [https://git.openwrt.org/?p=openwrt/svn-archive/archive.git;a=patch;h=bbca780ca657d894fc457cac8eaaaec9d414bfc8]
+

Has the patch been submitted to busybox? The upstream we refer to here is really busybox. The link to openwrt is helpful but we should limit to any submission to busybox itself for the purposes of upstream- status.

yeah I think its worth a discussion on busybox ml.

Quoted 14 lines

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#179264): https://lists.openembedded.org/g/openembedded-core/message/179264
Mute This Topic: https://lists.openembedded.org/mt/97923178/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
In reply to Nikhil R

Hi Nikhil,

Quoted 16 lines · nikhil

Currently busybox utilty "ls" fails to display filenames contains UTF-8 characters and replaces with "?".

Steps to reproduce:
bin/busybox touch utf_test-Ü
bin/busybox ls utf_test-* > sample.log
bin/busybox cat sample.log
utf_test-??
bin/busybox hexdump -C sample.log | grep "c3 9c"

Therefore, above hexdump command is unable to find matching hex value for the umlaute character.
Hence, change the libbb's printable_string() function to allow high ASCII characters so that unicode filenames are displayed correctly. This issue is not observed in upstream busybox.

Quoted 8 lines
---
  .../270-libbb_make_unicode_printable.patch    | 39 +++++++++++++++++++
  meta/recipes-core/busybox/busybox_1.31.1.bb   |  1 +
  2 files changed, 40 insertions(+)

create mode 100644 meta/recipes-core/busybox/busybox/270-libbb_make_unicode_printable.patch

Thanks for the patch!

There's an issue with your e-mail identity. You should add one thing to your git configuration, so that your patches are given an "Author" field which matches your "Signed-off-by" information. See https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded#Fixing_your_From_identity for details.

Thanks in advance
Cheers
Michael.

Signature · 3 lines
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com