How do I (unconditionally) enable unicode support in busybox?

Denys Vlasenko vda.linux at googlemail.com
Mon Aug 11 18:37:20 UTC 2014


On Mon, Aug 11, 2014 at 8:28 PM, Denys Vlasenko
<vda.linux at googlemail.com> wrote:
>> The most mysterious thing is that it sometimes works and what
>> I need to do to get it to work in /init in an initrd.
>
> You may have found a bug. bbox never runs setlocale()
> for init.

Changed this in git just now.
Note: you will likely need to set $LANG in init's environment
for setlocale(LC_ALL, "") to activate Unicode for your init.


commit 45b4ecc8689d1291b01793efab3ac25125e14e48
Author: Denys Vlasenko <vda.linux at googlemail.com>
Date:   Mon Aug 11 20:33:18 2014 +0200

    init: if libc-based Unicode support is on, run setlocale(LC_ALL,
"") at startup

    It is not clear why we were excluding init from this.
    The "getpid() != 1" clause was there from the beginning (2001)
    but not explained.

    Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>

diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index f7c416e..a015085 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -184,8 +184,7 @@ void lbb_prepare(const char *applet
 #endif
        applet_name = applet;

-       /* Set locale for everybody except 'init' */
-       if (ENABLE_LOCALE_SUPPORT && getpid() != 1)
+       if (ENABLE_LOCALE_SUPPORT)
                setlocale(LC_ALL, "");

 #if ENABLE_FEATURE_INDIVIDUAL


More information about the busybox mailing list