Control: tag -1 + patch

Hi,

Quoting Raphael Hertzog (2015-09-03 18:07:37)
> On Thu, 03 Sep 2015, Johannes Schauer wrote:
> > So I guess more configuration is required for this?
> 
> In a jessie environment (in particular the kernel), you can use "aufs"
> instead of "overlay". In stretch/sid (with a newer kernel), you need
> "overlay" but it also requires a version of schroot which is only in
> unstable right now...

aha! I'm running a mix of testing/unstable and your tip of using the sid
version of schroot did the trick.

I'm now able to verify your bug when I use union-type=overlay in my schroot
config.

The attached patch should now print an appropriate error message, in case you
want to verify that it works.

I plan to clone this bug and have a separate bug to also do a chown call.

Thanks!

cheers, josch
From 4045043dbbff8d0b9fc3915dcbd962a0a7ee3458 Mon Sep 17 00:00:00 2001
From: Johannes 'josch' Schauer <[email protected]>
Date: Sun, 6 Sep 2015 08:47:09 +0200
Subject: [PATCH] Report a proper error message in case /var/lib/sbuild inside
 the chroot is not writable (Closes: #797783)

 - lib/Sbuild/ResolverBase.pm: setup():
     * wrap call to File::Temp in eval() block because it croak()s on error
     * instead of printing to STDERR use $self->log_error
     * return consistent success/failure
 - lib/Sbuild/Build.pm: run_chroot_session_locked():
     * check the return value of resolver->setup() and throw error
     * accordingly
---
 lib/Sbuild/Build.pm        |  5 ++++-
 lib/Sbuild/ResolverBase.pm | 10 ++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index 5661cd7..59a8dd8 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -564,7 +564,10 @@ sub run_chroot_session_locked {
 
 
 	$self->check_abort();
-	$resolver->setup();
+	if (!$resolver->setup()) {
+		Sbuild::Exception::Build->throw(error => "resolver setup failed",
+						failstage => "resolver setup");
+	}
 
 	$self->check_abort();
 	$self->run_chroot_update();
diff --git a/lib/Sbuild/ResolverBase.pm b/lib/Sbuild/ResolverBase.pm
index 5d85f60..4e94645 100644
--- a/lib/Sbuild/ResolverBase.pm
+++ b/lib/Sbuild/ResolverBase.pm
@@ -87,9 +87,9 @@ sub setup {
     $self->set('Chroot APT Conf', $chroot_aptconf);
 
     # Always write out apt.conf, because it may become outdated.
-    if (my $F = new File::Temp( TEMPLATE => "$aptconf.XXXXXX",
+    if (my $F = eval {new File::Temp( TEMPLATE => "$aptconf.XXXXXX",
 				DIR => $session->get('Location'),
-				UNLINK => 0) ) {
+				UNLINK => 0) } ) {
 	if ($self->get_conf('APT_ALLOW_UNAUTHENTICATED')) {
 	    print $F "APT::Get::AllowUnauthenticated true;\n";
 	}
@@ -100,11 +100,11 @@ sub setup {
 	}
 
 	if (! rename $F->filename, $chroot_aptconf) {
-	    print STDERR "Can't rename $F->filename to $chroot_aptconf: $!\n";
+	    $self->log_error("Can't rename $F->filename to $chroot_aptconf: $!\n");
 	    return 0;
 	}
     } else {
-	print STDERR "Can't create $chroot_aptconf: $!";
+	$self->log_error("Can't create $chroot_aptconf: $!\n");
 	return 0;
     }
 
@@ -132,6 +132,8 @@ sub setup {
     }
 
     $self->cleanup_apt_archive();
+
+    return 1;
 }
 
 sub get_foreign_architectures {
-- 
2.1.4

Attachment: signature.asc
Description: signature

Reply via email to