guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

npm has irreproducible install behavior


From: Ricardo Wurmus
Subject: npm has irreproducible install behavior
Date: Fri, 07 Jul 2023 07:47:12 +0200
User-agent: mu4e 1.10.3; emacs 28.2

Hi Guix,

after a few days of frustrating investigation I found a bug in one of
the libraries used by npm:

  https://github.com/npm/pacote/issues/285

The result is that “npm install” will not install *all* files dependent
on whether a file is deduplicated in the store.  This causes
irreproducible output and build failures down the line on different
systems depending on the state of the file system.

We should patch this ourselves.  We can either tell node-tar not to mark
up hardlinks with the “Link” type, or we can patch pacote to not skip
files that have the “Link” type.

I’ve tested this little addition to the build phases of node-lts on an
affected system:

--8<---------------cut here---------------start------------->8---
           (add-after 'install 'do-not-ignore-links
             (lambda* (#:key outputs #:allow-other-keys)
               (with-directory-excursion
                   (string-append (assoc-ref outputs "out")
                                  "/lib/node_modules/npm/node_modules")
                 (substitute* "pacote/lib/fetcher.js"
                              (("\\/Link\\$\\/.test\\(entry.type\\)") "false")
                              (("\\/File\\$\\/.test\\(entry.type\\)")
                               "/(File|Link)$/.test(entry.type)"))
--8<---------------cut here---------------end--------------->8---

What do you think?

-- 
Ricardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]