* [bug#64579] [PATCH 2/2] gnu: node-lts: Install files irrespective of number of hardlinks.
[not found] <b5e817925299a377b7948cb7f683126ed2f57ff6.1689236917.git.rekado@elephly.net>
@ 2023-07-13 8:43 ` Ricardo Wurmus
2023-07-14 12:42 ` Jelle Licht
0 siblings, 1 reply; 2+ messages in thread
From: Ricardo Wurmus @ 2023-07-13 8:43 UTC (permalink / raw)
To: 64579; +Cc: Ricardo Wurmus, Jelle Licht
* 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [bug#64579] [PATCH 2/2] gnu: node-lts: Install files irrespective of number of hardlinks.
2023-07-13 8:43 ` [bug#64579] [PATCH 2/2] gnu: node-lts: Install files irrespective of number of hardlinks Ricardo Wurmus
@ 2023-07-14 12:42 ` Jelle Licht
0 siblings, 0 replies; 2+ messages in thread
From: Jelle Licht @ 2023-07-14 12:42 UTC (permalink / raw)
To: Ricardo Wurmus, 64579
Ricardo Wurmus <rekado@elephly.net> writes:
> * gnu/packages/node.scm (node-lts)[arguments]: Add build phase
> 'ignore-number-of-hardlinks.
LGTM, and I was able to do node-related things with these patches
applied locally.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-14 12:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <b5e817925299a377b7948cb7f683126ed2f57ff6.1689236917.git.rekado@elephly.net>
2023-07-13 8:43 ` [bug#64579] [PATCH 2/2] gnu: node-lts: Install files irrespective of number of hardlinks Ricardo Wurmus
2023-07-14 12:42 ` Jelle Licht
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.