Bug#381118: [Buildd-tools-devel] Bug#381118: sbuild: schroot + apt download is broken

2006-08-03 Thread Roger Leigh
Daniel Stone [EMAIL PROTECTED] writes:

 On Wed, Aug 02, 2006 at 12:44:57PM +0100, Roger Leigh wrote:

 That looks like an outright bug.  dsc_md5sums should, IMO, return an
 empty hashref on failure, but doesn't currently.

 Correct.

The patch is actually attached this time.


-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?   http://gutenprint.sourceforge.net/
   `-GPG Public Key: 0x25BFB848   Please sign and encrypt your mail.
Index: debian/changelog
===
--- debian/changelog	(revision 978)
+++ debian/changelog	(working copy)
@@ -3,8 +3,13 @@
   * debian/copyright: Add Alioth file download location.
   * chroot/add_sbuild_user: Fix chrapt command examples in output to use
 correct option syntax, thanks to Matthias Julius (Closes: #381186).
+  * sbuild:
+- dsc_md5sums: Return an empty hashref on failure.
+- verify_md5sums: Only run md5sum if there is one or more md5sum to
+  verify, to prevent md5sum waiting forever on stdin if there are no
+  files to check.  Thanks to Daniel Stone (Closes: #381118).
 
- -- Roger Leigh [EMAIL PROTECTED]  Thu,  3 Aug 2006 18:38:02 +0100
+ -- Roger Leigh [EMAIL PROTECTED]  Thu,  3 Aug 2006 18:51:08 +0100
 
 sbuild (0.49) unstable; urgency=low
 
Index: sbuild
===
--- sbuild	(revision 969)
+++ sbuild	(working copy)
@@ -2947,7 +2947,8 @@
 print STDERR   $dir$fields[3]: $fields[1]\n if $conf::debug;
 			}
 		}
-		close( DSC ) or print PLOG Failed to close $dsc\n  return 1;
+		close( DSC ) or print PLOG Failed to close $dsc\n 
+			return \();
 	}
 
 	return \%dsc_md5;
@@ -2957,26 +2958,29 @@
 	my $exp_md5 = shift; # Hashref of filenames and expected MD5sums.
 	my %obs_md5 = (); # Observed MD5sums.
 
-	open(OBS, '-|', $conf::md5sum, keys %$exp_md5) or return 1;
-	while (OBS) {
-		chomp;
-		if (/^[a-z0-9]{32}/) {
-			my @fields = split( /\s+/, $_ );
-			$obs_md5{$fields[1]} = $fields[0];
+	if (scalar keys %$exp_md5  0) {
+
+		open(OBS, '-|', $conf::md5sum, keys %$exp_md5) or return 1;
+		while (OBS) {
+			chomp;
+			if (/^[a-z0-9]{32}/) {
+my @fields = split( /\s+/, $_ );
+$obs_md5{$fields[1]} = $fields[0];
+			}
 		}
-	}
-	close( OBS ) or
-		print PLOG Failed to close m5sum\n  return 1;
+		close( OBS ) or
+			print PLOG Failed to close m5sum\n  return 1;
 
-	foreach (sort keys %$exp_md5) {
-		if (defined $exp_md5-{$_}  defined $obs_md5{$_}) {
-			if ($exp_md5-{$_} ne $obs_md5{$_}) {
-print PLOG $_: MD5SUM mismatch ($exp_md5-{$_} cf $obs_md5{$_}\n;
+		foreach (sort keys %$exp_md5) {
+			if (defined $exp_md5-{$_}  defined $obs_md5{$_}) {
+if ($exp_md5-{$_} ne $obs_md5{$_}) {
+	print PLOG $_: MD5SUM mismatch ($exp_md5-{$_} cf $obs_md5{$_}\n;
+	return 1;
+}
+			} else {
+print PLOG $_: Missing file\n;
 return 1;
 			}
-		} else {
-			print PLOG $_: Missing file\n;
-			return 1;
 		}
 	}
 


pgpLndHlUu0Su.pgp
Description: PGP signature


Bug#381118: [Buildd-tools-devel] Bug#381118: sbuild: schroot + apt download is broken

2006-08-03 Thread Roger Leigh
Daniel Stone [EMAIL PROTECTED] writes:

 On Wed, Aug 02, 2006 at 12:44:57PM +0100, Roger Leigh wrote:
 Daniel Stone [EMAIL PROTECTED] writes:
  When using schroot and apt to download packages, the build tanks
  quite early: apt-get source is called from within the chroot, but
  none of the verify_md5sum stuff is, so it tries to verify the dsc in
  ~/build/ in the host, and fails when it isn't there.
 
 Interesting.
 
 Perhaps we should still run apt-get outside the chroot, even when
 using schroot?  I originally introduced it to make setup simpler, and
 to work around some bugs with apt-get (specifically, apt-listchanges
 and friends, and it running some things outside the chroot even when
 you set all the config parameters to use the chroot).

 Depends what your usecase is.  My use for this is running an i386
 builder on amd64 (just requires a couple of hacks to pass the
 architecture name in).  I'd rather not have an sbuild chroot inside the
 i386 chroot inside my real amd64 system ...

That's a perfectly valid use case, IMO, and you do need the separation
for that to work.  I'll keep things the way they are.

  Interestingly, the failure mode is a hang in verify_md5sums, because
  dsc_md5sums returns null, and verify_md5sums ends up calling
  /usr/bin/md5sum, which hangs waiting for input ...
 
 That looks like an outright bug.  dsc_md5sums should, IMO, return an
 empty hashref on failure, but doesn't currently.

 Correct.

I have attached a patch to

- return an empty hashref on failure
- not to run md5sum if the hashref is empty

Please could you try the patch.  It will apply to the current sbuild,
or you can apply to

  svn://svn.debian.org/svn/buildd-tools/trunk/sbuild


This doesn't fix the root cause of the problem, just the bug in the
failure path.  Could you verify that this works?

Could you additionally try bind mounting /home into the build chroot,
and see if this makes any difference?  I think this may be a
requirement (current limitation), due to keeping the file location the
same when building with either sudo or schroot.  If this is the case,
it will take a bit more work to fix.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?   http://gutenprint.sourceforge.net/
   `-GPG Public Key: 0x25BFB848   Please sign and encrypt your mail.


