Subject: bug#34935: nanopolish is not reproducible

From: T460s laptop <[email-masked]>
Date: Sat, 30 Mar 2019 15:13:01 -0400

Ludovic Courtès <[email-masked]> writes:

> Maxim Cournoyer <[email-masked]> skribis:
>
>> $ guix build --check --no-grafts nanopolish
>> [...]
>> guix build: error: derivation
>> `/gnu/store/7hzcmcwlw83f0wsqmz9nnl1ah54kwks4-nanopolish-0.10.2-1.50e8b5c.drv'
>> may not be deterministic: output
>> `/gnu/store/m7icaq7642zy0gvnqvymcnn8d088a9s0-nanopolish-0.10.2-1.50e8b5c'
>> differs
>>
>> $ diffoscope "$(guix build nanopolish)" /gnu/store/m7icaq7642zy0gvnqvymcnn8d088a9s0-nanopolish-0.10.2-1.50e8b5c
>>
>> │ │ │ - 0x000000000000001d (RUNPATH) Library runpath:
>> [/gnu/store/h90vnqw0nwd0hhm1l5dgxsdrigddfmq4-glibc-2.28/lib:/gnu/store/4sqps8dczv3g7rwbdibfz6rf5jlk7w90-gcc-5.5.0-lib/lib:/gnu/store/nq4lsyipmfb0q7g26ra45rwwqrh3x8zw-zlib-1.2.11/lib:/gnu/store/36i633snnhx4mgbnmm5rbkgk3qdi32ka-hdf5-1.8.21/lib:/gnu/store/x4xpcpsqmini25gkrc0h945ml9r609v5-htslib-1.9/lib:/gnu/store/4sqps8dczv3g7rwbdibfz6rf5jlk7w90-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../..]
>> │ │ │ + 0x000000000000001d (RUNPATH) Library runpath:
>> [/gnu/store/h90vnqw0nwd0hhm1l5dgxsdrigddfmq4-glibc-2.28/lib:/gnu/store/4sqps8dczv3g7rwbdibfz6rf5jlk7w90-gcc-5.5.0-lib/lib:/gnu/store/nq4lsyipmfb0q7g26ra45rwwqrh3x8zw-zlib-1.2.11/lib:/gnu/store/36i633snnhx4mgbnmm5rbkgk3qdi32ka-hdf5-1.8.21/lib:/gnu/store/d25i834bs8wvg8mh36bplxg61r6b7vz9-htslib-1.9/lib:/gnu/store/4sqps8dczv3g7rwbdibfz6rf5jlk7w90-gcc-5.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../..]
>>
>> The problem seems to lie in htslib.
>
> Aren’t you comparing two different builds, like one grafted the other
> ungrafted?
>
> What I do is:
>
>   guix build foo --check -K
>
> and then:
>
>   diffoscope /gnu/store/…-the-thing{,-check}
>
> That way you’re 100% sure you’re comparing two different builds of the
> very same derivation.

Thanks for pointing this to me.  As mentioned in another threda, to
really have a -check output, I had to use both --keep-failed and
--no-grafts (combined with --check).

The produced diffoscope is very large (3 MiB when xzipped), so I won't
post it here, but the non-reproducibility should be visible on any Guix
system, I believe.

It seems the binaries produced have symbols appearing at different
offset. Here's an excerpt:

