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

[SCM] Debian package checker branch, master, updated. 2.2.9-24-g43e44ec



The following commit has been merged in the master branch:
commit 43e44ecfc94c8dc419d6501f147554205f7014a0
Author: Russ Allbery <rra@debian.org>
Date:   Mon Apr 27 00:36:08 2009 -0700

    Store and process tar errors in the laboratory
    
    * checks/cruft{,.desc}:
      + [RA] Report errors from tar or dpkg-source when listing or unpacking
        the source package, skipping and suppressing some harmless errors.
    * checks/deb-format{,.desc}:
      + [RA] Report tar errors from listing or unpacking the control or data
        members of the package, suppressing uninteresting errors or errors
        that are caught some other way.  (Closes: #367327)
    * unpack/unpack-binpkg-l1:
      + [RA] Save control unpack errors in control-errors, control listing
        errors in control-index-errors, and package listing errors in
        index-errors for later processing by deb-format.  (Closes: #522530)
    * unpack/unpack-binpkg-l2:
      + [RA] Save data unpack errors in unpacked-errors for later processing
        by deb-format.
    * unpack/unpack-srcpkg-l1:
      + [RA] Save source listing errors in index-errors for later processing
        by cruft.  Don't fail the unpack if tar exits with non-zero status.
        star-created archives  will cause tar to blow up, but the listing
        and unpacking still works.
    * unpack/unpack-srcpkg-l2:
      + [RA] Save source unpack errors in unpacked-errors for later
        processing by cruft.

diff --git a/checks/cruft b/checks/cruft
index f9191cd..97aea5e 100644
--- a/checks/cruft
+++ b/checks/cruft
@@ -42,6 +42,11 @@ our $AUTOTOOLS = Lintian::Relation->new(join(' | ',
     qw(autotools-dev automake automaken automake1.4 automake1.7 automake1.8
        automake1.9 automake1.10)));
 
+# The files that contain error messages from tar, which we'll check and issue
+# tags for if they contain something unexpected, and their corresponding tags.
+our %ERRORS = ('index-errors'    => 'tar-errors-from-source',
+               'unpacked-errors' => 'tar-errors-from-source');
+
 # Directory checks.  These regexes match a directory that shouldn't be in the
 # source package and associate it with a tag (minus the leading
 # source-contains or diff-contains).  Note that only one of these regexes
@@ -135,6 +140,33 @@ for my $file (keys(%$file_info)) {
     }
 }
 
+# Report any error messages from tar while unpacking the source package if it
+# isn't just tar cruft.
+for my $file (keys %ERRORS) {
+    my $tag = $ERRORS{$file};
+    if (-s $file) {
+        open(ERRORS, '<', $file) or fail("cannot open $file: $!");
+        local $_;
+        while (<ERRORS>) {
+            chomp;
+            s,^(?:[/\w]+/)?tar: ,,;
+
+            # Record size errors are harmless.  Skipping to next header
+            # apparently comes from star files.  Ignore all GnuPG noise from
+            # not having a valid GnuPG configuration directory.  Also ignore
+            # the tar "exiting with failure status" message, since it comes
+            # after some other error.
+            next if /^Record size =/;
+            next if /^Skipping to next header/
+            next if /^gpg: /;
+            next if /^secmem usage: /;
+            next if /^Exiting with failure status due to previous errors/;
+            tag $tag, $_;
+        }
+        close ERRORS;
+    }
+}
+
 } # </run>
 
 # -----------------------------------
diff --git a/checks/cruft.desc b/checks/cruft.desc
index 68b2802..4de77b0 100644
--- a/checks/cruft.desc
+++ b/checks/cruft.desc
@@ -391,3 +391,11 @@ Info: The source tarball contains a prebuilt binary for Microsoft Windows.
  that upstream also provides tarballs source-only tarballs which you can use.
  These files usually just take up space in the tarball and are of no use in
  Debian.  You may want to ask upstream to provide source-only tarballs.
