From patchwork Thu Jul 13 08:43:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 51694 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 63C1D27BBEA; Thu, 13 Jul 2023 09:45:32 +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=ham 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 AD8BD27BBE9 for ; Thu, 13 Jul 2023 09:45:31 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJrwi-0006bq-TC; Thu, 13 Jul 2023 04:45:08 -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 1qJrwe-0006b7-24 for guix-patches@gnu.org; Thu, 13 Jul 2023 04:45:04 -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 1qJrwd-00078Y-Lb for guix-patches@gnu.org; Thu, 13 Jul 2023 04:45:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qJrwc-0003JG-Ct; Thu, 13 Jul 2023 04:45:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64579] [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:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64579 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64579@debbugs.gnu.org Cc: Ricardo Wurmus , Jelle Licht X-Debbugs-Original-Xcc: Jelle Licht Received: via spool by 64579-submit@debbugs.gnu.org id=B64579.168923784312626 (code B ref 64579); Thu, 13 Jul 2023 08:45:02 +0000 Received: (at 64579) by debbugs.gnu.org; 13 Jul 2023 08:44:03 +0000 Received: from localhost ([127.0.0.1]:53347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJrvf-0003HZ-EJ for submit@debbugs.gnu.org; Thu, 13 Jul 2023 04:44:03 -0400 Received: from sender3-of-o58.zoho.com ([136.143.184.58]:21875) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJrvc-0003H2-MS for 64579@debbugs.gnu.org; Thu, 13 Jul 2023 04:44:01 -0400 Delivered-To: rekado@elephly.net ARC-Seal: i=1; a=rsa-sha256; t=1689237838; cv=none; d=zohomail.com; s=zohoarc; b=P0PQjXKSDgc5yDoyibVw+cvoFGNSegrXIOmAn8p6qSPyAqgnPffy+tqELp7MwM3dJ/tLfNKEG2mdUa5bgMYsL2eLVCUckRZrelokMkKHbtjvIyqPa84+Xt6bzaR8zLnoALD53N5wOlAK6recSj67AkFY1MAY8L3uiKGh/phn3wc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689237838; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=A1pVJh1z+Og8xzJbOj5hYiiWHnsQ7PWcLACwxNi9gI4=; b=BcDa+7rvhsmKONOs8x1dhaGZbPu8RhkUCWrENT1IWRU+PxE3WmYdrmfk8TZ9r/s/iXT/Z7kmMtlgjZWxsZe4iVikghaNN4KakYaktywUSA1NtUeS1NrG4d8XTJnBKpvBoYhzc7SDhlkVQuPUS1zSZD+4DxDt6xjZyLSDs5IeTuE= 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=1689237838; 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=hkASL0e4P4JYjoLclC/mR+HcaWmf927dJVUa85DlhKLHXtTzRTuoMg5OiOJ+dIp3 Bs7Seio8vSY23h0Ch7D4M+MOfOiW7G7sbbpDCjcv5JqWjklkgVVNZwzxUMS+HYn37TD yl+EcXdjE9quiJ0qbbHzBeFen8r6IDcSw4+CMzik= Received: from localhost (215-111-142-46.pool.kielnet.net [46.142.111.215]) by mx.zohomail.com with SMTPS id 1689237835828143.2220930700646; Thu, 13 Jul 2023 01:43:55 -0700 (PDT) From: Ricardo Wurmus Date: Thu, 13 Jul 2023 10:43:48 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-ZohoMailClient: External 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