Subject: Re: bug#42009: package.cache not deterministic

From: Msavoritias <[email-masked]>
Date: Wed, 24 Jun 2020 20:59:17 +0200

Hi,

Yeah seems like it. Although I have to admit I'm pretty newbie in a lot 
of this stuff.
Do you suggest this bug should be filed against Guile?

Marinus

On Wed, Jun 24, 2020 at 00:46, zimoun <[email-masked]> wrote:
> Dear,
> 
> Thank you for the bug report.  It is something already noticed [1] but
> without a clean bug report to track it. :-)
> 
> 1: <http://issues.guix.gnu.org/issue/39258#86>
> 
> 
> On Mon, 22 Jun 2020 at 19:07, Marinus <[email-masked] 
> <mailto:[email-masked]>> wrote:
> 
>>  Run into a determinism problem today with guix pull.
>>  I run guix pull --rounds=3 but guix ended in error that the result
>>  wasn't the same.
> 
> For reproducing, the simplest is:
> 
> --8<---------------cut here---------------start------------->8---
> $ guix build --check --no-grafts -K \
>    $(guix gc --derivers \
>       $(readlink -f ~/.config/guix/current/lib/guix/package.cache))
> The following profile hooks will be built:
>    /gnu/store/l50sinckbl1y0fz2y4yk4vvfdvay9c8l-guix-package-cache.drv
>    /gnu/store/h69hdf14c11q7dip0gssfd4cv0qw8j7k-guix-package-cache.drv
> building package cache...
> (repl-version 0 1 1)
> Generating package cache for 
> '/gnu/store/67zi87xwv2d90kx8pzxsbw2q7qkh11ns-profile'...
> (values (value 
> "/gnu/store/0009whxhfz00lm027wbars8q4wb3rvia-guix-package-cache/lib/guix/package.cache"))
> guix build: error: derivation 
> `/gnu/store/h69hdf14c11q7dip0gssfd4cv0qw8j7k-guix-package-cache.drv' 
> may not be deterministic: output 
> `/gnu/store/0009whxhfz00lm027wbars8q4wb3rvia-guix-package-cache' 
> differs
> --8<---------------cut here---------------end--------------->8---
> 
> Then the usual "diffoscope":
> 
> --8<---------------cut here---------------start------------->8---
> diffoscope \
> /gnu/store/0009whxhfz00lm027wbars8q4wb3rvia-guix-package-cache/lib/guix/package.cache 
> \
> /gnu/store/0009whxhfz00lm027wbars8q4wb3rvia-guix-package-cache-check/lib/guix/package.cache\
>   | head -n50
> --8<---------------cut here---------------end--------------->8---
> 
> outputs something like:
> 
> --8<---------------cut here---------------start------------->8---
> --- 
> /gnu/store/0009whxhfz00lm027wbars8q4wb3rvia-guix-package-cache/lib/guix/package.cache
> +++ 
> /gnu/store/0009whxhfz00lm027wbars8q4wb3rvia-guix-package-cache-check/lib/guix/package.cache
> ├── readelf --wide --file-header {}
> │ @@ -6,15 +6,15 @@
> │    OS/ABI:                            <unknown: ff>
> │    ABI Version:                       0
> │    Type:                              DYN (Shared object file)
> │    Machine:                           None
> │    Version:                           0x1
> │    Entry point address:               0x0
> │    Start of program headers:          64 (bytes into file)
> │ -  Start of section headers:          4900296 (bytes into file)
> │ +  Start of section headers:          4900456 (bytes into file)
> │    Flags:                             0x0
> │    Size of this header:               64 (bytes)
> │    Size of program headers:           56 (bytes)
> │    Number of program headers:         3
> │    Size of section headers:           64 (bytes)
> │    Number of section headers:         20
> │    Section header string table index: 17
> ├── readelf --wide --program-header {}
> │ @@ -1,16 +1,16 @@
> │
> │  Elf file type is DYN (Shared object file)
> │  Entry point 0x0
> │  There are 3 program headers, starting at offset 64
> │
> │  Program Headers:
> │    Type           Offset   VirtAddr           PhysAddr           
> FileSiz  MemSiz   Flg Align
> │ -  LOAD           0x000000 0x0000000000000000 0x0000000000000000 
> 0x286a68 0x286a68 R   0x10000
> │ -  LOAD           0x290000 0x0000000000290000 0x0000000000290000 
> 0x21c5c8 0x21c5c8 RW  0x10000
> │ -  DYNAMIC        0x286a08 0x0000000000286a08 0x0000000000286a08 
> 0x000060 0x000060 R   0x8
> │ +  LOAD           0x000000 0x0000000000000000 0x0000000000000000 
> 0x286b78 0x286b78 R   0x10000
> │ +  LOAD           0x290000 0x0000000000290000 0x0000000000290000 
> 0x21c668 0x21c668 RW  0x10000
> │ +  DYNAMIC        0x286b18 0x0000000000286b18 0x0000000000286b18 
> 0x000060 0x000060 R   0x8
> │
> │   Section to Segment mapping:
> │    Segment Sections...
> │     00     .rodata .rtl-text .dynamic
> │     01     .data
> │     02     .dynamic
> ├── readelf --wide --sections {}
> │┄ stderr from `readelf --wide --sections {}`:
> │┄ readelf: Warning: [ 5]: Link field (0) should index a string 
> section.
> │ @@ -1,29 +1,29 @@
> │ -There are 20 section headers, starting at offset 0x4ac5c8:
> │ +There are 20 section headers, starting at offset 0x4ac668:
> --8<---------------cut here---------------end--------------->8---
> 
> Well, I do not know what should the next step.  I mean this
> "package.cache" file is created by the function
> gnu/packages.scm:(generate-package-cache) which reads:
> 
> --8<---------------cut here---------------start------------->8---
>       ;; Store the cache as a '.go' file.  This makes loading fast 
> and reduces
>       ;; heap usage since some of the static data is directly mmapped.
>       (put-bytevector port
>                       (compile `'(,@exp)
>                                #:to 'bytecode
>                                #:opts '(#:to-file? #t)))))
> --8<---------------cut here---------------end--------------->8---
> 
> Then it is on the Guile side, isn't it?
> 
> 
> All the best,
> simon