Subject: Discrepancy when running ‘guix pull’ from different machines

From: Ludovic Courtès <[email-masked]>
Date: Thu, 11 Jul 2024 15:59:11 +0200

While running:

  guix pull -q --commit=0ff72d105

on two different machines, we found that the resulting derivation would
be different.  The “right one” (same as on ci.guix is):

--8<---------------cut here---------------start------------->8---
$ readlink $(readlink  my.0ff72d105)
/gnu/store/1g1zhh3864xzh0csqrzf5c1qkbd3q5pp-profile
$ guix gc --derivers $(readlink -f my.0ff72d105)
/gnu/store/b6zvsh8z7fmx5bpw21wqhnl82kfag5s1-profile.drv
$ guix gc -R $(guix gc --derivers $(readlink -f my.0ff72d105)) |grep guix-0ff72d105
/gnu/store/sarff52m9zavyyadllixk9brjqfacn57-guix-0ff72d105-modules-builder
/gnu/store/ys9rcn7d9xp4d2wwcy6i21gm6rmviv31-guix-0ff72d105-builder
/gnu/store/6l3xi9lcib99lpdq6z7x5bahm4ppxw45-guix-0ff72d105-modules.drv
/gnu/store/w3h8kvag0dbw9y6qq35r3fb87b1xpykd-guix-0ff72d105.drv
--8<---------------cut here---------------end--------------->8---

On the other machine, where substitutes would consequently be
unavailable, we’d get:

--8<---------------cut here---------------start------------->8---
$ readlink fernando.0ff72d105.drv
/gnu/store/hl1di1dq6mcd7jl0phk5bi12yqcc9dif-guix-0ff72d105.drv
$ guix gc -R /gnu/store/hl1di1dq6mcd7jl0phk5bi12yqcc9dif-guix-0ff72d105.drv |grep guix-0ff72d105
/gnu/store/p04znrg5frzj6gpiafpx7cgr4n7jly5s-guix-0ff72d105-modules-builder
/gnu/store/sc7y5i9pi5w2cpba0xmk7pzqckn642bp-guix-0ff72d105-modules.drv
/gnu/store/p4bh6x0r8qy9lpg77p52cjzxjzhp0mwr-guix-0ff72d105-builder
/gnu/store/hl1di1dq6mcd7jl0phk5bi12yqcc9dif-guix-0ff72d105.drv
--8<---------------cut here---------------end--------------->8---

Digging into the derivation graph reveals the difference below in the
derivation that builds the grafted avahi:

diff -ubBr --show-c-function --label \#\<buffer\ 32kpijl743qn7v337i19dd1hph1rd6x7-avahi-0.8-builder\> --label \#\<buffer\ z1kanbslzb2lrr1hj922a50zkxl9jz28-avahi-0.8-builder\> /tmp/buffer-content-tBGXyv /tmp/buffer-content-XM8vEv
--- #<buffer 32kpijl743qn7v337i19dd1hph1rd6x7-avahi-0.8-builder>
+++ #<buffer z1kanbslzb2lrr1hj922a50zkxl9jz28-avahi-0.8-builder>
@@ -23,11 +23,11 @@
 	  (("/gnu/store/ill8bkp6wshj15nc4fxk4wgln15rgyi6-libevent-2.1.12" . "/gnu/store/s6jj1mrdhi2l2860zd9n609qfhlgjc1m-libevent-2.1.12")
 	   ("/gnu/store/930nwsiysdvy2x5zv1sf6v7ym75z8ayk-gcc-11.3.0-lib" . "/gnu/store/6ncav55lbk5kqvwwflrzcr41hp5jbq0c-gcc-11.3.0-lib")
 	   ("/gnu/store/gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35" . "/gnu/store/ln6hxqjvz6m9gdd9s97pivlqck7hzs99-glibc-2.35")
+	   ("/gnu/store/36my0g0j72b3vbz0gj1l8f0lmmgfkv3w-glib-2.72.3" . "/gnu/store/m26kdkgr4c09wc0djn2pgcz9jl7j2rw1-glib-2.72.3")
 	   ("/gnu/store/2w976k6g70gkfih9wwhalqsni209vcqz-gdbm-1.23" . "/gnu/store/z655ilai81pbzbm35zwfqc64ha7wl37k-gdbm-1.23")
 	   ("/gnu/store/x2a1qx3syync9q4ka1gh8g0svrcq86k6-libdaemon-0.14" . "/gnu/store/br5achyfqqgw6yzx82s5v9h7llcf7q4q-libdaemon-0.14")
 	   ("/gnu/store/h4kvisn532l7ndqniqnj30yd26vksasq-dbus-1.14.0" . "/gnu/store/hjc4rdifbl890j03xy2gsa7y2sqcg0mi-dbus-1.14.0")
 	   ("/gnu/store/fw1wywd34vh33l4dq182ds5d7jdz45j5-expat-2.5.0" . "/gnu/store/94rdaacvsqf05zhw88w92y8bkvgxdfpl-expat-2.5.0")
-	   ("/gnu/store/36my0g0j72b3vbz0gj1l8f0lmmgfkv3w-glib-2.72.3" . "/gnu/store/m26kdkgr4c09wc0djn2pgcz9jl7j2rw1-glib-2.72.3")
 	   ("/gnu/store/sjy64dvx18yc5p29zywmg01k3g53p643-libcap-2.64" . "/gnu/store/ba5ri728kpa5fv314fav2id0nc3l0hsk-libcap-2.64")
 	   ("/gnu/store/9vw5slrffp27rzy2i2plnw7xfqjyk7m4-bash-minimal-5.1.16" . "/gnu/store/5mzqf6fz9bz30ybgx7jrqw424qbg9rbk-bash-minimal-5.1.16")))
 	 (map

That is, the ordering of grafts in the ‘mapping’ variables created by
‘graft-derivation/shallow’ would be different.

This would suggest something’s happening in a non-deterministic or
stateful fashion.

To be continued…

Ludo’.