From 3f22253b6c6225128abd8c51cb5b99fd7bb355b8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 9 Jan 2012 11:42:52 -0400 Subject: [PATCH] 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. 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 | 8 ++++++++ pristine-tar | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/debian/changelog b/debian/changelog index 4c0cf4b..bd35896 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 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 diff --git a/pristine-tar b/pristine-tar index 67a5bd2..06dae6b 100755 --- a/pristine-tar +++ b/pristine-tar @@ -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', -- 2.7.4