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;
 		}
 	}
 

Attachment: pgpLndHlUu0Su.pgp
Description: PGP signature

Reply via email to