[buildd-tools-devel] Bug#825359: Aw: Re: sbuild: unrealistic figure about total space used

Helge Deller deller at gmx.de
Fri Jul 1 13:55:28 UTC 2016


I found the bug.

> > The bug seems to be somewhere in the Build.pm script:
> > https://anonscm.debian.org/cgit/buildd-tools/sbuild.git/log/lib/Sbuild/Build.pm

That was correct.
This patch (sorry, copy&pasted in here!) fixes it:

diff -up ./Build.pm.org ./Build.pm
--- ./Build.pm.org      2016-07-01 12:28:47.235506948 +0200
+++ ./Build.pm  2016-07-01 15:51:25.750862622 +0200
@@ -2187,7 +2187,8 @@ sub check_space {
        if ($pkgbuilddirspc !~ /^(\d+)/) {
            $self->log_error("Cannot determine space needed (unexpected du output): $space\n");
        }
-       $sum += $1;
+       $sum += $space;
     }
 
     $self->set('This Time', $self->get('Pkg End Time') - $self->get('Pkg Start Time'));



The patch is obvious if you look at the full code of the loop:

    foreach (@files) {
        my $space = $self->get('Host')->read_command(
            { COMMAND => ['du', '-k', '-s', $_],           USER => $self->get_conf('USERNAME'),              PRIORITY => 0,              DIR => '/'});

        if (!$space) {
            $self->log_error("Cannot determine space needed (du failed): $!\n");
            next;
        }
        if ($pkgbuilddirspc !~ /^(\d+)/) {
            $self->log_error("Cannot determine space needed (unexpected du output): $space\n");
        }

        $sum += $1;
    }

The "$sum+=$1" is wrong. Instead it needs to read "$sum+=$space;"

Helge



More information about the Buildd-tools-devel mailing list