+
+Tag: tar-errors-from-source
+Severity: normal
+Certainty: wild-guess
+Info: tar produced an error while unpacking this source package.  This
+ probably means there's something broken or at least strange about the way
+ the upstream tar file was constructed.  You may want to report this as an
+ upstream bug.
diff --git a/checks/deb-format b/checks/deb-format
index 5de71ab..ebbcc17 100644
--- a/checks/deb-format
+++ b/checks/deb-format
@@ -21,6 +21,13 @@ use Tags;
 
 use Lintian::Command qw(spawn);
 
+# The files that contain error messages from tar, which we'll check and issue
+# tags for if they contain something unexpected, and their corresponding tags.
+our %ERRORS = ('control-errors'       => 'tar-errors-from-control',
+               'control-index-errors' => 'tar-errors-from-control',
+               'index-errors'         => 'tar-errors-from-data',
+               'unpacked-errors'      => 'tar-errors-from-data');
+
 sub run {
 
 my $pkg = shift;
@@ -76,6 +83,31 @@ if ($okay) {
     }
 }
 
+# If either control-errors or index-errors exist, tar produced error output
+# when processing the package.  We want to report those as tags unless they're
+# just tar noise that doesn't represent an actual problem.
+for my $file (keys %ERRORS) {
+    my $tag = $ERRORS{$file};
+    if (-s $file) {
+        open(ERRORS, '<', $file) or fail("cannot open $file: $!");
+        local $_;
+        while (<ERRORS>) {
+            chomp;
+            s,^(?:[/\w]+/)?tar: ,,;
+
+            # Record size errors are harmless.  Ignore implausibly old
+            # timestamps in the data section since we already check for that
+            # elsewhere, but still warn for control.
+            next if /^Record size =/;
+            if ($tag eq 'tar-errors-from-data') {
+                next if /implausibly old time stamp/;
+            }
+            tag $tag, $_;
+        }
+        close ERRORS;
+    }
+}
+
 }
 
 1;
diff --git a/checks/deb-format.desc b/checks/deb-format.desc
index 0db2c2e..dd0ad04 100644
--- a/checks/deb-format.desc
+++ b/checks/deb-format.desc
@@ -2,7 +2,7 @@ Check-Script: deb-format
 Author: Russ Allbery <rra@debian.org>
 Abbrev: dfmt
 Type: binary, udeb
-Unpack-Level: 1
+Unpack-Level: 2
 Info: This script checks the format of the deb ar archive itself.
 
 Tag: malformed-deb-archive
@@ -22,3 +22,18 @@ Certainty: certain
 Info: The data portion of this binary package is compressed with lzma.
  This is supported by dpkg but not yet permitted in the Debian archive.
  Such a package will be rejected by DAK.
+
+Tag: tar-errors-from-control
+Severity: important
+Certainty: possible
+Info: tar produced an error while listing the contents of the
+ <tt>control.tar.gz</tt> member of this package.  This probably means
+ there's something broken or at least strange about the way the package
+ was constructed.
+
+Tag: tar-errors-from-data
+Severity: important
+Certainty: possible
+Info: tar produced an error while listing the contents of the data
+ member of this package.  This probably means there's something broken or
+ at least strange about the way the package was constructed.
diff --git a/debian/changelog b/debian/changelog
index 9afe10f..5c23d52 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,9 @@ lintian (2.2.10) UNRELEASED; urgency=low
   * Summary of tag changes:
     + Added:
       - ancient-autotools-helper-file
+      - tar-errors-from-control
+      - tar-errors-from-data
+      - tar-errors-from-source
     + Removed:
       - desktop-mimetype-without-update-call
       - package-uses-breaks
@@ -17,6 +20,12 @@ lintian (2.2.10) UNRELEASED; urgency=low
       that aren't used during the Debian package build.
     + [RA] Document that cdbs still requires the autotools-dev build
       dependency to update config.{sub,guess} at build time.
