Skip to contentSkip to conversation

reset LC_MESSAGES to C too

PATCH In review Andrey Borzenkov 2 participants 2 messages Mar 30, 2013 – Apr 1, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reset LC_MESSAGES to C too

If user locale has non-ASCII translation strings, running grub make outputs only question marks:

bor@opensuse:~/build/grub> locale
LANG=ru_RU.utf8
LC_CTYPE="ru_RU.utf8"
LC_NUMERIC="ru_RU.utf8"
LC_TIME="ru_RU.utf8"
LC_COLLATE="ru_RU.utf8"
LC_MONETARY="ru_RU.utf8"
LC_MESSAGES="ru_RU.utf8"
LC_PAPER="ru_RU.utf8"
LC_NAME="ru_RU.utf8"
LC_ADDRESS="ru_RU.utf8"
LC_TELEPHONE="ru_RU.utf8"
LC_MEASUREMENT="ru_RU.utf8"
LC_IDENTIFICATION="ru_RU.utf8"
LC_ALL=

make[2]: ????? ?? ???????? `/home/bor/build/grub/docs' Making all in util/bash-completion.d
make[2]: ???? ? ??????? /home/bor/build/grub/util/bash-completion.d' make[2]: ???? all' ?? ??????? ?????????? ??????.
make[2]: ????? ?? ???????? /home/bor/build/grub/util/bash-completion.d' make[1]: ????? ?? ???????? /home/bor/build/grub'

The reason is, grub Makefile resets LC_CTYPE to C. This makes it impossible to translate messages into current locale (C at the time tools are running). Reset LC_MESSAGES to C as well, it is better to have them in English than do not have them at all.

Problem observed on Linux with glibc 2.17 and 2.15.

---
 ChangeLog            | 5 +++++
 conf/Makefile.common | 1 +
 2 files changed, 6 insertions(+)
ChangeLog +5 -0
index 58c2242..cd1f762 100644
@@ -1,3 +1,8 @@
+2013-03-30  Andrey Borzenkov <[email protected]>
+
+	* conf/Makefile.common: Reset LC_MESSAGES to C too to avoid
+	question marks in messages during build on non-ASCII locale.
+
 2013-03-26  Vladimir Serbinenko  <[email protected]>
 
 	* grub-core/kern/efi/mm.c (grub_efi_finish_boot_services):
conf/Makefile.common +1 -0
index c185a55..f49581d 100644
@@ -4,6 +4,7 @@ CFLAGS_PLATFORM=
 
 export LC_COLLATE := C
 export LC_CTYPE := C
+export LC_MESSAGES := C
 unexport LC_ALL
 
 # Platform specific options
Signature · 1 line
tg: (c643afe..) u/lc_messages (depends on: master)
#1 lore raw
Quoted 26 lines · Andrey Borzenkov

If user locale has non-ASCII translation strings, running grub make outputs only question marks:

bor@opensuse:~/build/grub> locale
LANG=ru_RU.utf8
LC_CTYPE="ru_RU.utf8"
LC_NUMERIC="ru_RU.utf8"
LC_TIME="ru_RU.utf8"
LC_COLLATE="ru_RU.utf8"
LC_MONETARY="ru_RU.utf8"
LC_MESSAGES="ru_RU.utf8"
LC_PAPER="ru_RU.utf8"
LC_NAME="ru_RU.utf8"
LC_ADDRESS="ru_RU.utf8"
LC_TELEPHONE="ru_RU.utf8"
LC_MEASUREMENT="ru_RU.utf8"
LC_IDENTIFICATION="ru_RU.utf8"
LC_ALL=

make[2]: ????? ?? ???????? `/home/bor/build/grub/docs' Making all in util/bash-completion.d
make[2]: ???? ? ??????? /home/bor/build/grub/util/bash-completion.d' make[2]: ???? all' ?? ??????? ?????????? ??????.
make[2]: ????? ?? ???????? /home/bor/build/grub/util/bash-completion.d' make[1]: ????? ?? ???????? /home/bor/build/grub'

Quoted 4 lines

The reason is, grub Makefile resets LC_CTYPE to C. This makes it impossible to translate messages into current locale (C at the time tools are running). Reset LC_MESSAGES to C as well, it is better to have them in English than do not have them at all.

This doesn't seem right thing to do. LC_COLLATE was reset to C because of Estonian since [a-z] in Estonian doesn't include u or t. LC_CTYPE might break e.g. [[:alpha:]]. But I don't know how to stop it from interfering with make and gcc messages

Quoted 35 lines

Problem observed on Linux with glibc 2.17 and 2.15.

---
 ChangeLog            | 5 +++++
 conf/Makefile.common | 1 +
 2 files changed, 6 insertions(+)
ChangeLog +5 -0
index 58c2242..cd1f762 100644
@@ -1,3 +1,8 @@
+2013-03-30  Andrey Borzenkov <[email protected]>
+
+	* conf/Makefile.common: Reset LC_MESSAGES to C too to avoid
+	question marks in messages during build on non-ASCII locale.
+
 2013-03-26  Vladimir Serbinenko  <[email protected]>
 
 	* grub-core/kern/efi/mm.c (grub_efi_finish_boot_services):
conf/Makefile.common +1 -0
index c185a55..f49581d 100644
@@ -4,6 +4,7 @@ CFLAGS_PLATFORM=
 
 export LC_COLLATE := C
 export LC_CTYPE := C
+export LC_MESSAGES := C
 unexport LC_ALL
 
 # Platform specific options