pristine-tar: Fail when the delta is excessively large, probably due to the tarball...
authorJoey Hess <joey@kitenet.net>
Mon, 9 Jan 2012 15:42:52 +0000 (11:42 -0400)
committerJoey Hess <joey@kitenet.net>
Mon, 9 Jan 2012 15:42:56 +0000 (11:42 -0400)
It would be cleaner to test the tarball's magic to see if it's a regular,
non-compressed tarball. But, there are a lot of historical tar-like
formats, so implementing magic for tar is hard. (And I don't use file(1)
in pristine-tar).

Anyway, this also catches any other failure that can result in a delta >=
the size of the input. Completely failing to get any of the input files
right could also make this happen, perhaps.

debian/changelog
pristine-tar

index 4c0cf4b..bd35896 100644 (file)
@@ -1,3 +1,11 @@
+pristine-tar (1.17) UNRELEASED; urgency=low
+
+  * pristine-tar: Fail when the delta is excessively large, probably
+    due to the tarball being compressed with something that tar x can 
+    auto-extract, but that pristine-tar does not support.
+
+ -- Joey Hess <joeyh@debian.org>  Mon, 09 Jan 2012 11:41:49 -0400
+
 pristine-tar (1.16) unstable; urgency=low
 
   * pristine-bz2: Can recreate bz2 files greated by Suse's
index 67a5bd2..06dae6b 100755 (executable)
@@ -500,6 +500,17 @@ sub gendelta {
                error "xdelta failed with return code $ret";
        }
 
+       if (-s $delta{delta} >= -s $tarball) {
+               print STDERR "error: excessively large binary delta for $tarball\n";
+               if (! defined $compression) {
+                       print STDERR "(Probably the tarball is compressed with an unsupported form of compression.)\n";
+               }
+               else {
+                       print STDERR "(Please consider filing a bug report.)\n";
+               }
+               exit 1;
+       }
+
        Pristine::Tar::Delta::write(Tarball => $deltafile, {
                version => 2,
                type => 'tar',