Subject: guix install download extra outputs when it should not

From: Simon Tournier <[email-masked]>
Date: Thu, 12 Dec 2024 16:31:34 +0100

Hi,

Please consider the package ’x265’.  If one installs it with the option
’no-grafts’ then everything works as expected.  However, if one installs
it with the default command line, then the output ’static’ is downloaded
when it should not.

Please note this package is not grafted.

Below, a reproducer.

--8<---------------cut here---------------start------------->8---
$ guix time-machine -q --commit=47ab553178eb00d02ba9588ed1f7df44fb2f7c4c \
       -- install x265 --no-grafts -p /tmp/no-grafts
guix install: warning: Consider running 'guix pull' followed by
'guix package -u' to get up-to-date packages and security updates.

The following package will be installed:
   x265 3.5

substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'...   0.0%guix substitute: warning: bordeaux.guix.gnu.org: connection failed: Connection refused
substitute: 
substitute: updating substitutes from 'https://guix.bordeaux.inria.fr'... 100.0%
The following derivation will be built:
  /gnu/store/cxpssdlarc9z688jp11a5aa2i50920bk-profile.drv

1.7 MB will be downloaded
 module-import-compiled  107KiB                                            1.2MiB/s 00:00 ▕██████████████████▏ 100.0%
 libfontenc-1.1.4  13KiB                                                   4.4MiB/s 00:00 ▕██████████████████▏ 100.0%
 module-import-compiled  48KiB                                             5.9MiB/s 00:00 ▕██████████████████▏ 100.0%
 mkfontscale-1.2.2  20KiB                                                  3.6MiB/s 00:00 ▕██████████████████▏ 100.0%
 module-import-compiled  58KiB                                             6.2MiB/s 00:00 ▕██████████████████▏ 100.0%
 mkfontdir-1.0.7  4KiB                                                     3.1MiB/s 00:00 ▕██████████████████▏ 100.0%
 x265-3.5  1.4MiB                                                          3.2MiB/s 00:00 ▕██████████████████▏ 100.0%
building CA certificate bundle...
listing Emacs sub-directories...
building fonts directory...
building directory of Info manuals...
building profile with 1 package...
hint: Consider setting the necessary environment variables by running:

     GUIX_PROFILE="/tmp/no-grafts"
     . "$GUIX_PROFILE/etc/profile"

Alternately, see `guix package --search-paths -p "/tmp/no-grafts"'.
--8<---------------cut here---------------end--------------->8---

Here, all is fine.  Then bang!

--8<---------------cut here---------------start------------->8---
$ guix time-machine -q --commit=47ab553178eb00d02ba9588ed1f7df44fb2f7c4c \
       -- install x265 -p /tmp/with-grafts
guix install: warning: Consider running 'guix pull' followed by
'guix package -u' to get up-to-date packages and security updates.

The following package will be installed:
   x265 3.5

substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'...   0.0%guix substitute: warning: bordeaux.guix.gnu.org: connection failed: Connection refused
substitute: 
2.2 MB will be downloaded
 curl-8.6.0-doc  535KiB                                                    843KiB/s 00:01 ▕██████████████████▏ 100.0%
substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'...   0.0%
2.8 MB will be downloaded
 x265-3.5-static  1.3MiB                                                   1.6MiB/s 00:01 ▕██████████████████▏ 100.0%
hint: Consider setting the necessary environment variables by running:

     GUIX_PROFILE="/tmp/with-grafts"
     . "$GUIX_PROFILE/etc/profile"

Alternately, see `guix package --search-paths -p "/tmp/with-grafts"'.
--8<---------------cut here---------------end--------------->8---

Indeed x265-3.5-static is downloaded. Hum?!  A bug, I guess.

Please note that both (with or without) install the exact same profile:

--8<---------------cut here---------------start------------->8---
$ readlink -f /tmp/no-grafts
/gnu/store/znbrwzn5pkrjb1ni2y8nj5lw068syh1j-profile

$ readlink -f /tmp/with-grafts
/gnu/store/znbrwzn5pkrjb1ni2y8nj5lw068syh1j-profile
--8<---------------cut here---------------end--------------->8---

And that profile contains:

--8<---------------cut here---------------start------------->8---
$ guix gc --references /gnu/store/znbrwzn5pkrjb1ni2y8nj5lw068syh1j-profile
/gnu/store/1h81psijhx3l8p88ds66q7a001rgvcl2-x265-3.5
/gnu/store/1vsl7yp1b94bvx5ljc7irys881q3zvl9-emacs-subdirs
/gnu/store/dk3v3fdslvlj3qwf2c1bqprj0dcm6m7s-info-dir
/gnu/store/znbrwzn5pkrjb1ni2y8nj5lw068syh1j-profile
--8<---------------cut here---------------end--------------->8---

where it’s not a grafted item:

--8<---------------cut here---------------start------------->8---
$ guix gc --derivers /gnu/store/1h81psijhx3l8p88ds66q7a001rgvcl2-x265-3.5
/gnu/store/7555d85ldgn3vgby3sdgl0rf9ac1b6mv-x265-3.5.drv
--8<---------------cut here---------------end--------------->8---

which reads:

--8<---------------cut here---------------start------------->8---
Derive
([("out","/gnu/store/1h81psijhx3l8p88ds66q7a001rgvcl2-x265-3.5","","")
  ,("static","/gnu/store/4zw8h8za4z1cg4k5iz5lha6v1s9wzwkz-x265-3.5-static","","")]
 ,[("/gnu/store/1fdyz77q7qwqm12nf05zsqlxgpc7qwrk-patch-2.7.6.drv",["out"])
   ,("/gnu/store/1j9f9p41npw2ak7xa5vi1825jzw98r78-make-4.4.1.drv",["out"])
   ,("/gnu/store/2ff71r26mzc6j0jmg2hnbxl9rrwng8cb-xz-5.4.5.drv",["out"])
   ,("/gnu/store/4y1nj954qnrxjm6n706425ppzrysswsl-tar-1.34.drv",["out"])
   ,("/gnu/store/548m4h6h348didy1m790wa3wm5gi9dzr-file-5.45.drv",["out"])
   ,("/gnu/store/6w7kma4i566rwjnd6dcl71nnwxw8f9hj-bash-minimal-5.1.16.drv",["out"])
   ,("/gnu/store/8rdk4lzpxjipxbg8gy2wcn0whiw9fkcc-coreutils-9.1.drv",["out"])
   ,("/gnu/store/938lrsa8aap7ypl6bjdbyk9m2m10yb0f-findutils-4.9.0.drv",["out"])
   ,("/gnu/store/9v589ilg3y17xzyg7blnm5p5zq5w53zz-gzip-1.13.drv",["out"])
   ,("/gnu/store/gfw5x9m4gzwx6lp01sdpmg9bjv7rkf9g-gcc-11.4.0.drv",["out"])
   ,("/gnu/store/gi824h98mhpdj748qq696xil4hb3iy75-diffutils-3.10.drv",["out"])
   ,("/gnu/store/gvkzbkw6wl5ylsv3a4m6ba6blh96jlqd-ld-wrapper-0.drv",["out"])
   ,("/gnu/store/hj1l9q3gz3p0w06xg7pd9kqn2bm7727m-grep-3.11.drv",["out"])
   ,("/gnu/store/js4wbx994msmy5vqda3bkpkp90w85nlm-binutils-2.41.drv",["out"])
   ,("/gnu/store/lskrr30zkr6zdn8kh2xr5zsgh8v34crb-linux-libre-headers-5.15.49.drv",["out"])
   ,("/gnu/store/lzlbf85rsk810gxfprqcyzwpi7vbsjx5-bzip2-1.0.8.drv",["out"])
   ,("/gnu/store/mpcpqg2z2496phr13mq6p66isj30ps88-guile-3.0.9.drv",["out"])
   ,("/gnu/store/ncp8ppqmp8cjnhb689jdj4hjhkprdk2i-zstd-1.5.2.drv",["out"])
   ,("/gnu/store/rf2pw1mhyswd49664kpyh8w74j25lqa3-module-import-compiled.drv",["out"])
   ,("/gnu/store/rzzxmd5kgqicyda68mq5nr12nfv33hvn-x265_3.5.tar.zst.drv",["out"])
   ,("/gnu/store/sja38khs22vdn6r2nmlv25p96jmh2v9h-glibc-2.39.drv",["out","static"])
   ,("/gnu/store/smv8fspv7qn2fw0hm5p9qc99ysljxdca-gawk-5.3.0.drv",["out"])
   ,("/gnu/store/xbvp18dgwylw02vg4j2gx5qly2d24ndr-cmake-minimal-3.24.2.drv",["out"])
   ,("/gnu/store/xk1wxn1x2nivpnid67x7g3l7z2q0f5p0-sed-4.8.drv",["out"])
   ,("/gnu/store/yp879bxngivi6i5873lkp7crnzxhazki-nasm-2.15.05.drv",["out"])]
 ,["/gnu/store/2cn6qcdq6h79xgjjy852apfq3v1v5dmy-module-import","/gnu/store/liw289n4sja5lzyargqfv29xdijs88sk-x265-3.5-builder"]
 ,"x86_64-linux","/gnu/store/xv4cd7qz4yan93zkjisbmbpxfz78hah2-guile-3.0.9/bin/guile",["--no-auto-compile","-L","/gnu/store/2cn6qcdq6h79xgjjy852apfq3v1v5dmy-module-import","-C","/gnu/store/b3l95nsz9fr09bv62ynp2n23klcfqcr4-module-import-compiled","/gnu/store/liw289n4sja5lzyargqfv29xdijs88sk-x265-3.5-builder"]
 ,[("out","/gnu/store/1h81psijhx3l8p88ds66q7a001rgvcl2-x265-3.5")
   ,("static","/gnu/store/4zw8h8za4z1cg4k5iz5lha6v1s9wzwkz-x265-3.5-static")])
--8<---------------cut here---------------end--------------->8---

Therefore, the issue might comes from how “guix install” internal works,
I guess.

Cheers,
simon