+    + [RA] Report errors from tar or dpkg-source when listing or unpacking
+      the source package, skipping and suppressing some harmless errors.
+  * checks/deb-format{,.desc}:
+    + [RA] Report tar errors from listing or unpacking the control or data
+      members of the package, suppressing uninteresting errors or errors
+      that are caught some other way.  (Closes: #367327)
   * checks/fields{,.desc}:
     + [RA] Remove package-uses-breaks.  dpkg in stable now supports it.
       Thanks, Julian Andres Klode.  (Closes: #522660)
@@ -83,6 +92,22 @@ lintian (2.2.10) UNRELEASED; urgency=low
     + [ADB] Mention the new Standards-Version field available for tests.
       Patch by Raphael Geissert.
 
+  * unpack/unpack-binpkg-l1:
+    + [RA] Save control unpack errors in control-errors, control listing
+      errors in control-index-errors, and package listing errors in
+      index-errors for later processing by deb-format.  (Closes: #522530)
+  * unpack/unpack-binpkg-l2:
+    + [RA] Save data unpack errors in unpacked-errors for later processing
+      by deb-format.
+  * unpack/unpack-srcpkg-l1:
+    + [RA] Save source listing errors in index-errors for later processing
+      by cruft.  Don't fail the unpack if tar exits with non-zero status.
+      star-created archives  will cause tar to blow up, but the listing
+      and unpacking still works.
+  * unpack/unpack-srcpkg-l2:
+    + [RA] Save source unpack errors in unpacked-errors for later
+      processing by cruft.
+
  -- Adam D. Barratt <adam@adam-barratt.org.uk>  Sun, 05 Apr 2009 20:42:34 +0100
 
 lintian (2.2.9) unstable; urgency=low
diff --git a/t/debs/deb-format-ancient-file/Makefile b/t/debs/deb-format-ancient-file/Makefile
new file mode 100644
index 0000000..89d2771
--- /dev/null
+++ b/t/debs/deb-format-ancient-file/Makefile
@@ -0,0 +1,19 @@
+all:
+	echo '2.0' > debian-binary
+	mkdir -p usr/share/doc/deb-format-ancient-file
+	cp copyright changelog usr/share/doc/deb-format-ancient-file
+	gzip -9 usr/share/doc/deb-format-ancient-file/changelog
+	env TZ=GMT touch -t 197001010000 \
+	    usr/share/doc/deb-format-ancient-file/changelog.gz
+	tar -c -z -f data.tar.gz usr
+	chown 0:0 control
+	chmod 644 control
+	env TZ=GMT touch -t 197001010000 control
+	md5sum usr/share/doc/deb-format-ancient-file/* > md5sums
+	tar -c -z -f control.tar.gz control md5sums
+	ar rc deb-format-ancient-file.deb \
+	    debian-binary control.tar.gz data.tar.gz
+
+clean:
+	rm -f *.tar.gz *.deb md5sums debian-binary
+	rm -rf usr
diff --git a/t/debs/deb-format-lzma/changelog b/t/debs/deb-format-ancient-file/changelog
similarity index 69%
copy from t/debs/deb-format-lzma/changelog
copy to t/debs/deb-format-ancient-file/changelog
index 2fbdc04..4235564 100644
--- a/t/debs/deb-format-lzma/changelog
+++ b/t/debs/deb-format-ancient-file/changelog
@@ -1,4 +1,4 @@
-deb-format-lzma (1.0) unstable; urgency=low
+deb-format-ancient-file (1.0) unstable; urgency=low
 
   * A Lintian test case.
 
diff --git a/t/debs/description-synopsis-spaces/control b/t/debs/deb-format-ancient-file/control
similarity index 79%
copy from t/debs/description-synopsis-spaces/control
copy to t/debs/deb-format-ancient-file/control
index 41cfe79..560622a 100644
--- a/t/debs/description-synopsis-spaces/control
+++ b/t/debs/deb-format-ancient-file/control
@@ -1,10 +1,10 @@
-Package: description-synopsis-spaces
+Package: deb-format-ancient-file
 Version: 1.0
 Architecture: all
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Section: devel
 Priority: extra
-Description:     the synopsis starts with spaces
+Description: Test package containing an ancient file
  This is a test package designed to exercise some feature or tag of
  Lintian.  It is part of the Lintian test suite and may do very odd
  things.  It should not be installed like a regular package.
diff --git a/t/debs/deb-format-extra-member/copyright b/t/debs/deb-format-ancient-file/copyright
similarity index 100%
copy from t/debs/deb-format-extra-member/copyright
copy to t/debs/deb-format-ancient-file/copyright
diff --git a/t/debs/deb-format-ancient-file/tags b/t/debs/deb-format-ancient-file/tags
new file mode 100644
index 0000000..fa732ab
--- /dev/null
+++ b/t/debs/deb-format-ancient-file/tags
@@ -0,0 +1,2 @@
+E: deb-format-ancient-file: package-contains-ancient-file usr/share/doc/deb-format-ancient-file/changelog.gz 1969-12-31
+E: deb-format-ancient-file: tar-errors-from-control control: implausibly old time stamp 1969-12-31 16:00:00
diff --git a/t/debs/deb-format-lzma/control b/t/debs/deb-format-lzma/control
index 4f9a963..54147db 100644
--- a/t/debs/deb-format-lzma/control
+++ b/t/debs/deb-format-lzma/control
@@ -4,7 +4,7 @@ Architecture: all
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Section: devel
 Priority: extra
-Description: Test package for an ar archive in the wrong order
+Description: Test package with LZMA compression
  This is a test package designed to exercise some feature or tag of
  Lintian.  It is part of the Lintian test suite and may do very odd
  things.  It should not be installed like a regular package.
diff --git a/t/debs/deb-format-record-size/Makefile b/t/debs/deb-format-record-size/Makefile
new file mode 100644
index 0000000..4f223f9
--- /dev/null
+++ b/t/debs/deb-format-record-size/Makefile
@@ -0,0 +1,16 @@
+all:
+	echo '2.0' > debian-binary
+	mkdir -p usr/share/doc/deb-format-record-size
+	cp copyright changelog usr/share/doc/deb-format-record-size
+	gzip -9 usr/share/doc/deb-format-record-size/changelog
+	tar --record-size=4096 -c -z -f data.tar.gz usr
+	chown 0:0 control
+	chmod 644 control
+	md5sum usr/share/doc/deb-format-record-size/* > md5sums
+	tar --record-size=4096 -c -z -f control.tar.gz control md5sums
+	ar rc deb-format-record-size.deb \
+	    debian-binary control.tar.gz data.tar.gz
+
+clean:
+	rm -f *.tar.gz *.deb md5sums debian-binary
+	rm -rf usr
diff --git a/t/debs/deb-format-lzma/changelog b/t/debs/deb-format-record-size/changelog
similarity index 69%
copy from t/debs/deb-format-lzma/changelog
copy to t/debs/deb-format-record-size/changelog
index 2fbdc04..b28456d 100644
--- a/t/debs/deb-format-lzma/changelog
+++ b/t/debs/deb-format-record-size/changelog
@@ -1,4 +1,4 @@
-deb-format-lzma (1.0) unstable; urgency=low
+deb-format-record-size (1.0) unstable; urgency=low
 
   * A Lintian test case.
 
diff --git a/t/debs/deb-format-lzma/control b/t/debs/deb-format-record-size/control
similarity index 77%
copy from t/debs/deb-format-lzma/control
copy to t/debs/deb-format-record-size/control
index 4f9a963..fc57f31 100644
--- a/t/debs/deb-format-lzma/control
+++ b/t/debs/deb-format-record-size/control
@@ -1,10 +1,10 @@
-Package: deb-format-lzma
+Package: deb-format-record-size
 Version: 1.0
 Architecture: all
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Section: devel
 Priority: extra
-Description: Test package for an ar archive in the wrong order
+Description: Test package with a non-standard tar record size
  This is a test package designed to exercise some feature or tag of
  Lintian.  It is part of the Lintian test suite and may do very odd
  things.  It should not be installed like a regular package.
diff --git a/t/debs/deb-format-extra-member/copyright b/t/debs/deb-format-record-size/copyright
similarity index 100%
copy from t/debs/deb-format-extra-member/copyright
copy to t/debs/deb-format-record-size/copyright
diff --git a/t/debs/description-synopsis-spaces/tags b/t/debs/deb-format-record-size/tags
similarity index 100%
copy from t/debs/description-synopsis-spaces/tags
copy to t/debs/deb-format-record-size/tags
diff --git a/t/source/unpack-srcpkg-lzma/Makefile b/t/source/cruft-ancient-file/Makefile
similarity index 62%
copy from t/source/unpack-srcpkg-lzma/Makefile
copy to t/source/cruft-ancient-file/Makefile
index e32eb50..3af9fb3 100644
--- a/t/source/unpack-srcpkg-lzma/Makefile
+++ b/t/source/cruft-ancient-file/Makefile
@@ -1,14 +1,15 @@
-name = unpack-srcpkg-lzma
+name = cruft-ancient-file
 dir  = $(name)-1.0
 
 all:
 	mkdir $(dir)
 	echo 'Some upstream README' > $(dir)/README
-	tar -c -f $(name)_1.0.orig.tar.lzma --lzma $(dir)
+	env TZ=GMT touch -t 197001010000 $(dir)/README
+	tar -c -f $(name)_1.0.orig.tar.gz -z $(dir)
 	mkdir $(dir)/debian
 	cp changelog copyright control rules $(dir)/debian/
 	echo 7 > $(dir)/debian/compat
-	touch $(dir)/debian/watch
+	echo '# foo' > $(dir)/debian/watch
 	dpkg-source -sp -b $(dir)
 
 clean:
diff --git a/t/source/unpack-srcpkg-lzma/changelog b/t/source/cruft-ancient-file/changelog
similarity index 70%
copy from t/source/unpack-srcpkg-lzma/changelog
copy to t/source/cruft-ancient-file/changelog
index dec3a7c..8b4761e 100644
--- a/t/source/unpack-srcpkg-lzma/changelog
+++ b/t/source/cruft-ancient-file/changelog
@@ -1,7 +1,7 @@
-unpack-srcpkg-lzma (1.0-1) unstable; urgency=low
+cruft-ancient-file (1.0-1) unstable; urgency=low
 
   * Lintian Test Suite.
-  * Test: unpack-srcpkg-lzma
+  * Test: cruft-ancient-file
 
   * Suppress "should close ITP bug" messages.  (Closes: #123456)
 
diff --git a/t/source/unpack-srcpkg-dot-dir/control b/t/source/cruft-ancient-file/control
similarity index 75%
copy from t/source/unpack-srcpkg-dot-dir/control
copy to t/source/cruft-ancient-file/control
index 1663213..f1cfc89 100644
--- a/t/source/unpack-srcpkg-dot-dir/control
+++ b/t/source/cruft-ancient-file/control
@@ -1,14 +1,14 @@
-Source: unpack-srcpkg-dot-dir
+Source: cruft-ancient-file
 Section: devel
 Priority: optional
 Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
 Build-Depends: debhelper (>= 7)
 Standards-Version: 3.8.0
 
-Package: unpack-srcpkg-dot-dir
+Package: cruft-ancient-file
 Architecture: all
 Depends: ${misc:Depends}
-Description: Test package for upstream tar files with a ./ prefix
+Description: Test package for ancient files producing tar errors
  This is a test package designed to exercise some feature or tag of
  Lintian.  It is part of the Lintian test suite and may do very odd
  things.  It should not be installed like a regular package.
diff --git a/t/debs/deb-format-extra-member/copyright b/t/source/cruft-ancient-file/copyright
similarity index 100%
copy from t/debs/deb-format-extra-member/copyright
copy to t/source/cruft-ancient-file/copyright
diff --git a/t/source/unpack-srcpkg-dot-dir/rules b/t/source/cruft-ancient-file/rules
similarity index 100%
copy from t/source/unpack-srcpkg-dot-dir/rules
copy to t/source/cruft-ancient-file/rules
diff --git a/t/source/cruft-ancient-file/tags b/t/source/cruft-ancient-file/tags
new file mode 100644
index 0000000..d4439d4
--- /dev/null
+++ b/t/source/cruft-ancient-file/tags
@@ -0,0 +1 @@
+I: cruft-ancient-file source: tar-errors-from-source cruft-ancient-file-1.0/README: implausibly old time stamp 1969-12-31 16:00:00
diff --git a/unpack/unpack-binpkg-l1 b/unpack/unpack-binpkg-l1
index a423ef2..d32b9e2 100755
--- a/unpack/unpack-binpkg-l1
+++ b/unpack/unpack-binpkg-l1
@@ -55,13 +55,15 @@ spawn({ fail => 'error', out => "$base_dir/control.tar" },
       ['ar', 'p', $file, 'control.tar.gz'],
       '|', ['gzip', '-dc']);
 
-$job = { fail =>'error' };
+$job = { fail => 'error', err => "$base_dir/control-errors" };
 push @jobs, $job;
 # extract the tarball's contents
 spawn($job,
       ["tar", "xf", "$base_dir/control.tar", "-C", "$base_dir/control", '&']);
 
-$job = { fail =>'error', out => "$base_dir/control-index" };
+$job = { fail => 'error',
+         out  => "$base_dir/control-index",
+         err  => "$base_dir/control-index-errors" };
 push @jobs, $job;
 # create index of control.tar.gz
 spawn($job,
@@ -77,7 +79,9 @@ unlink("$base_dir/control.tar") or fail();
 spawn({ fail => 'error' },
       ["chmod", "-R", "u+rX,o-w", "$base_dir/control"]);
 
-$job = { fail => 'error', out => "$base_dir/index" };
+$job = { fail => 'error',
+         out  => "$base_dir/index",
+         err  => "$base_dir/index-errors" };
 push @jobs, $job;
 # (replaces dpkg-deb -c)
 # create index file for package
@@ -87,7 +91,9 @@ spawn($job,
       '|', ["sed", "-e", "s/^h/-/"],
       '|', ["sort", "-k", "6"], '&');
 
-$job = { fail => 'error', out => "$base_dir/index-owner-id" };
+$job = { fail => 'error',
+         out  => "$base_dir/index-owner-id",
+         err  => '/dev/null' };
 push @jobs, $job;
 # (replaces dpkg-deb -c)
 # create index file for package with owner IDs instead of names
diff --git a/unpack/unpack-binpkg-l2 b/unpack/unpack-binpkg-l2
index 2b04df1..78d3184 100755
--- a/unpack/unpack-binpkg-l2
+++ b/unpack/unpack-binpkg-l2
@@ -38,7 +38,7 @@ mkdir("$base_dir/unpacked", 0777) or fail();
 # improvement on large debs, and factor 1.5 on small debs.  I heard
 # it's because dpkg-deb syncs while writing.  -- Richard
 
-spawn({ fail => 'error' },
+spawn({ fail => 'error', err => "$base_dir/unpacked-errors" },
       ['dpkg-deb', '--fsys-tarfile', "$base_dir/deb"],
       '|', ['tar', 'xf', '-', '-C', "$base_dir/unpacked"]);
 
diff --git a/unpack/unpack-srcpkg-l1 b/unpack/unpack-srcpkg-l1
index fb6bc3d..b70f9ce 100755
--- a/unpack/unpack-srcpkg-l1
+++ b/unpack/unpack-srcpkg-l1
@@ -113,7 +113,7 @@ my $collect = sub {
         }
     }
 };
-spawn({ fail => 'error', out => $collect },
+spawn({ fail => 'never', out => $collect, err => "$base_dir/index-errors" },
       ["tar", @tar_options, "$base_dir/$tarball"]);
 if ($last) {
     fail("tar output doesn't end in a newline");
diff --git a/unpack/unpack-srcpkg-l2 b/unpack/unpack-srcpkg-l2
index 9e2c995..ec8263a 100755
--- a/unpack/unpack-srcpkg-l2
+++ b/unpack/unpack-srcpkg-l2
@@ -36,7 +36,7 @@ chdir($base_dir);
 
 # Ignore STDOUT of the child process because older versions of dpkg-source
 # print things out even with -q.
-spawn({ fail => 'error', out => '/dev/null' },
+spawn({ fail => 'error', out => '/dev/null', err => 'unpacked-errors' },
       ['dpkg-source', '-q', '-x', 'dsc', 'unpacked']);
 
 # fix permissions

-- 
Debian package checker


Reply to: