From e7f21ce04c063bb232e9446994f2db7232c72fc2 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Thu, 23 Feb 2023 21:50:55 +0100 Subject: [PATCH] Do not die if reading the number of ext2 blocks failed as that would skip the cleanup action Reported-by: Helmut Grohne --- mmdebstrap | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index f9c5928..01d9954 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -6028,12 +6028,16 @@ sub main() { close $nblkwriter; if (!$options->{dryrun} && $format eq 'ext2') { $numblocks = <$nblkreader>; - if (!defined $numblocks) { + if (defined $numblocks) { + chomp $numblocks; + } else { # This can happen if the setup process died early and thus closes # the pipe from the other and. The EOF is turned into undef. - error "failed to read required number of blocks"; + # we cannot die here because that would skip the cleanup task + warning "failed to read required number of blocks"; + $exitstatus = 1; + $numblocks = -1; } - chomp $numblocks; } close $nblkreader;