[buildd-tools-devel] Bug#520755: [Buildd-tools-devel] Bug#520755: sbuild needs to reset locale when calling schroot.
Roger Leigh
rleigh at codelibre.net
Sun Mar 29 13:52:16 UTC 2009
On Thu, Mar 26, 2009 at 04:51:57PM +0100, Daniel Kobras wrote:
> Following an upgrade of my sid system yesterday, I also got bitten by
> sbuild's "chroot does not exist" bug. However, the build starts
> correctly when calling sbuild with LC_ALL=C in the environment, so I
> guess this is due to the locale not getting set to C/POSIX before
> calling schroot -i and parsing its output.
Does the attached patch fix things for you when run in a non-C or POSIX
locale?
Thanks,
Roger
diff --git a/lib/Sbuild/ChrootInfoSchroot.pm b/lib/Sbuild/ChrootInfoSchroot.pm
index 1094f27..d26b9e5 100644
--- a/lib/Sbuild/ChrootInfoSchroot.pm
+++ b/lib/Sbuild/ChrootInfoSchroot.pm
@@ -53,6 +53,12 @@ sub get_info {
my %tmp = ('Priority' => 0,
'Location' => "",
'Session Purged' => 0);
+
+ my %saved_env = %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>) {
@@ -84,6 +90,8 @@ sub get_info {
close CHROOT_DATA or die "Can't close schroot pipe getting chroot data";
+ %ENV = %saved_env;
+
if ($self->get_conf('DEBUG')) {
print STDERR "Found schroot chroot: $chroot\n";
foreach (sort keys %tmp) {
@@ -100,6 +108,11 @@ sub get_info_all {
my $chroots = {};
my $build_dir = $self->get_conf('BUILD_DIR');
+ my %saved_env = %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>) {
@@ -111,6 +124,8 @@ sub get_info_all {
}
close CHROOTS or die "Can't close schroot pipe";
+ %ENV = %saved_env;
+
$self->set('Chroots', $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/84a429eb/attachment.pgp
More information about the Buildd-tools-devel
mailing list