Bug 102615

Summary: ISOLanguage.cc does not accept LANG=POSIX
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Juergen Weigert <jw>
Component: YaST2Assignee: Michael Andres <ma>
Status: RESOLVED FIXED QA Contact: Klaus Kämpf <kkaempf>
Severity: Normal    
Priority: P5 - None CC: aj, werner
Version: Beta 1   
Target Milestone: Beta 2   
Hardware: Other   
OS: All   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Juergen Weigert 2005-08-08 16:28:21 UTC
when started with  
LC_CTYPE=en_US.UTF-8 
LANG=POSIX 
 
yast does the following fallback: 
2005-08-08 18:08:58 <1> g198(13937) [liby2] genericfrontend.cc(main):482 
YAST_IS_RUNNING is yes 
2005-08-08 18:08:58 <1> g198(13937) [Y2PM] Y2PM.locale.cc(LocaleSettings):72 
$LANG='POSIX' 
2005-08-08 18:08:58 <2> g198(13937) [liby2util] ISOLanguage.cc(_assert):74 
Malformed ISOLanguage code 'POSIX' (size != 2) 
2005-08-08 18:08:58 <2> g198(13937) [liby2util] ISOLanguage.cc(_assert):79 
Malformed ISOLanguage code 'POSIX' (not lower case) 
2005-08-08 18:08:58 <1> g198(13937) [liby2util] ISOLanguage.cc(_assert):92 
Remember language code 'POSIX': Unknown language 'POSIX' 
2005-08-08 18:08:58 <1> g198(13937) [Y2PM] Y2PM.locale.cc(LocaleSettings):78 
Preferred locale: 'POSIX' 
2005-08-08 18:08:58 <1> g198(13937) [Y2PM] Y2PM.locale.cc(LocaleSettings):79 
Fallback locale: 'en' 
 
 
LANG should rather fallback to LC_CTYPE,  
but POSIX should have been accepted in the first place.
Comment 1 Michael Andres 2005-08-10 10:22:15 UTC
Well, 'POSIX' is no language. ISOLanguage stores language codes we use for
delivering translated metadata (label, descriptions...) to the UI. So accepting
POSIX isn't helpfull here. 

Usg. the application explicitly sets the language. The environment is evaluated 
just in case the application misses to set it. But you're right, looking at LANG
is not sufficient, but the correct sequence would IMO be:

   LC_ALL -> LC_CTYPE -> LANG as last resort.
Comment 2 Dr. Werner Fink 2005-08-10 10:32:32 UTC
Hmmm ... IMHO 'POSIX' or 'C' is not a language but a well defined
codeset.  Btw: Whx not using the nl_langinfo interface of the glibc
to get the current CODESET.  With

  #include <langinfo.h>

and

  char *codeset = nl_langinfo(CODESET);

you get the current used codeset like
"UTF-8",  "ISO-8859-1", or "ANSI_X3.4-1968"

No need to ask the several environment variables
or use setlocale to the the information.
Comment 3 Michael Andres 2005-08-10 11:34:05 UTC
Fixed in yast2-packagemanager-2.12.13.

(evaluates LC_ALL -> LC_CTYPE -> LANG; ignore 'POSIX' or 'C' as we need a real
language; fallback to 'en' if nothing useable was found)