[buildd-tools-devel] Bug#520755: Bug#520755: [Buildd-tools-devel] Bug#520755: sbuild needs to reset locale when calling schroot.

Roger Leigh rleigh at codelibre.net
Sun Mar 29 18:16:19 UTC 2009


tags 520755 + patch
thanks

On Sun, Mar 29, 2009 at 06:43:33PM +0200, Daniel Kobras wrote:
> Hi!
> 
> On Sun, Mar 29, 2009 at 02:52:16PM +0100, Roger Leigh wrote:
> > Does the attached patch fix things for you when run in a non-C or POSIX
> > locale?
> 
> Yep, this seems to do the trick on my system.

Great, thanks for confirming.  I'll merge the following slightly
cleaner version of the patch:


diff --git a/lib/Sbuild/ChrootInfoSchroot.pm b/lib/Sbuild/ChrootInfoSchroot.pm
index 1094f27..97d839c 100644
--- a/lib/Sbuild/ChrootInfoSchroot.pm
+++ b/lib/Sbuild/ChrootInfoSchroot.pm
@@ -1,6 +1,6 @@
 #
 # ChrootInfo.pm: chroot utility library for sbuild
-# Copyright © 2005-2006 Roger Leigh <rleigh at debian.org>
+# Copyright © 2005-2009 Roger Leigh <rleigh at debian.org>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -53,6 +53,12 @@ sub get_info {
     my %tmp = ('Priority' => 0,
 	       'Location' => "",
 	       'Session Purged' => 0);
+
+    local %ENV;
+
+    $ENV{'LC_ALL'} = 'C';
+    $ENV{'LANGUAGE'} = 'C';
+
     open CHROOT_DATA, '-|', $self->get_conf('SCHROOT'), '--info', '--chroot', $chroot
 	or die 'Can\'t run ' . $self->get_conf('SCHROOT') . ' to get chroot data';
     while (<CHROOT_DATA>) {
@@ -100,6 +106,11 @@ sub get_info_all {
     my $chroots = {};
     my $build_dir = $self->get_conf('BUILD_DIR');
 
+    local %ENV;
+
+    $ENV{'LC_ALL'} = 'C';
+    $ENV{'LANGUAGE'} = 'C';
+
     open CHROOTS, '-|', $self->get_conf('SCHROOT'), '--list'
 	or die 'Can\'t run ' . $self->get_conf('SCHROOT');
     while (<CHROOTS>) {

-- 
  .''`.  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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20090329/1c721688/attachment.pgp 


More information about the Buildd-tools-devel mailing list