From patchwork Thu Jul 13 08:30:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 51692 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C39FA27BBE2; Thu, 13 Jul 2023 09:31:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1877A27BBE9 for ; Thu, 13 Jul 2023 09:31:13 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJrj7-0004FD-7a; Thu, 13 Jul 2023 04:31:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJrj5-0004Ex-Mx for guix-patches@gnu.org; Thu, 13 Jul 2023 04:31:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qJrj5-0000RT-Eh for guix-patches@gnu.org; Thu, 13 Jul 2023 04:31:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qJrj4-0002y5-7g; Thu, 13 Jul 2023 04:31:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64591] [PATCH 2/2] gnu: node-lts: Install files irrespective of number of hardlinks. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: jlicht@fsfe.org, guix-patches@gnu.org Resent-Date: Thu, 13 Jul 2023 08:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64591 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64591@debbugs.gnu.org Cc: Ricardo Wurmus , Jelle Licht X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Jelle Licht Received: via spool by submit@debbugs.gnu.org id=B.168923703711362 (code B ref -1); Thu, 13 Jul 2023 08:31:02 +0000 Received: (at submit) by debbugs.gnu.org; 13 Jul 2023 08:30:37 +0000 Received: from localhost ([127.0.0.1]:53328 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJrif-0002xC-16 for submit@debbugs.gnu.org; Thu, 13 Jul 2023 04:30:37 -0400 Received: from lists.gnu.org ([209.51.188.17]:40782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJrid-0002x4-8O for submit@debbugs.gnu.org; Thu, 13 Jul 2023 04:30:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJrid-0004Cc-2P for guix-patches@gnu.org; Thu, 13 Jul 2023 04:30:35 -0400 Received: from sender3-of-o58.zoho.com ([136.143.184.58]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJrib-0000NF-CF for guix-patches@gnu.org; Thu, 13 Jul 2023 04:30:34 -0400 Delivered-To: rekado@elephly.net ARC-Seal: i=1; a=rsa-sha256; t=1689237028; cv=none; d=zohomail.com; s=zohoarc; b=l/bbiLFxCd+duwPIswkYYxuC995drEa7spw9T3yNnToAttcpowvmM58YBWwcyy0nKVKaLMalsGmnXiVIbiMV3vVilVlqfTOs0OX2uvdob/oQJwHi9IYKu1YaYRqi7i+F+EcJTdpx+z0U3KoE/sMnLAJlAktsJ8Zj2Gwh7gFA/kk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689237028; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=A1pVJh1z+Og8xzJbOj5hYiiWHnsQ7PWcLACwxNi9gI4=; b=O0StJ1BSwsUe2vOy6cKyDmUZItmNU2QVIq8rVOojb6KaaUprTWiymPIPpzfdbay6DleNS0m2NrIrSf7n4vn+y1vVr/cXUubrHJGdRRr3lJ4S+6XcBmibonpge1sU/08UVRERiibihOxRI4g/MYAOUfgr3tuLneVZs3VlarR3myY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1689237028; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=A1pVJh1z+Og8xzJbOj5hYiiWHnsQ7PWcLACwxNi9gI4=; b=gajKvSqZPgNDzJe7lNwpuWU815B5hnsZ9HeyI9XHDM2nUbfHxFhOH7YzPNnyi6PY Rjh3dPrDPuiz9nMDhUieQpk7wOLJov4xzyqktn3rUm+MFnD/inoYKr2En40Lt2jbC6s 2OOBw+XyGfFXEpUj/zwHAins8IG9L/lOZ+hhWveM= Received: from localhost (215-111-142-46.pool.kielnet.net [46.142.111.215]) by mx.zohomail.com with SMTPS id 1689237026531302.7942123395153; Thu, 13 Jul 2023 01:30:26 -0700 (PDT) From: Ricardo Wurmus Date: Thu, 13 Jul 2023 10:30:15 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.184.58; envelope-from=rekado@elephly.net; helo=sender3-of-o58.zoho.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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