Bug 7811 - default locale not taken from environment
Summary: default locale not taken from environment
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 3.2.1
: P3 normal
Target Milestone: ---
Assignee: Paolo Carlini
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-02 09:26 UTC by Martin v. Loewis
Modified: 2003-07-25 17:33 UTC (History)
1 user (show)

See Also:
Host: i386-pc-linux-gnu
Target: i386-pc-linux-gnu
Build: i386-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin v. Loewis 2002-09-02 09:26:00 UTC
	When instantiating a locale with the "" name, the locale object will be
	the "C" locale, not the one specified in the environment variables.

Release:
3.2.1 20020830 (Debian prerelease) (Debian testing/unstable)

Environment:
System: Linux kosh 2.4.19-k7 #1 Thu Aug 8 23:19:38 EST 2002 i686 unknown unknown GNU/Linux
Architecture: i686

	
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: /mnt/data/gcc-3.1/gcc-3.2-3.2.1ds0/src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-java-gc=boehm --enable-objc-gc i386-linux

How-To-Repeat:
	Set LANG to, say, "de_DE.UTF-8". Then run the program

#include <locale>
#include <iostream>

int main(){
  using namespace std;
  locale loc("");
  cout << loc.name() << endl;
}

	This prints "C", but should print "de_DE.UTF-8" (or the like).
	On the same system, g++ 3.1 does work properly.
Comment 1 Paolo Carlini 2002-09-04 05:35:24 UTC
Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-Why: Working on it.
Comment 2 Paolo Carlini 2002-09-04 05:35:24 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed. The regression appeared in the short time span
    between 3.1.1 and 3.2.
Comment 3 Paolo Carlini 2002-09-05 14:19:48 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed for 3.2.1 and 3.3.
Comment 4 Paolo Carlini 2002-09-05 21:13:07 UTC
From: paolo@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: libstdc++/7811
Date: 5 Sep 2002 21:13:07 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	paolo@gcc.gnu.org	2002-09-05 14:13:07
 
 Modified files:
 	libstdc++-v3   : ChangeLog 
 	libstdc++-v3/testsuite/22_locale: ctor_copy_dtor.cc 
 	libstdc++-v3/src: locale.cc 
 
 Log message:
 	2002-09-05  Paolo Carlini  <pcarlini@unitus.it>
 	Roland McGrath  <roland@redhat.com>
 	
 	PR libstdc++/7811
 	* src/locale.cc (locale::locale(__s)): Use getenv instead
 	of setenv for the environment locale.
 	* testsuite/22_locale/ctor_copy_dtor.cc (test03): New.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.1342&r2=1.1343
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/ctor_copy_dtor.cc.diff?cvsroot=gcc&r1=1.15&r2=1.16
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/src/locale.cc.diff?cvsroot=gcc&r1=1.63&r2=1.64
 
Comment 5 Paolo Carlini 2002-09-05 21:35:27 UTC
From: paolo@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: libstdc++/7811
Date: 5 Sep 2002 21:35:27 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	paolo@gcc.gnu.org	2002-09-05 14:35:27
 
 Modified files:
 	libstdc++-v3   : ChangeLog 
 	libstdc++-v3/src: locale.cc 
 	libstdc++-v3/testsuite/22_locale: ctor_copy_dtor.cc 
 
 Log message:
 	2002-09-05  Paolo Carlini  <pcarlini@unitus.it>
 	Roland McGrath  <roland@redhat.com>
 	
 	PR libstdc++/7811
 	* src/locale.cc (locale::locale(__s)): Use getenv instead
 	of setenv for the environment locale.
 	* testsuite/22_locale/ctor_copy_dtor.cc (test03): New.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1057.2.159.2.15&r2=1.1057.2.159.2.16
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/src/locale.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.54.2.6.4.3&r2=1.54.2.6.4.4
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/ctor_copy_dtor.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.13.12.2&r2=1.13.12.3