diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-12-29T19·32+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-12-29T19·32+0000 |
commit | 54d8f0858825e9ae4c8fdf54b7c2019edee05237 (patch) | |
tree | 91a0fd2f53e7055b0dda40da4e54a3d3afc89171 /scripts | |
parent | 2fdb27e7f21c99174d35556575e3d25bf2bdc23e (diff) |
* Reject patches larger than the full archives they produce.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/generate-patches.pl | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/scripts/generate-patches.pl b/scripts/generate-patches.pl index 7d957839bb24..b20360fc6e3d 100755 --- a/scripts/generate-patches.pl +++ b/scripts/generate-patches.pl @@ -191,13 +191,19 @@ foreach my $p (keys %dstOutPaths) { my $narHash = `nix-hash --flat $tmpdir/B` or die; chomp $narHash; - my $narBz2Hash = `nix-hash --flat $tmpdir/DIFF` or die; - chomp $narBz2Hash; + my $narDiffHash = `nix-hash --flat $tmpdir/DIFF` or die; + chomp $narDiffHash; - my $narBz2Size = (stat "$tmpdir/DIFF")[7]; + my $narDiffSize = (stat "$tmpdir/DIFF")[7]; + my $dstNarBz2Size = (stat $dstNarBz2)[7]; + + if ($narDiffSize >= $dstNarBz2Size) { + print " rejecting; patch bigger than full archive\n"; + next; + } my $finalName = - "$narBz2Hash-$name-$closestVersion-to-$version.nar-diff"; + "$narDiffHash-$name-$closestVersion-to-$version.nar-diff"; if (-e "$patchesDir/$finalName") { print " not copying, already exists\n"; @@ -212,8 +218,8 @@ foreach my $p (keys %dstOutPaths) { # Add the patch to the manifest. addPatch \%dstPatches, $p, - { url => "$patchesURL/$finalName", hash => $narBz2Hash - , size => $narBz2Size + { url => "$patchesURL/$finalName", hash => $narDiffHash + , size => $narDiffSize , basePath => $closest, baseHash => $baseHash , narHash => $narHash, patchType => "nar-bsdiff" }; |