[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.2.6-35-g1dcd45e



The following commit has been merged in the master branch:
commit 1dcd45e8941505fe78995036a4f697ab43f31106
Author: Russ Allbery <rra@debian.org>
Date:   Tue Mar 3 17:22:51 2009 -0800

    Fix processing of tar data when unpacking source packages
    
    * unpack/unpack-srcpkg-l1:
      + [RA] When processing tar output, we may not get complete lines at a
        time.  Save partial lines and glue them back together again when we
        get the next burst of data.  (Closes: #517899)

diff --git a/debian/changelog b/debian/changelog
index b4cbbde..930db44 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -87,6 +87,11 @@ lintian (2.2.7) UNRELEASED; urgency=low
 
   * lib/Lintian/Collect/Binary.pm:
     + [RA] Recognize truncated binaries.  Patch from Raphael Geissert.
+
+  * unpack/unpack-srcpkg-l1:
+    + [RA] When processing tar output, we may not get complete lines at a
+      time.  Save partial lines and glue them back together again when we
+      get the next burst of data.  (Closes: #517899)
   
  -- Russ Allbery <rra@debian.org>  Sun, 22 Feb 2009 13:24:23 -0800
 
diff --git a/unpack/unpack-srcpkg-l1 b/unpack/unpack-srcpkg-l1
index 79b39e6..cd8b97d 100755
--- a/unpack/unpack-srcpkg-l1
+++ b/unpack/unpack-srcpkg-l1
@@ -93,8 +93,18 @@ if ($tarball =~ /\.lzma\z/) {
     unshift(@tar_options, '--lzma');
 }
 my @index;
+my $last = '';
 my $collect = sub {
-    for my $line (map { split "\n" } @_) {
+    my @lines = map { split "\n" } @_;
+    if ($last ne '') {
+        $lines[0] = $last . $lines[0];
+    }
+    if ($_[-1] !~ /\n\z/) {
+        $last = pop @lines;
+    } else {
+        $last = '';
+    }
+    for my $line (@lines) {
         $line =~ s/^h/-/;
         if ($line and $line !~ m,^(?:\S+\s+){5}\./$,) {
             push(@index, $line . "\n");
@@ -103,6 +113,9 @@ my $collect = sub {
 };
 spawn({ fail => 'error', out => $collect },
       ["tar", @tar_options, "$base_dir/$tarball"]);
+if ($last) {
+    fail("tar output doesn't end in a newline");
+}
 
 # We now need to see if all files in the tarball have a common prefix.  If so,
 # we're going to strip that prefix off each file name.  We also remove lines

-- 
Debian package checker


Reply to: