Subject: bug#58567: Some grafts use a different input derivation than computed by --no-grafts

From: zimoun <[email-masked]>
Date: Mon, 17 Oct 2022 12:25:26 +0200

Hi Marius,

I reminds me this [1].

1: <https://yhetil.org/guix/[email-masked]>

On dim., 16 oct. 2022 at 19:35, Marius Bakke <[email-masked]> wrote:

> It works for 'python-patiencediff', but fails for 'python-patch-ng',
> both of which have no dependencies other than Python; but one uses
> url-fetch and the other git-fetch.

I guess that

   guix build python-patch-ng -d

uses a grafted git-minimal and propagates it, whereas

   guix build python-patch-ng -d --no-grafts

uses a non-grafted git-minimal.  Well, something like that. :-)

Here some investigations for what they are worth.

--8<---------------cut here---------------start------------->8---
$ guix time-machine --commit=3d8c243efb615c7e642942433be1c7badf0ae65e \
       -- build python-patch-ng -d 
/gnu/store/gy6ksy7h02qi062wwh00wqxfjzqj7vjg-python-patch-ng-1.17.4.drv
--8<---------------cut here---------------end--------------->8---

where the no-grafted is,

/gnu/store/xi035mv5cv8j9d2sm8hcwi293vcix28q-python-patch-ng-1.17.4.drv

and the command-line non-grafted reads,

--8<---------------cut here---------------start------------->8---
$ guix time-machine --commit=3d8c243efb615c7e642942433be1c7badf0ae65e \
       -- build python-patch-ng -d --no-grafts
/gnu/store/v4w24l63864x2304pv9a9fz3knzf1lxb-python-patch-ng-1.17.4.drv
--8<---------------cut here---------------end--------------->8---

However, both derivations have the same output.

--8<---------------cut here---------------start------------->8---
$ guix build \
  /gnu/store/xi035mv5cv8j9d2sm8hcwi293vcix28q-python-patch-ng-1.17.4.drv \
  /gnu/store/v4w24l63864x2304pv9a9fz3knzf1lxb-python-patch-ng-1.17.4.drv
/gnu/store/d6nhxbayyal1nximx048bvk6zx4phcap-python-patch-ng-1.17.4
/gnu/store/d6nhxbayyal1nximx048bvk6zx4phcap-python-patch-ng-1.17.4
--8<---------------cut here---------------end--------------->8---

The difference in the derivation hash comes from the order and checkout,

   ,("/gnu/store/52aymnx4px77ig2irmi16nncb9d27z9y-gawk-5.1.0.drv",["out"])
   ,("/gnu/store/7bcypqy80bz8ygi4880dxdj8vzcsvhdf-python-patch-ng-1.17.4-checkout.drv",["out"])
   ,("/gnu/store/7p8m2v35lrjmgffv7map1cmn45vi0pkm-binutils-2.37.drv",["out"])

vs

   ,("/gnu/store/h5nligvx7n87jg0zxsiw536lz0q1gr3j-tar-1.34.drv",["out"])
   ,("/gnu/store/ivbkmnl6md7lzf275nvqwdh6lc924hal-python-patch-ng-1.17.4-checkout.drv",["out"])
   ,("/gnu/store/jj494gyb7r3jnn15jd240dn5zd6crnyk-bash-minimal-5.1.8.drv",["out"])

Well, it is the same checkout output:

--8<---------------cut here---------------start------------->8---
$ guix build \
   /gnu/store/7bcypqy80bz8ygi4880dxdj8vzcsvhdf-python-patch-ng-1.17.4-checkout.drv \
   /gnu/store/ivbkmnl6md7lzf275nvqwdh6lc924hal-python-patch-ng-1.17.4-checkout.drv
/gnu/store/jddbmm7nxhv9sl84j1jlsdy5iiwjpbiy-python-patch-ng-1.17.4-checkout
/gnu/store/jddbmm7nxhv9sl84j1jlsdy5iiwjpbiy-python-patch-ng-1.17.4-checkout
--8<---------------cut here---------------end--------------->8---

Again, the checkout derivation hash is different because order and an
item,

   ,("/gnu/store/6ynvjkk6yzkpsl0x703hlvdrmp96plm1-guile-zlib-0.1.0.drv",["out"])
   ,("/gnu/store/7df196dbwb4w03q8wnvfys0j5npnqbcd-git-minimal-2.38.0.drv",["out"])
   ,("/gnu/store/cmiqs6lp2ss4i3f9cy5vsinh7795bxcy-gzip-1.10.drv",["out"])

vs

   ,("/gnu/store/ifvnf3rwyhhgjman6qn332j2sfn8hlp5-guile-json-4.7.1.drv",["out"])
   ,("/gnu/store/q074d9578lbq2y9ls5xycbm0jmyr1z75-git-minimal-2.38.0.drv",["out"])
   ,("/gnu/store/snyyq4ssjff5ajwswwg4absrhfv8pc4z-tar-1.34.drv",["out"])

And the Git is probably the root of the final mismatch.

--8<---------------cut here---------------start------------->8---
$ guix time-machine --commit=3d8c243efb615c7e642942433be1c7badf0ae65e \
       -- build git-minimal -d --no-grafts
/gnu/store/7df196dbwb4w03q8wnvfys0j5npnqbcd-git-minimal-2.38.0.drv

$ guix time-machine --commit=3d8c243efb615c7e642942433be1c7badf0ae65e \
       -- build git-minimal -d
/gnu/store/q074d9578lbq2y9ls5xycbm0jmyr1z75-git-minimal-2.38.0.drv
--8<---------------cut here---------------end--------------->8---

Cheers,
simon