tags 369707 + confirmed patch fixed-upstream pending
thanks

Martin Michlmayr <[EMAIL PROTECTED]> writes:

> I get the following warnings when I run sbuild using a chroot in which I have
> not figured on an apt-src line:
>
> Checking available source versions...
> Use of uninitialized value in split at /usr/bin/sbuild line 422, <PIPE> chunk 
> 1.
> Use of uninitialized value in hash element at /usr/bin/sbuild line 422, 
> <PIPE> chunk 1.
> /usr/bin/apt-cache failed

This is a case of not doing thorough checking of input.  The following
patch fixes this problem; I've applied it to upstream SVN.


Regards,
Roger

-- 
Roger Leigh
                Printing on GNU/Linux?  http://gutenprint.sourceforge.net/
                Debian GNU/Linux        http://www.debian.org/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.
Index: sbuild
===================================================================
--- sbuild	(revision 704)
+++ sbuild	(working copy)
@@ -416,11 +416,19 @@
 				return ("ERROR");
 			}
 			{ local($/) = "";
+			  my $ver;
+			  my $tfile;
 			  while( <PIPE> ) {
-				  my $ver = $1 if /^Version:\s+(\S+)\s*$/mi;
-				  my $tfile = $1 if /^Files:\s*\n((\s+.*\s*\n)+)/mi;
+				  $ver = $1 if /^Version:\s+(\S+)\s*$/mi;
+				  $tfile = $1 if /^Files:\s*\n((\s+.*\s*\n)+)/mi;
+			  }
+			  if (defined $ver && defined $tfile) {
 				  @{$entries{$ver}} = map { (split( /\s+/, $_ ))[3] }
 					  split( "\n", $tfile );
+			  } else {
+				  print PLOG "apt-cache returned no information about $pkg source\n";
+				  print PLOG "Are there any deb-src lines in your /etc/apt/sources.list?\n";
+				  return ("ERROR");
 			  }
 		  }
 			close( PIPE );
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 704)
+++ debian/changelog	(working copy)
@@ -1,3 +1,13 @@
+sbuild (0.47) UNRELEASED; urgency=low
+
+  * sbuild:
+    - fetch_source_files: When running apt-cache, check if we got valid
+      output, and warn appropriately if the output is invalid
+      (Closes: #369707).  Output may be invalid if there are no deb-src
+      lines in /etc/apt/sources.list in the chroot.
+
+ --
+
 sbuild (0.46) unstable; urgency=low
 
   * sbuild:

Attachment: pgpeeMyEA4WPg.pgp
Description: PGP signature

Reply via email to