Subject: bug#38203: "make as-derivation" no longer uses the checked-out branch

From: Mark H Weaver <[email-masked]>
Date: Thu, 14 Nov 2019 00:11:24 -0500

First, some relevant background: I use 'guix' in an unusual way.  I
*never* run "guix pull".  My ~/.config/guix directories are empty for
all accounts.  I always run 'guix' using './pre-inst-env' from a git
checkout of my private branch.  I build everything locally, and never
use substitutes.  My /etc/guix/acl has no keys, i.e. it contains
"(acl)\n".  My guix-daemon command-line includes: --no-substitutes
--substitute-urls "" --gc-keep-derivations=yes --gc-keep-outputs=yes.

A few times a year, I run "make as-derivation" and register GC roots to
the resulting 'guix', to ensure that I always have a working copy of
'guix' from my private branch.

I just tried to run "make as-derivation" for the first time since 21 Aug
2019, and it started to rebuild the world.  It built bash-5.0.tar.xz,
bison-3.4.1, flex-2.6.4, linux-libre-headers-4.19.56, and had started
building glibc-intermediate-2.29 before I aborted it.

It's surely relevant that my private branch includes the following
commit, which is *not* on the master branch on Savannah:

  https://git.savannah.gnu.org/cgit/guix.git/commit/?h=core-updates&id=567cca260d54a4515097ff3f2dc277d10ceaf613

That commit unconditionally configures PGRP_PIPE for 'bash' on systems
based on Linux (the kernel).  That explains why the first thing built by
"make as-derivation" was 'bash-5.0.tar.xz', but one without
'bash-linux-pgrp-pipe.patch', which is added by the above commit.
Here's the derivation of the 'bash-5.0.tar.xz' built by "make
as-derivation", formatted for readability:

Derive([("out","/gnu/store/qpdpx2bd7wkcq0ndrp8m239w0hn5ib65-bash-5.0.tar.xz","","")],
       [("/gnu/store/07s3hslvih2wcy82a86i0mqk4vfp7lzz-bash50-002.drv",["out"]),
        ("/gnu/store/20s0n9jk6bjjl0bhhrmmjf79l3x9617h-bash50-005.drv",["out"]),
        ("/gnu/store/2i16ilici4y88pi7dysixk0mrrj57i2b-bash50-006.drv",["out"]),
        ("/gnu/store/6i0mn13pf7aw2dfxwrcdmdn0qccfqqkp-bash50-004.drv",["out"]),
        ("/gnu/store/7wqw4023spvggi15vcxyxvivxa4rmmv8-bootstrap-binaries-0.drv",["out"]),
        ("/gnu/store/b83bnh1xbbdsksns5a985y96mjg5x428-bash50-007.drv",["out"]),
        ("/gnu/store/cb7vcizsqc6m9nz0l0ziwwgiqi30hk1b-bash-5.0.tar.gz.drv",["out"]),
        ("/gnu/store/ms9j8g5cnm7ddwlc21lpd5xwiy8r717l-bash50-003.drv",["out"]),
        ("/gnu/store/piknghl5jc0pbjipwrrvwp5m03vppky2-bash50-001.drv",["out"]),
        ("/gnu/store/sbsq9bzfi41a52x50gpv6dl6plyb9kc3-guile-bootstrap-2.0.drv",["out"]),
        ("/gnu/store/xf24mqzdq0qj72mzalqbjdia9hmxn7wv-module-import-compiled.drv",["out"])],
       ["/gnu/store/knmq971a84fbczaz120rwpfx24333zhs-module-import",
        "/gnu/store/xcxaka53s5v88y7my1pwg2cz0fyrn6a5-bash-5.0.tar.xz-builder"],
       "x86_64-linux",
       "/gnu/store/lgi9x15a0w35mcpd7g1kb9274r6wy4pv-guile-bootstrap-2.0/bin/guile",
       ["--no-auto-compile",
        "-L",
        "/gnu/store/knmq971a84fbczaz120rwpfx24333zhs-module-import",
        "-C",
        "/gnu/store/5zk5949lgby9k3f3d5f3rdv2dqkyqkpf-module-import-compiled",
        "/gnu/store/xcxaka53s5v88y7my1pwg2cz0fyrn6a5-bash-5.0.tar.xz-builder"],
       [("guix properties","((type . origin) (patches . 7))"),
        ("out","/gnu/store/qpdpx2bd7wkcq0ndrp8m239w0hn5ib65-bash-5.0.tar.xz")])

Notably missing from the derivation's inputs above is
'bash-linux-pgrp-pipe.patch'.

It looks as though "make as-derivation" is now using packages from the
'master' branch instead of from my private branch, which I have checked
out in the build directory where I ran "make as-derivation".  I guess
the most likely reason that would have happened is because it used the
'guix' from my system profile (which is based on vanilla 'master')
instead of the 'guix' from my PATH, which is a small shell script that
runs the 'guix' from my git checkout using ./pre-inst-env.

Historically, I have sometimes had similar patches on my private branch,
and yet "make as-derivation" has not rebuilt the world.  Has something
changed since August 21st that might have affected this?

      Thanks,
        Mark