[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Please add hotfix for bug 8506
From:       Martijn Dekker <martijn () inlv ! org>
Date:       2016-05-07 20:50:12
Message-ID: acad1072-cf95-2668-6d9b-c06190717dff () inlv ! org
[Download RAW message or body]

Bug 8506 is a severe ash bug for shell scripts running in UTF-8 locales 
causing corrupted output of ${#var} if $var contains UTF-8 characters. 
It is fixed in git but not in the latest release version. So, as per 
https://busybox.net/fix.html I propose to add the attached patch as a 
hotfix to https://busybox.net/downloads/fixes-1.24.2/ .

References:
https://bugs.busybox.net/show_bug.cgi?id=8506
https://git.busybox.net/busybox/commit/?id=3e3bfb896e0dd8a54caad9c6264e2452566b4012

Thanks,

- M.


["busybox-1.24.2-ash-utf8-varlength.patch" (text/x-patch)]

diff -uNr busybox-1.24.2.orig/shell/ash.c busybox-1.24.2/shell/ash.c
--- busybox-1.24.2.orig/shell/ash.c	2016-03-17 21:35:49.000000000 +0100
+++ busybox-1.24.2/shell/ash.c	2016-05-07 18:22:40.095594629 +0200
@@ -6693,6 +6693,8 @@
 		if (subtype == VSLENGTH && len > 0) {
 			reinit_unicode_for_ash();
 			if (unicode_status == UNICODE_ON) {
+				STADJUST(-len, expdest);
+				discard = 0;
 				len = unicode_strlen(p);
 			}
 		}
diff -uNr busybox-1.24.2.orig/shell/ash_test/ash-vars/var-utf8-length.right \
                busybox-1.24.2/shell/ash_test/ash-vars/var-utf8-length.right
--- busybox-1.24.2.orig/shell/ash_test/ash-vars/var-utf8-length.right	1970-01-01 \
                01:00:00.000000000 +0100
+++ busybox-1.24.2/shell/ash_test/ash-vars/var-utf8-length.right	2016-05-07 \
18:22:40.095594629 +0200 @@ -0,0 +1 @@
+26
diff -uNr busybox-1.24.2.orig/shell/ash_test/ash-vars/var-utf8-length.tests \
                busybox-1.24.2/shell/ash_test/ash-vars/var-utf8-length.tests
--- busybox-1.24.2.orig/shell/ash_test/ash-vars/var-utf8-length.tests	1970-01-01 \
                01:00:00.000000000 +0100
+++ busybox-1.24.2/shell/ash_test/ash-vars/var-utf8-length.tests	2016-05-07 \
18:22:40.095594629 +0200 @@ -0,0 +1,2 @@
+X=abcdÉfghÍjklmnÓpqrstÚvwcyz
+echo ${#X}



_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic