From 08319f6c776918bc622040fdb5482359bdacdd2e Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Sat, 2 May 2020 23:51:58 +0200 Subject: [PATCH] Return the same block number irrespective of what is in /dev Depending on the mode an on whether mknod works (mount options of $TMPDIR) different stuff might be in /dev. To make the blocksize in of the ext2 output format reproducible, ignore the content of /dev. --- mmdebstrap | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mmdebstrap b/mmdebstrap index 23c7f96..a12373a 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -2857,8 +2857,10 @@ sub guess_sources_format { sub approx_disk_usage { my $directory = shift; info "approximating disk usage..."; + # to return the same number of blocks irrespective of the chosen mode + # we exclude /dev from being counted open my $fh, '-|', 'du', '--block-size', '1024', - '--summarize', '--one-file-system', + "--exclude=$directory/dev", '--summarize', '--one-file-system', $directory // error "failed to fork(): $!"; chomp( my $du = do { local $/; <$fh> }