>--- /gnu/store/95vcyvlcrlw82g9zpyh421mz3mnag0qx-nanopolish-0.10.2-1.50e8b5c
+++ /gnu/store/95vcyvlcrlw82g9zpyh421mz3mnag0qx-nanopolish-0.10.2-1.50e8b5c-check
├── bin
│ ├── nanopolish
│ │ ├── /gnu/store/02iklp4swqs0ipxhg5x9b2shmj6b30h1-binutils-2.31.1/bin/readelf --wide --file-header {}
│ │ │ @@ -6,15 +6,15 @@
│ │ │    OS/ABI:                            UNIX - GNU
│ │ │    ABI Version:                       0
│ │ │    Type:                              EXEC (Executable file)
│ │ │    Machine:                           Advanced Micro Devices X86-64
│ │ │    Version:                           0x1
│ │ │    Entry point address:               0x40b580
│ │ │    Start of program headers:          64 (bytes into file)
│ │ │ -  Start of section headers:          4204728 (bytes into file)
│ │ │ +  Start of section headers:          4204696 (bytes into file)
│ │ │    Flags:                             0x0
│ │ │    Size of this header:               64 (bytes)
│ │ │    Size of program headers:           56 (bytes)
│ │ │    Number of program headers:         12
│ │ │    Size of section headers:           64 (bytes)
│ │ │    Number of section headers:         34
│ │ │    Section header string table index: 33

[...]

│ │ ├── /gnu/store/02iklp4swqs0ipxhg5x9b2shmj6b30h1-binutils-2.31.1/bin/readelf --wide --sections {}
│ │ │ @@ -1,8 +1,8 @@
│ │ │ -There are 34 section headers, starting at offset 0x4028b8:
│ │ │ +There are 34 section headers, starting at offset 0x402898:
│ │ │  
│ │ │  Section Headers:
│ │ │    [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
│ │ │    [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
│ │ │    [ 1] .interp           PROGBITS        00000000004002e0 0002e0 000050 00   A  0   0  1
│ │ │    [ 2] .note.ABI-tag     NOTE            0000000000400330 000330 000020 00   A  0   0  4
│ │ │    [ 3] .hash             HASH            0000000000400350 000350 00091c 04   A  5   0  8
│ │ │ @@ -14,30 +14,30 @@
│ │ │    [ 9] .rela.dyn         RELA            00000000004053e0 0053e0 001248 18   A  5   0  8
│ │ │    [10] .rela.plt         RELA            0000000000406628 006628 001380 18  AI  5  27  8
│ │ │    [11] .init             PROGBITS        0000000000408000 008000 000017 00  AX  0   0  4
│ │ │    [12] .plt              PROGBITS        0000000000408020 008020 000d10 10  AX  0   0 16
│ │ │    [13] .plt.got          PROGBITS        0000000000408d30 008d30 000128 08  AX  0   0  8
│ │ │    [14] .text             PROGBITS        0000000000408e60 008e60 0f7222 00  AX  0   0 16
│ │ │    [15] .fini             PROGBITS        0000000000500084 100084 000009 00  AX  0   0  4
│ │ │ -  [16] .rodata           PROGBITS        0000000000501000 101000 2a92d0 00   A  0   0 32
│ │ │ -  [17] .eh_frame_hdr     PROGBITS        00000000007aa2d0 3aa2d0 002094 00   A  0   0  4
│ │ │ -  [18] .eh_frame         PROGBITS        00000000007ac368 3ac368 00eb70 00   A  0   0  8
│ │ │ -  [19] .gcc_except_table PROGBITS        00000000007baed8 3baed8 00a8d0 00   A  0   0  4
│ │ │ +  [16] .rodata           PROGBITS        0000000000501000 101000 2a9330 00   A  0   0 32
│ │ │ +  [17] .eh_frame_hdr     PROGBITS        00000000007aa330 3aa330 002094 00   A  0   0  4
│ │ │ +  [18] .eh_frame         PROGBITS        00000000007ac3c8 3ac3c8 00eb78 00   A  0   0  8
│ │ │ +  [19] .gcc_except_table PROGBITS        00000000007baf40 3baf40 00a8c0 00   A  0   0  4
│ │ │    [20] .tbss             NOBITS          00000000007c6c40 3c5c40 00002c 00 WAT  0   0  8
│ │ │    [21] .init_array       INIT_ARRAY      00000000007c6c40 3c5c40 000110 08  WA  0   0  8
│ │ │    [22] .fini_array       FINI_ARRAY      00000000007c6d50 3c5d50 000008 08  WA  0   0  8

HTH!

Maxim