From 928a7c06dc830455c246e1ccb8fd980c882b1637 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <e.dolstra@tudelft.nl>
Date: Sat, 18 Jun 2005 14:20:24 +0000
Subject: [PATCH] * Don't create patches for archives >= 150 MB because bsdiff
 can't   handle it.  It crashed on the 234 MB tetex archive.  Probably we  
 will never be able to handle archives of that size on 32-bit   machines
 (because bsdiff does everything in memory requiring   max(17*n,9*n+m)+O(1)
 bytes, so the address space simply isn't   there).

---
 scripts/generate-patches.pl.in | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/scripts/generate-patches.pl.in b/scripts/generate-patches.pl.in
index b27181da4..5dfacd896 100755
--- a/scripts/generate-patches.pl.in
+++ b/scripts/generate-patches.pl.in
@@ -277,13 +277,25 @@ foreach my $p (keys %dstOutPaths) {
         
         my $srcNarBz2 = getNarBz2 \%srcNarFiles, $closest;
         my $dstNarBz2 = getNarBz2 \%dstNarFiles, $p;
-        
+
+        my $maxNarSize = 150 * 1024 * 1024;
+
         system("@bunzip2@ < $srcNarBz2 > $tmpdir/A") == 0
             or die "cannot unpack $srcNarBz2";
 
+        if ((stat "$tmpdir/A")[7] >= $maxNarSize) {
+            print "    skipping, source is too large\n";
+            next;
+        }
+        
         system("@bunzip2@ < $dstNarBz2 > $tmpdir/B") == 0
             or die "cannot unpack $dstNarBz2";
 
+        if ((stat "$tmpdir/B")[7] >= $maxNarSize) {
+            print "    skipping, destination is too large\n";
+            next;
+        }
+        
         system("@libexecdir@/bsdiff $tmpdir/A $tmpdir/B $tmpdir/DIFF") == 0
             or die "cannot compute binary diff";
 
-- 
GitLab