'case' UTF-8 bug
Denys Vlasenko
vda.linux at googlemail.com
Wed Nov 23 23:14:00 UTC 2016
On Wed, Nov 23, 2016 at 6:52 PM, Martijn Dekker <martijn at inlv.org> wrote:
> busybox ash in UTF-8 locale does not like the lowercase Greek letter
> 'rho' (CF 81) in a case statement.
>
> case "ρ" in
> ( "ρ" ) echo ok ;;
> ( * ) echo WRONG ;;
> esac
>
> outputs WRONG.
>
> The preceding character π (CF 80) is fine, but the succeeding one ς (CF
> 82) is not. There are other characters with this effect as well but I
> haven't had time to test them. I may follow up if I find the time and
> detect a pattern.
>
> This is serious; it means 'case' cannot compare arbitrary UTF-8 strings.
>
> Behaviour confirmed in busybox ash version 1.25.0, 1.24.2, 1.24.1,
> 1.23.2 and 1.20.0, with ash compiled as a standalone on Linux.
Can't reproduce:
$ cat z
case "π" in
( "π" ) echo ok ;;
( * ) echo WRONG ;;
esac
case "ρ" in
( "ρ" ) echo ok ;;
( * ) echo WRONG ;;
esac
case "ς" in
( "ς" ) echo ok ;;
( * ) echo WRONG ;;
esac
$ ash --help 2>&1 | head -1
BusyBox v1.22.1 (2014-02-01 19:25:19 CET) multi-call binary.
$ ash z
ok
ok
ok
$ ./busybox ash --help 2>&1 | head -1
BusyBox v1.26.0.git (2016-11-23 06:40:57 CET) multi-call binary.
$ ./busybox ash z
ok
ok
ok
Tried with CONFIG_FEATURE_SH_STANDALONE=y and it still works for me.
Please send your .config
More information about the busybox
mailing list