unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Jack Hill <jackhill@jackhill.us>
Cc: 47115@debbugs.gnu.org
Subject: bug#47115: Redundant library grafts leads to breakage (was: Failure building grub-img.png when reconfiguring)
Date: Tue, 16 Mar 2021 05:18:15 -0400	[thread overview]
Message-ID: <8735wvjw25.fsf@netris.org> (raw)
In-Reply-To: <875z1rjyfn.fsf@netris.org>

retitle 47115 Redundant library grafts leads to breakage
thanks

Hi,

I looked a bit deeper, and now I think I finally know what's going on.
It turns out that the grafting process is creating two redundant
variants of the replacement guile-cairo.

All of the relevant information is in
/gnu/store/07xw2pp63xin4c4y8ndrcdn3n8z1vmx2-grub-image.png.drv and its
dependents, which fails to build if deduplication is disabled.

If you look through the output of "guix size
/gnu/store/07xw2pp63xin4c4y8ndrcdn3n8z1vmx2-grub-image.png.drv", you'll
find three distinct guile-cairo derivations:

(1) /gnu/store/vz4yw7zkm73diy95mdzywgixal3nf2s2-guile-cairo-1.11.2.drv,
    => /gnu/store/5nmzfnxk8kp85xwma2r585fgyz3jfw56-guile-cairo-1.11.2
    (the original, ungrafted, cairo)

(2) /gnu/store/rcl324yiq7a56rwkqwgqx097dwc5mgni-guile-cairo-1.11.2.drv,
    => /gnu/store/vjn7ygzzqshvsfzck8hq5lp5pfrr2xp5-guile-cairo-1.11.2
    (the first graft)

(3) /gnu/store/9mha4bzbji8iql50prmq9br4j1c51sjn-guile-cairo-1.11.2.drv,
    => /gnu/store/j69k9n0g3h9ppqi7dmqypwy3lrhxvb97-guile-cairo-1.11.2
    (the second graft)

In the 'guile-builder' files referenced from the two graft derivations,
we see that they have the same inputs and perform the same rewrites, but
list them in a different order.  Graft 1 has this guile-builder:

--8<---------------cut here---------------start------------->8---
(begin
  (use-modules (guix build graft) (guix build utils) (ice-9 match))
  (define %output (getenv "out"))
  (define %outputs (map (lambda (o) (cons o (getenv o))) (quote ("out"))))
  (define %build-inputs
    (quote
     (("x" . "/gnu/store/5nmzfnxk8kp85xwma2r585fgyz3jfw56-guile-cairo-1.11.2")
      ("x" . "/gnu/store/fx3979c88s9yxdbchyf36qryawgzpwb5-libx11-1.6.10")
      ("x" . "/gnu/store/na0x00biq02fm5cyj5a8r67qwsnsskw8-cairo-1.16.0")
      ("x" . "/gnu/store/cw69is9wbbllwx95wky4pmbcsk4vvbpd-libxrender-0.9.10")
      ("x" . "/gnu/store/qrs0p8j3wq6q5a4dm0ndjdavk9gyal5q-libxext-1.3.4")
      ("x" . "/gnu/store/rwkqxykm91a75w9afhb41saj0dmf30hw-libx11-1.6.12")
      ("x" . "/gnu/store/p51dv37zj24q8001zghc3wxhxz8i3c50-cairo-1.16.0")
      ("x" . "/gnu/store/pzj036f1nmxdrbza6cqy419ddsn9bydp-libxrender-0.9.10")
      ("x" . "/gnu/store/3rmazp46f6g8w9qs8n3w7qcg8hhs1lig-libxext-1.3.4"))))
  (unsetenv "GUILE_LOAD_COMPILED_PATH")
  (unsetenv "LD_LIBRARY_PATH"))
(exit
 (begin
   (let* ((old-outputs
           (quote
            (("out" . "/gnu/store/5nmzfnxk8kp85xwma2r585fgyz3jfw56-guile-cairo-1.11.2"))))
          (mapping
           (append (quote
                    (("/gnu/store/fx3979c88s9yxdbchyf36qryawgzpwb5-libx11-1.6.10"
                      . "/gnu/store/rwkqxykm91a75w9afhb41saj0dmf30hw-libx11-1.6.12")
                     ("/gnu/store/na0x00biq02fm5cyj5a8r67qwsnsskw8-cairo-1.16.0"
                      . "/gnu/store/p51dv37zj24q8001zghc3wxhxz8i3c50-cairo-1.16.0")
                     ("/gnu/store/cw69is9wbbllwx95wky4pmbcsk4vvbpd-libxrender-0.9.10"
                      . "/gnu/store/pzj036f1nmxdrbza6cqy419ddsn9bydp-libxrender-0.9.10")
                     ("/gnu/store/qrs0p8j3wq6q5a4dm0ndjdavk9gyal5q-libxext-1.3.4"
                      . "/gnu/store/3rmazp46f6g8w9qs8n3w7qcg8hhs1lig-libxext-1.3.4")))
                   (map (match-lambda ((name . file)
                                       (cons (assoc-ref old-outputs name) file)))
                        %outputs))))
     (graft old-outputs %outputs mapping))))
--8<---------------cut here---------------end--------------->8---

Graft 2 has this guile-builder:

