GNU bug report logs - #64591
[PATCH 2/2] gnu: node-lts: Install files irrespective of number of hardlinks.

Previous Next

Package: guix-patches;

Reported by: Ricardo Wurmus <rekado <at> elephly.net>

Date: Thu, 13 Jul 2023 08:31:02 UTC

Severity: normal

Tags: patch

Done: Ricardo Wurmus <rekado <at> elephly.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#64591: closed ([PATCH 2/2] gnu: node-lts: Install files
 irrespective of number of hardlinks.)
Date: Thu, 13 Jul 2023 08:45:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 13 Jul 2023 10:44:07 +0200
with message-id <87y1jkgpzk.fsf <at> elephly.net>
and subject line [PATCH 2/2] gnu: node-lts: Install files irrespective of number of hardlinks.
has caused the debbugs.gnu.org bug report #64591,
regarding [PATCH 2/2] gnu: node-lts: Install files irrespective of number of hardlinks.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
64591: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64591
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ricardo Wurmus <rekado <at> elephly.net>
To: guix-patches <at> gnu.org
Cc: Ricardo Wurmus <rekado <at> elephly.net>
Subject: [PATCH 2/2] gnu: node-lts: Install files irrespective of number of
 hardlinks.
Date: Thu, 13 Jul 2023 10:30:15 +0200
* gnu/packages/node.scm (node-lts)[arguments]: Add build phase
'ignore-number-of-hardlinks.
---
 gnu/packages/node.scm | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index c0bb4f2342..8ba57dd4e0 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -874,7 +874,36 @@ (define-public node-lts
                  (copy-file (string-append llhttp "/src/http.c")
                             "deps/llhttp/src/http.c")
                  (copy-file (string-append llhttp "/include/llhttp.h")
-                            "deps/llhttp/include/llhttp.h"))))))))
+                            "deps/llhttp/include/llhttp.h"))))
+           ;; npm installs dependencies by copying their files over a tar
+           ;; stream.  A file with more than one hardlink is marked as a
+           ;; "Link".  pacote/lib/fetcher.js calls node-tar's extractor with a
+           ;; filter that ignores any "Link" entries.  This means that
+           ;; dependending on the number of hardlinks on files in a node-*
+           ;; package *some* of its files may not be installed when generating
+           ;; another package's "node_modules" directory.  The build output
+           ;; would differ depending on irrelevant file system state.
+           ;;
+           ;; To avoid this, we patch node-tar to treat files with hardlinks
+           ;; the same as any other file, so that node-tar has no choice but
+           ;; to extract all of them --- independent of pacote's filter.
+           ;;
+           ;; Why not patch pacote's filter instead?  This has led to subtle
+           ;; differences in where the files are installed, so it's easier to
+           ;; just ensure that files with hardlinks are always treated as
+           ;; regular files.
+           ;;
+           ;; Discussion:
+           ;;   https://lists.gnu.org/archive/html/guix-devel/2023-07/msg00040.html
+           ;; Upstream bug report:
+           ;;   https://github.com/npm/pacote/issues/285
+           (add-after 'install 'ignore-number-of-hardlinks
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((file (string-append (assoc-ref outputs "out")
+                                          "/lib/node_modules/npm/node_modules"
+                                          "/tar/lib/write-entry.js")))
+                 (substitute* file
+                   (("this.stat.nlink > 1") "false")))))))))
     (native-inputs
      (list ;; Runtime dependencies for binaries used as a bootstrap.
            c-ares-for-node
-- 
2.40.1



[Message part 3 (message/rfc822, inline)]
From: Ricardo Wurmus <rekado <at> elephly.net>
To: 64591-done <at> debbugs.gnu.org
Subject: [PATCH 2/2] gnu: node-lts: Install files irrespective of number of
 hardlinks.
Date: Thu, 13 Jul 2023 10:44:07 +0200
Closing as duplicate of https://issues.guix.gnu.org/64592

-- 
Ricardo


This bug report was last modified 2 years and 8 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.