Bug 102615 - ISOLanguage.cc does not accept LANG=POSIX
Summary: ISOLanguage.cc does not accept LANG=POSIX
Status: RESOLVED FIXED
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: YaST2 (show other bugs)
Version: Beta 1
Hardware: Other All
: P5 - None : Normal
Target Milestone: Beta 2
Assignee: Michael Andres
QA Contact: Klaus Kämpf
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-08 16:28 UTC by Juergen Weigert
Modified: 2005-08-11 08:23 UTC (History)
2 users (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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)