--8<---------------cut here---------------start------------->8---
(begin
  (use-modules (guix build graft) (guix build utils) (ice-9 match))
  (define %output (getenv "out"))
  (define %outputs (map (lambda (o) (cons o (getenv o))) (quote ("out"))))
  (define %build-inputs
    (quote (("x" . "/gnu/store/5nmzfnxk8kp85xwma2r585fgyz3jfw56-guile-cairo-1.11.2")
            ("x" . "/gnu/store/na0x00biq02fm5cyj5a8r67qwsnsskw8-cairo-1.16.0")
            ("x" . "/gnu/store/fx3979c88s9yxdbchyf36qryawgzpwb5-libx11-1.6.10")
            ("x" . "/gnu/store/cw69is9wbbllwx95wky4pmbcsk4vvbpd-libxrender-0.9.10")
            ("x" . "/gnu/store/qrs0p8j3wq6q5a4dm0ndjdavk9gyal5q-libxext-1.3.4")
            ("x" . "/gnu/store/p51dv37zj24q8001zghc3wxhxz8i3c50-cairo-1.16.0")
            ("x" . "/gnu/store/rwkqxykm91a75w9afhb41saj0dmf30hw-libx11-1.6.12")
            ("x" . "/gnu/store/pzj036f1nmxdrbza6cqy419ddsn9bydp-libxrender-0.9.10")
            ("x" . "/gnu/store/3rmazp46f6g8w9qs8n3w7qcg8hhs1lig-libxext-1.3.4"))))
  (unsetenv "GUILE_LOAD_COMPILED_PATH")
  (unsetenv "LD_LIBRARY_PATH"))
(exit
 (begin
   (let* ((old-outputs
           (quote
            (("out" . "/gnu/store/5nmzfnxk8kp85xwma2r585fgyz3jfw56-guile-cairo-1.11.2"))))
          (mapping
           (append (quote
                    (("/gnu/store/na0x00biq02fm5cyj5a8r67qwsnsskw8-cairo-1.16.0"
                      . "/gnu/store/p51dv37zj24q8001zghc3wxhxz8i3c50-cairo-1.16.0")
                     ("/gnu/store/fx3979c88s9yxdbchyf36qryawgzpwb5-libx11-1.6.10"
                      . "/gnu/store/rwkqxykm91a75w9afhb41saj0dmf30hw-libx11-1.6.12")
                     ("/gnu/store/cw69is9wbbllwx95wky4pmbcsk4vvbpd-libxrender-0.9.10"
                      . "/gnu/store/pzj036f1nmxdrbza6cqy419ddsn9bydp-libxrender-0.9.10")
                     ("/gnu/store/qrs0p8j3wq6q5a4dm0ndjdavk9gyal5q-libxext-1.3.4"
                      . "/gnu/store/3rmazp46f6g8w9qs8n3w7qcg8hhs1lig-libxext-1.3.4")))
                   (map (match-lambda ((name . file)
                                       (cons (assoc-ref old-outputs name) file)))
                        %outputs))))
     (graft old-outputs %outputs mapping))))
--8<---------------cut here---------------end--------------->8---

I think that my last hypothesis was on the right track, but not quite
right:

* Instead of 'libcairo' being loaded twice, I now suspect that
  "libguile-cairo.so" is being loaded twice.

* Instead of the original and replacement libraries being loaded, I now
  suspect that two different variants of the replacement "guile-cairo"
  are being loaded.

* Instead of libcairo type tags being duplicated, I now suspect that
  duplicated smob tags are being allocated.

However, *if* deduplication is enabled, two redundant replacements
created by grafting _should_ occupy the same inodes, assuming that the
replacement mappings are the same (modulo ordering), and assuming that
/gnu/store/.links doesn't hit a directory size limit (which can happen
on ext3/4, leading to missed deduplication opportunities).

I've known about these redundant replacements in Guix for many years,
but was not aware of any significant practical problems arising from
them until now.

       Mark




  reply	other threads:[~2021-03-16  9:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 22:58 bug#47115: Failure building grub-img.png when reconfiguring Jack Hill
2021-03-12 23:05 ` Leo Famulari
2021-03-13  0:24   ` Mark H Weaver
2021-03-13  0:33     ` Jack Hill
2021-03-13  4:05       ` Jack Hill
2021-03-13  7:41         ` Mark H Weaver
2021-03-13 20:08           ` Jack Hill
2021-03-14  4:27             ` Jack Hill
2021-03-14 20:49               ` Jack Hill
2021-03-14 21:14                 ` Jack Hill
2021-03-14 22:00                   ` Jack Hill
2021-03-14 22:05               ` Mark H Weaver
2021-03-14 23:18                 ` Jack Hill
2021-03-15  0:11                   ` Mark H Weaver
2021-03-15  3:38                     ` Jack Hill
2021-03-15  3:52                       ` Jack Hill
2021-03-15 20:48                         ` Jack Hill
2021-03-16  1:41                           ` Jack Hill
2021-03-16  2:40                             ` Jack Hill
2021-03-16  8:26                               ` bug#47115: Grafts without deduplication can lead to breakage in Guile (was: Failure building grub-img.png when reconfiguring) Mark H Weaver
2021-03-16  9:18                                 ` Mark H Weaver [this message]
2021-03-20 11:01                                   ` bug#47115: Redundant library grafts leads to breakage Ludovic Courtès
2021-03-14 22:18     ` bug#47115: Failure building grub-img.png when reconfiguring Leo Famulari
2021-03-13  0:25   ` Jack Hill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8735wvjw25.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=47115@debbugs.gnu.org \
    --cc=jackhill@jackhill.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).