summaryrefslogtreecommitdiff
path: root/shell/ash_test/ash-vars
diff options
context:
space:
mode:
authorRon Yorston2016-03-18 11:29:19 +0000
committerMike Frysinger2016-03-22 18:19:29 -0400
commit3e3bfb896e0dd8a54caad9c6264e2452566b4012 (patch)
treecf13a882acb6060341acf3bfa3f9a54c3d7d43cb /shell/ash_test/ash-vars
parent6701e91d84fe499b5d87dc21790cd9d7bcb13220 (diff)
downloadbusybox-3e3bfb896e0dd8a54caad9c6264e2452566b4012.zip
busybox-3e3bfb896e0dd8a54caad9c6264e2452566b4012.tar.gz
ash: fix corruption of ${#var} if $var contains UTF-8 characters
As reported in bug 8506: $ X=abcdÉfghÍjklmnÓpqrstÚvwcyz $ echo ${#X} abcd26 The result should be 26. This regression was introduced by: <d68d1fb> 2015-05-18 [Ron Yorston] ash: code shrink around varvalue The length in characters was being used to discard the contents of the variable instead of the length in bytes. URL: https://bugs.busybox.net/8506 Reported-by: Martijn Dekker <martijn@inlv.org> Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'shell/ash_test/ash-vars')
-rw-r--r--shell/ash_test/ash-vars/var-utf8-length.right1
-rwxr-xr-xshell/ash_test/ash-vars/var-utf8-length.tests2
2 files changed, 3 insertions, 0 deletions
diff --git a/shell/ash_test/ash-vars/var-utf8-length.right b/shell/ash_test/ash-vars/var-utf8-length.right
new file mode 100644
index 0000000..6f4247a
--- /dev/null
+++ b/shell/ash_test/ash-vars/var-utf8-length.right
@@ -0,0 +1 @@
+26
diff --git a/shell/ash_test/ash-vars/var-utf8-length.tests b/shell/ash_test/ash-vars/var-utf8-length.tests
new file mode 100755
index 0000000..d04b2cb
--- /dev/null
+++ b/shell/ash_test/ash-vars/var-utf8-length.tests
@@ -0,0 +1,2 @@
+X=abcdÉfghÍjklmnÓpqrstÚvwcyz
+echo ${#X}