[buildd-tools-devel] Bug#782534: sbuild: sbuild-createchroot agrees to create a duplicate-named chroot, which schroot then barfs on

Johannes Schauer josch at debian.org
Thu Dec 24 09:51:18 UTC 2015


Control: tag -1 + patch

On Mon, 13 Apr 2015 12:40:07 -0700 Dima Kogan <dima at secretsauce.net> wrote:
> Hi. Look:
> 
> 
>     dima at shorty:/etc/schroot/chroot.d$ schroot -l
>     chroot:sid-amd64-sbuild
>     chroot:trusty-amd64-sbuild
>     chroot:wheezy-amd64-sbuild
>     source:sid-amd64-sbuild
>     source:trusty-amd64-sbuild
>     source:wheezy-amd64-sbuild
> 
>     dima at shorty:/etc/schroot/chroot.d$ ls
>     sid-amd64-sbuild-VVRXav  trusty-amd64-sbuild-dXNuL1  wheezy-amd64-sbuild-Y42av1
> 
>     dima at shorty:/etc/schroot/chroot.d$ sudo sbuild-createchroot --make-sbuild-tarball=/var/lib/sbuild/trusty-amd64.tar.gz wheezy /tmp/xxx http://mirror.hmc.edu/debian 
>     I: SUITE: wheezy
>     I: TARGET: /tmp/xxx
>     <snip. lots of output as a "wheezy" chroot is made>
> 
>     dima at shorty:/etc/schroot/chroot.d$ schroot -l
>     E: /etc/schroot/chroot.d/wheezy-amd64-sbuild-Y42av1: line 1 [wheezy-amd64-sbuild]: A chroot or alias â already exists with this name
>     I: Duplicate names are not allowed
> 
>     dima at shorty:/etc/schroot/chroot.d$ ls
>     sid-amd64-sbuild-VVRXav  trusty-amd64-sbuild-dXNuL1  wheezy-amd64-sbuild-HHoTCT  wheezy-amd64-sbuild-Y42av1
> duplicates:                                              ^^^^^^                      ^^^^^^
> 
> 
> So I had a "wheezy" sbuild chroot. Then I made another one with the same
> name (and sbuild-createchroot let me). Then schroot gets confused.
> sbuild-createchroot should probably check for this.

oh cool! Thanks for bringing this up! The following patch should fix the problem:

--- a/bin/sbuild-createchroot
+++ b/bin/sbuild-createchroot
@@ -173,6 +173,17 @@ $conf->set('INCLUDE', add_items($conf->get('INCLUDE'),
                                "debfoster"));
 
 my $suite = $ARGV[0];
+
+# check if schroot name is already in use
+
+my $chrootname = "${suite}-" . $conf->get('BUILD_ARCH') . $conf->get('CHROOT_SUFFIX');
+
+open my $pipe, 'schroot -l --all-source-chroots |';
+while (my $line = <$pipe>) {
+       $line ne "source:$chrootname\n" or die "chroot with name $chrootname already exists";
+}
+close $pipe;
+
 # Create the target directory in advance so abs_path (which is buggy)
 # won't fail.  Remove if abs_path is replaced by something better.
 makedir($ARGV[1], 0755);
@@ -269,7 +280,6 @@ dump_file("${target}/etc/apt/sources.list");
 print "I: Please add any additional APT sources to ${target}/etc/apt/sources.list\n";
 
 # Write out schroot chroot configuration.
-my $chrootname = "${suite}-" . $conf->get('BUILD_ARCH') . $conf->get('CHROOT_SUFFIX');
 
 # Determine the schroot chroot configuration to use.
 my $config_entry;


Thanks!

cheers, josch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: signature
URL: <http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20151224/818758ef/attachment.sig>


More information about the Buildd-tools-devel mailing list