Re: [PATCH] Set LC_ALL instead LC_COLLATE in mkbuiltins

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/21/2015 10:25 PM, Herbert Xu wrote:
> Fredrik Fornwall <fredrik@xxxxxxxxxxxx> wrote:
>> In mkbuiltins LC_COLLATE is set, but since "The value of the LC_ALL
>> environment variable has precedence over any of the other environment
>> variables starting with LC_"
>> (http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html), this
>> has no effect when LC_ALL is set.
>>
>> This breaks when having e.g. LC_ALL=en_US.UTF-8 during make, which
>> causes the test case
>>    dash -c :
>> to fail, probably due to broken ordering in builtins.c. The patch
>> corrects that by setting LC_ALL instead of LC_COLLATE.
> 
> This causes any errors printed by sort to come out in English.

Why do you care whether any errors printed by sort are in the "C" locale
(in English) rather than localized?  Ideally, there won't be any sort
errors in the first place, because this tool is run on controlled input
as part of the build process.

> 
> Please fix this by simply setting LC_ALL to empty alongside
> LC_COLLATE=C.

Setting LC_ALL has the nice property that LC_COLLATE and LC_CTYPE are
guaranteed to be compatible; if you just set LC_COLLATE but leave
LC_CTYPE unchanged and unset LC_ALL, it is possible to attempt a
collation that assumes one character set while still living in a ctype
that assumes another, and get garbled results.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux