[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bash-bug
Subject:    Re: Warning raised if trying to set LC_ALL to a locale bearing a character type other than UTF-8 and
From:       Chet Ramey <chet.ramey () case ! edu>
Date:       2022-07-06 13:37:06
Message-ID: 09821fb7-c523-92dd-21ba-4c895cd9c7ad () case ! edu
[Download RAW message or body]

On 7/1/22 9:08 AM, Kerin Millar wrote:
> Hello,
> 
> I was experimenting with locale variables in bash and noticed something that \
> appears odd. This is with bash 5.1.16 and glibc 2.35. 
> $ locale -a | grep -E '^en_(US|GB)'
> en_GB.utf8
> en_US
> en_US.iso88591
> en_US.utf8
> 
> $ locale
> LANG=en_US.UTF-8
> LC_CTYPE="en_US.UTF-8"
> LC_NUMERIC="en_US.UTF-8"
> LC_TIME="en_US.UTF-8"
> LC_COLLATE="en_US.UTF-8"
> LC_MONETARY="en_US.UTF-8"
> LC_MESSAGES="en_US.UTF-8"
> LC_PAPER="en_US.UTF-8"
> LC_NAME="en_US.UTF-8"
> LC_ADDRESS="en_US.UTF-8"
> LC_TELEPHONE="en_US.UTF-8"
> LC_MEASUREMENT="en_US.UTF-8"
> LC_IDENTIFICATION="en_US.UTF-8"
> LC_ALL=
> 
> $ ( LC_ALL=en_US.ISO-8859-1 )
> bash: warning: setlocale: LC_ALL: cannot change locale (en_US.ISO-8859-1)

Bash prints a warning if setlocale(3) returns an error (a null string) to
inform the user that even though they changed the shell variable, the
global locale wasn't changed correspondingly. Since there are no errors
defined for setlocale(), it's perfectly reasonable for it not to change
errno, so there's no additional error message if errno stays 0.

You can look at locale.c:set_locale_var() for the details.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic