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

Bug#429882: std::locale loc("") fails with error: locale::facet::_S_create_c_locale name not valid



Package: locales
Version: 2.5-11
Severity: important

Hello

I encountered following error when calling
std::locale loc("");
in a simple c++ program:

loc.cc:
---------------------->%-------------------
#include <iostream>
#include <locale>

int main(int argc, char* argv[])
{
  try
  {
     std::ios::sync_with_stdio(false);
     std::locale loc(argc > 1 ? argv[1] : "");
     std::cout << loc.name() << std::endl;
  }
  catch (const std::exception& e)
  {
     std::cerr << e.what() << std::endl;
  }
}
----------------------%<-------------------

When compiled with
$ g++ --version
g++ (GCC) 4.1.3 20070601 (prerelease) (Debian 4.1.2-12)

and executed on my system it produces the following
error message:

$ ./loc ""
locale::facet::_S_create_c_locale name not valid

$ echo $LANG; ./loc $LANG
de_DE.UTF-8
locale::facet::_S_create_c_locale name not valid

This is in contrast to:

$ /usr/sbin/validlocale ""
locale '' valid and available

$ /usr/sbin/validlocale $LANG
locale 'de_DE.UTF-8' valid and available

Requesting the 'C' locale works:

$ ./loc C
C

I report this bug here for package locales because I'm not sure if it has to
do with some misconfiguration of my systen, which I'm not aware of.

I tried dpkg-reconfigure locales and it built the selected locales
afterwards. Here the output of locale -a:

$ locale -a
C
de_DE.utf8
en_GB.utf8
en_US.utf8
POSIX

If it is not a configuration issue, I suspect the bug in libstdc++6 or libc6.

This does not happen in etch.

Additional informations:

$ dpkg -l libstdc++6*
ii  libstdc++6     4.2-20070609-1 The GNU Standard C++ Library v3
ii  libstdc++6-4.1 4.1.2-12       The GNU Standard C++ Library v3 (development

$ ldd loc
        linux-gate.so.1 =>  (0xffffe000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xa7e35000)
	libm.so.6 => /lib/libm.so.6 (0xa7e0e000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xa7e03000)
	libc.so.6 => /lib/libc.so.6 (0xa7cbf000)
	/lib/ld-linux.so.2 (0xa7f34000)
						

Kind regards

Dieter Hametner


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (600, 'unstable'), (100, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.17-686-air-1 (PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages locales depends on:
ii  debconf [debconf-2.0]         1.5.13     Debian configuration management sy
ii  libc6 [glibc-2.5-1]           2.5-11     GNU C Library: Shared libraries

locales recommends no packages.

-- debconf information:
* locales/default_environment_locale: de_DE.UTF-8
* locales/locales_to_be_generated: de_DE.UTF-8 UTF-8, en_GB.UTF-8 UTF-8, en_US.UTF-8 UTF-8



Reply to: