Subject: Re: bug#53194: System test partition.img differs in size across hosts(?)

From: Maxim Cournoyer <[email-masked]>
Date: Sat, 05 Feb 2022 23:42:38 -0500

Hello,

Maxim Cournoyer <[email-masked]> writes:

> Hi Tobias,
>
> [...]
>
>> diff --git a/gnu/build/image.scm b/gnu/build/image.scm
>> index bdd5ec25a9..81caa424f8 100644
>> --- a/gnu/build/image.scm
>> +++ b/gnu/build/image.scm
>> @@ -3,7 +3,7 @@
>>  ;;; Copyright © 2016 Christine Lemmer-Webber <[email-masked]>
>>  ;;; Copyright © 2016, 2017 Leo Famulari <[email-masked]>
>>  ;;; Copyright © 2017 Marius Bakke <[email-masked]>
>> -;;; Copyright © 2020 Tobias Geerinckx-Rice <[email-masked]>
>> +;;; Copyright © 2020, 2022 Tobias Geerinckx-Rice <[email-masked]>
>>  ;;; Copyright © 2020 Mathieu Othacehe <[email-masked]>
>>  ;;;
>>  ;;; This file is part of GNU Guix.
>> @@ -62,8 +62,10 @@ (define (size-in-kib size)
>>  
>>  (define (estimate-partition-size root)
>>    "Given the ROOT directory, evaluate and return its size.  As this doesn't
>> -take the partition metadata size into account, take a 25% margin."
>> -  (* 1.25 (file-size root)))
>> +take the partition metadata size into account, take a 25% margin.  As this in
>> +turn doesn't take any constant overhead into account, force a 1-MiB minimum."
>> +  (max (ash 1 20)
>> +       (* 1.25 (file-size root))))
>>  
>>  (define* (make-ext-image partition target root
>>                           #:key
>
> Looks reasonable to me (although it is interesting that the behavior is
> not the same across machines...).
>
> While at it, you may want to fix this docstring:
>
>  (define (file-size file)
> -  "Return the size of bytes of FILE, entering it if FILE is a directory."
> +  "Return the size in bytes of FILE, entering it if FILE is a directory."
>    (file-system-fold (const #t)
>                      (lambda (file stat result)    ;leaf
>                        (+ (stat:size stat) result))
>
> in guix/build/store-copy.scm.

FYI, I pushed this workaround in
3c3c9d259f87fbc8c1d9551af32e79f9f168f596.

Thanks,

Maxim