diff mbox series

[1/3] Makefile: set LC_ALL and LANG to C

Message ID 20221021115333.13725-2-pvorel@suse.cz
State Changes Requested
Headers show
Series LC_ALL for build, remove outdated doc | expand

Commit Message

Petr Vorel Oct. 21, 2022, 11:53 a.m. UTC
* have reproducible builds (no locale dependencies)
* English only output - easier to debug problem

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
NOTE: if we want to have only reproducible build, but keep localized
messages, we could use kernel approach:
unexport LC_ALL
LC_COLLATE=C
LC_NUMERIC=C
export LC_COLLATE LC_NUMERIC

They deliberately kept LC_CTYPE to have localized messages.

See also
c051346b7db2 ("Makefile: set LC_CTYPE, LC_COLLATE, LC_NUMERIC to C")
07105202bdeb ("Makefile: do not override LC_CTYPE")

 Makefile | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Akihiko Odaki Oct. 22, 2022, 12:28 a.m. UTC | #1
On 2022/10/21 20:53, Petr Vorel wrote:
> * have reproducible builds (no locale dependencies)
> * English only output - easier to debug problem
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> NOTE: if we want to have only reproducible build, but keep localized
> messages, we could use kernel approach:
> unexport LC_ALL
> LC_COLLATE=C
> LC_NUMERIC=C
> export LC_COLLATE LC_NUMERIC
> 
> They deliberately kept LC_CTYPE to have localized messages.
> 
> See also
> c051346b7db2 ("Makefile: set LC_CTYPE, LC_COLLATE, LC_NUMERIC to C")
> 07105202bdeb ("Makefile: do not override LC_CTYPE")
> 
>   Makefile | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index d4399bae6..ea11ac7f3 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -21,6 +21,10 @@
>   # Ngie Cooper, July 2009
>   #
>   
> +# Avoid funny character set dependencies
> +export LANG=C

Hi,

Setting LANG should not be necessary as long as LC_ALL is set. That is 
what my patch "tst_test.sh: Normalize the locale" does.

Regards,
Akihiko Odaki

> +export LC_ALL=C
> +
>   top_srcdir		?= $(CURDIR)
>   
>   include $(top_srcdir)/include/mk/env_pre.mk
Richard Palethorpe Nov. 7, 2022, 11:41 a.m. UTC | #2
Hello,

Akihiko Odaki <akihiko.odaki@daynix.com> writes:

> On 2022/10/21 20:53, Petr Vorel wrote:
>> * have reproducible builds (no locale dependencies)
>> * English only output - easier to debug problem
>> Signed-off-by: Petr Vorel <pvorel@suse.cz>
>> ---
>> NOTE: if we want to have only reproducible build, but keep localized
>> messages, we could use kernel approach:
>> unexport LC_ALL
>> LC_COLLATE=C
>> LC_NUMERIC=C
>> export LC_COLLATE LC_NUMERIC
>> They deliberately kept LC_CTYPE to have localized messages.
>> See also
>> c051346b7db2 ("Makefile: set LC_CTYPE, LC_COLLATE, LC_NUMERIC to C")
>> 07105202bdeb ("Makefile: do not override LC_CTYPE")

I would prefer to copy the kernel. If someone sends us compilation
messages in a language we don't understand then we can ask them to set
the locale before compiling.

I think ensuring our build scripts produce the same executable output on
different locales is nice though.

>>   Makefile | 4 ++++
>>   1 file changed, 4 insertions(+)
>> diff --git a/Makefile b/Makefile
>> index d4399bae6..ea11ac7f3 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -21,6 +21,10 @@
>>   # Ngie Cooper, July 2009
>>   #
>>   +# Avoid funny character set dependencies
>> +export LANG=C
>
> Hi,
>
> Setting LANG should not be necessary as long as LC_ALL is set. That is
> what my patch "tst_test.sh: Normalize the locale" does.

Yes, I don't understand what LANG is doing here. AFAICT it is just sets
a default for undefined settings and will be overrided by LC_ALL.

>
> Regards,
> Akihiko Odaki
>
>> +export LC_ALL=C
>> +
>>   top_srcdir		?= $(CURDIR)
>>     include $(top_srcdir)/include/mk/env_pre.mk

Setting to changes-requested in patchwork because of LANG and LC_ALL is
overkill IMO.
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index d4399bae6..ea11ac7f3 100644
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,10 @@ 
 # Ngie Cooper, July 2009
 #
 
+# Avoid funny character set dependencies
+export LANG=C
+export LC_ALL=C
+
 top_srcdir		?= $(CURDIR)
 
 include $(top_srcdir)/include/mk/env_pre.mk