From 44d0ff683fc075a070ff0354e2f4687968ff8f0b Mon Sep 17 00:00:00 2001 From: Steve McIntyre Date: Tue, 23 Apr 2024 02:33:17 +0100 Subject: [PATCH] make_disc_trees.pl: if files will not fit on media, fail loudly rather than sitting in a loop foreber. Fail properly in #1069682 --- debian/changelog | 2 ++ tools/make_disc_trees.pl | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/debian/changelog b/debian/changelog index 2e076dcb..aa7002fd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,8 @@ debian-cd (3.2.2) UNRELEASED; urgency=medium * Look for firmware in /usr/lib/firmware as well as /lib/firmware. Closes: #1059858 * Fix counting of images at build time. Closes: #1063858 + * make_disc_trees.pl: if files will not fit on media, fail loudly + rather than sitting in a loop foreber. Fail properly in #1069682. [ Guido Berhoerster ] * Update DebianEdu installer banner and syslinux splash image diff --git a/tools/make_disc_trees.pl b/tools/make_disc_trees.pl index f13911de..276b252b 100755 --- a/tools/make_disc_trees.pl +++ b/tools/make_disc_trees.pl @@ -246,6 +246,10 @@ while (defined (my $pkg = )) { if (($pkgname =~ /^\Q$entry\E$/m)) { print LOG "Re-including $reinclude_pkg due to match on \"\^$entry\$\"\n"; $guess_size = int($hfs_mult * add_packages($cddir, $reinclude_pkg)); + if ($guess_size > $maxdiskblocks) { + print LOG "$reinclude_pkg will never fit - it is $guess_size blocks against a disk size of $maxdiskblocks. ABORT\n"; + die "$reinclude_pkg will never fit - it is $guess_size blocks against a disk size of $maxdiskblocks. ABORT\n"; + } $size += $guess_size; print LOG "CD $disknum: GUESS_TOTAL is $size after adding $reinclude_pkg\n"; $pkgs_this_cd++; @@ -259,6 +263,10 @@ while (defined (my $pkg = )) { my $overflowpkg = pop @overflowlist; print LOG "Adding a package that failed on the last disc: $overflowpkg\n"; $guess_size = int($hfs_mult * add_packages($cddir, $overflowpkg)); + if ($guess_size > $maxdiskblocks) { + print LOG "$overflowpkg will never fit - it is $guess_size blocks against a disk size of $maxdiskblocks. ABORT\n"; + die "$overflowpkg will never fit - it is $guess_size blocks against a disk size of $maxdiskblocks. ABORT\n"; + } $size += $guess_size; print LOG "CD $disknum: GUESS_TOTAL is $size after adding $overflowpkg\n"; $pkgs_this_cd++; @@ -281,6 +289,10 @@ while (defined (my $pkg = )) { } else { $guess_size = int($hfs_mult * add_packages($cddir, $pkg)); $size += $guess_size; + if ($guess_size > $maxdiskblocks) { + print LOG "$pkg will never fit - it is $guess_size blocks against a disk size of $maxdiskblocks. ABORT\n"; + die "$pkg will never fit - it is $guess_size blocks against a disk size of $maxdiskblocks. ABORT\n"; + } push (@pkgs_added, $pkg); print LOG "CD $disknum: GUESS_TOTAL is $size after adding $pkg\n"; if (($size > $maxdiskblocks) ||