tags 425117 + patch
thanks

Martin Michlmayr <[EMAIL PROTECTED]> writes:

> Package: schroot
> Version: 1.0.5-1
>
> I'm getting the following error when starting schroot:
>
>   13:[EMAIL PROTECTED]: ~] schroot
>   E: locale::facet::_S_create_c_locale name not valid
>
> The reason is that I have LANG=en_US.UTF-8 but this locale wasn't
> generated.  After generating this locale file, schroot started to
> work, but I think it should also work without having the locale
> installed.

Does the attached patch fix things for you?

Note, you'll need to run ./bootstrap due to #424038 if you are using
current unstable.


Thanks,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
Index: sbuild/sbuild-basic-keyfile.tcc
===================================================================
--- sbuild/sbuild-basic-keyfile.tcc	(revision 1173)
+++ sbuild/sbuild-basic-keyfile.tcc	(working copy)
@@ -179,7 +179,15 @@
 							  key_type const& key,
 							  std::string&       value) const
 {
-  std::string localename = std::locale("").name();
+  std::string localename;
+  try
+    {
+      localename = std::locale("").name();
+    }
+  catch (std::runtime_error const& e) // Invalid locale
+    {
+      localename = std::locale::classic();
+    }
   std::string::size_type pos;
   bool status = false;
 
Index: configure.ac
===================================================================
--- configure.ac	(revision 1173)
+++ configure.ac	(working copy)
@@ -222,20 +222,20 @@
              [AC_MSG_FAILURE([liblockdev (lockdev) is not installed, but is required by schroot])])
 AC_SUBST([LOCKDEV_LIBS])
 
-AC_MSG_CHECKING([for boost::program_options::variables_map in -lboost_program_options])
+AC_MSG_CHECKING([for boost::program_options::variables_map in -lboost_program_options-st])
 saved_ldflags="${LDFLAGS}"
-LDFLAGS="${LDFLAGS} -lboost_program_options"
+LDFLAGS="${LDFLAGS} -lboost_program_options-st"
 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <boost/program_options.hpp>],
                                [boost::program_options::variables_map::variables_map dummy()])],
                [AC_MSG_RESULT([yes])
-	        BOOST_LIBS="${BOOST_LIBS} -lboost_program_options"],
+	        BOOST_LIBS="${BOOST_LIBS} -lboost_program_options-st"],
                [AC_MSG_RESULT([no])
 	        AC_MSG_FAILURE([libboost_program_options (Boost C++ Libraries) is not installed, but is required by schroot])])
 LDFLAGS="${saved_ldflags}"
 
-AC_MSG_CHECKING([for boost::program_options::options_description::options() in -lboost_program_options])
+AC_MSG_CHECKING([for boost::program_options::options_description::options() in -lboost_program_options-st])
 saved_ldflags="${LDFLAGS}"
-LDFLAGS="${LDFLAGS} -lboost_program_options"
+LDFLAGS="${LDFLAGS} -lboost_program_options-st"
 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <boost/program_options.hpp>],
                                [boost::program_options::options_description testgrp("test group");
                                 bool notused = testgrp.options().empty();
@@ -250,13 +250,13 @@
   AC_DEFINE(BOOST_PROGRAM_OPTIONS_DESCRIPTION_OLD, 1)
 fi
 
-AC_MSG_CHECKING([for boost::regex in -lboost_regex])
+AC_MSG_CHECKING([for boost::regex in -lboost_regex-st])
 saved_ldflags="${LDFLAGS}"
-LDFLAGS="${LDFLAGS} -lboost_regex"
+LDFLAGS="${LDFLAGS} -lboost_regex-st"
 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <boost/regex.hpp>],
                                [boost::regex("^foo[bar]$")])],
                [AC_MSG_RESULT([yes])
-	        BOOST_LIBS="${BOOST_LIBS} -lboost_regex"],
+	        BOOST_LIBS="${BOOST_LIBS} -lboost_regex-st"],
                [AC_MSG_RESULT([no])
 	        AC_MSG_FAILURE([libboost_regex (Boost C++ Libraries) is not installed, but is required by schroot])])
 LDFLAGS="${saved_ldflags}"
Index: bin/schroot-base/schroot-base-run.h
===================================================================
--- bin/schroot-base/schroot-base-run.h	(revision 1173)
+++ bin/schroot-base/schroot-base-run.h	(working copy)
@@ -51,7 +51,14 @@
     try
       {
 	// Set up locale.
-	std::locale::global(std::locale(""));
+	try
+	  {
+	    std::locale::global(std::locale(""));
+	  }
+	catch (std::runtime_error const& e) // Invalid locale
+	  {
+	    std::locale::global(std::locale::classic());
+	  }
 	std::cout.imbue(std::locale());
 	std::cerr.imbue(std::locale());
 

Attachment: pgpZVzAMcudlv.pgp
Description: PGP signature

Reply via email to