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.
pull/1/head
parent af5841269c
commit 08319f6c77
Signed by: josch
GPG Key ID: F2CBA5C78FBD83E1

@ -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> }

Loading…
Cancel
Save