[Buildd-tools-devel] unsetting locale

Francesco P. Lovergine frankie@debian.org
Fri, 8 Oct 2004 09:44:32 +0200


On Thu, Oct 07, 2004 at 08:45:04PM +0200, Michael Banck wrote:
> Hi,
> 
> one thing which has always bugged me is that sbuild apparently does not
> reset the locale, and perl always barfs on this, cluttering up the
> build-log:
> 
> perl: warning: Setting locale failed.
> perl: warning: Please check that your locale settings:
>         LANGUAGE = (unset),
>         LC_ALL = (unset),
>         LC_CTYPE = "de_DE.ISO-8859-15@euro",
>         LANG = "POSIX"
>     are supported and installed on your system.
> 
> Does anybody know how to best reset the locale, so that these messages
> go away? (btw, they also break the perl test-suite, resulting in some
> spurious failed tests where output is compared)
> 
> 

This should do the trick.

--- ../sbuild-0.34/sbuild       2004-09-17 15:17:41.000000000 +0200
+++ sbuild      2004-10-08 09:42:13.000000000 +0200
@@ -20,6 +20,8 @@
 # $Id: sbuild,v 1.1.1.1 2004/09/17 13:17:41 frankie Exp $
 #
 
+require 5.004;
+
 BEGIN {
         ($main::HOME = $ENV{'HOME'})
                 or die "HOME not defined in environment!\n";
@@ -70,6 +72,8 @@
 use FileHandle;
 use Cwd;
 
+setlocale(LC_ALL,"POSIX");
+
 # avoid intermixing of stdout and stderr
 $| = 1;
 # in case the terminal disappears, the build should continue


-- 
Francesco P. Lovergine