pgphPqzzx8h3z.pgp
Description: PGP signature


Bug#381118: [Buildd-tools-devel] Bug#381118: sbuild: schroot + apt download is broken

2006-08-02 Thread Roger Leigh
Daniel Stone [EMAIL PROTECTED] writes:

 When using schroot and apt to download packages, the build tanks
 quite early: apt-get source is called from within the chroot, but
 none of the verify_md5sum stuff is, so it tries to verify the dsc in
 ~/build/ in the host, and fails when it isn't there.

Interesting.

Perhaps we should still run apt-get outside the chroot, even when
using schroot?  I originally introduced it to make setup simpler, and
to work around some bugs with apt-get (specifically, apt-listchanges
and friends, and it running some things outside the chroot even when
you set all the config parameters to use the chroot).

 Interestingly, the failure mode is a hang in verify_md5sums, because
 dsc_md5sums returns null, and verify_md5sums ends up calling
 /usr/bin/md5sum, which hangs waiting for input ...

That looks like an outright bug.  dsc_md5sums should, IMO, return an
empty hashref on failure, but doesn't currently.


I'm moving house in, ooh.. an hour and a half, and this computer is
about to be packed into a box, so I'll have to take a better look
tomorrow or Friday!


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?   http://gutenprint.sourceforge.net/
   `-GPG Public Key: 0x25BFB848   Please sign and encrypt your mail.


pgpUO1AbcYk7J.pgp
Description: PGP signature


Bug#381118: [Buildd-tools-devel] Bug#381118: sbuild: schroot + apt download is broken

2006-08-02 Thread Daniel Stone
On Wed, Aug 02, 2006 at 12:44:57PM +0100, Roger Leigh wrote:
 Daniel Stone [EMAIL PROTECTED] writes:
  When using schroot and apt to download packages, the build tanks
  quite early: apt-get source is called from within the chroot, but
  none of the verify_md5sum stuff is, so it tries to verify the dsc in
  ~/build/ in the host, and fails when it isn't there.
 
 Interesting.
 
 Perhaps we should still run apt-get outside the chroot, even when
 using schroot?  I originally introduced it to make setup simpler, and
 to work around some bugs with apt-get (specifically, apt-listchanges
 and friends, and it running some things outside the chroot even when
 you set all the config parameters to use the chroot).

Depends what your usecase is.  My use for this is running an i386
builder on amd64 (just requires a couple of hacks to pass the
architecture name in).  I'd rather not have an sbuild chroot inside the
i386 chroot inside my real amd64 system ...

  Interestingly, the failure mode is a hang in verify_md5sums, because
  dsc_md5sums returns null, and verify_md5sums ends up calling
  /usr/bin/md5sum, which hangs waiting for input ...
 
 That looks like an outright bug.  dsc_md5sums should, IMO, return an
 empty hashref on failure, but doesn't currently.

Correct.

 I'm moving house in, ooh.. an hour and a half, and this computer is
 about to be packed into a box, so I'll have to take a better look
 tomorrow or Friday!

Thanks a lot. :)

Cheers,
Daniel


signature.asc
Description: Digital signature