From patchwork Tue Feb 6 01:06:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Skyler Ferris X-Patchwork-Id: 59860 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 BF40F27BBEB; Tue, 6 Feb 2024 02:06:34 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,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 1AC5D27BBEA for ; Tue, 6 Feb 2024 02:06:32 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXAqW-0004Mq-LV; Mon, 05 Feb 2024 21:06:00 -0500 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 1rX9wE-0003yu-7S for guix-patches@gnu.org; Mon, 05 Feb 2024 20:07:50 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rX9wD-00032S-VX for guix-patches@gnu.org; Mon, 05 Feb 2024 20:07:49 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rX9wQ-0001GM-Eu for guix-patches@gnu.org; Mon, 05 Feb 2024 20:08:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68942] [PATCH] grafts: rename files in deepest-first order. Resent-From: skyvine@protonmail.com Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 06 Feb 2024 01:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68942 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68942@debbugs.gnu.org Cc: Skyler Ferris X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17071816394803 (code B ref -1); Tue, 06 Feb 2024 01:08:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Feb 2024 01:07:19 +0000 Received: from localhost ([127.0.0.1]:52859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rX9vf-0001FM-RG for submit@debbugs.gnu.org; Mon, 05 Feb 2024 20:07:19 -0500 Received: from lists.gnu.org ([2001:470:142::17]:36118) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rX9va-0001F3-4U for submit@debbugs.gnu.org; Mon, 05 Feb 2024 20:07:14 -0500 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 1rX9vH-0003t9-Ig for guix-patches@gnu.org; Mon, 05 Feb 2024 20:06:51 -0500 Received: from mail-4316.protonmail.ch ([185.70.43.16]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rX9vF-0002wd-5Q for guix-patches@gnu.org; Mon, 05 Feb 2024 20:06:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1707181606; x=1707440806; bh=IviBIZViotJ+dOmpZ/gbrB96Jbx0KM7tWP5Cl0NB56k=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=N2BeIPFc9oTw5YhdwcUvxymokm0Vte0zp9kE/bG/Ft/ccozQdav7HDZCTATGJNmJ+ e/Vedb6thdl14bP54L5+pQWwvLH3MJGIOFE5kRl6xO+V2Tr4xLPT6Ew4VkPQRk5AE4 tuEWdlkRzTW+nmjd4aOx0jQ2vW3yGTiA9vtJ698fQdiObkbHMDhToo7NUmvhhR3wjI 0rRiZbPCJXq0+tixEf6YxMdMx5z/RUJqbf563YeJkaCJLumsnXMSDYAzQmkgHH3GoV ae8gGwCOhiJOg7lFDGghGyXImM5vmsatGJLE+HpSioCGx0Pz6wtxU7LlpZWHx5i/Wl xXkCo8HLP780A== Date: Tue, 06 Feb 2024 01:06:38 +0000 Message-ID: Feedback-ID: 40635331:user:proton MIME-Version: 1.0 Received-SPF: pass client-ip=185.70.43.16; envelope-from=skyvine@protonmail.com; helo=mail-4316.protonmail.ch 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, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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-Mailman-Approved-At: Mon, 05 Feb 2024 21:05:59 -0500 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: skyvine@protonmail.com X-ACL-Warn: , Skyler Ferris via Guix-patches X-Patchwork-Original-From: Skyler Ferris via Guix-patches via From: Skyler Ferris 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 From: Skyler Ferris The problem is explained in the deleted comment. The fix is just to reverse the list given to for-each. I guess this is correct because the procedure does not depend on parallel ordering between different lists, it uses assoc-ref to look things up. It fixed the problem when I ran into this bug while working on a package. Change-Id: I997880043f35797ad79ffd73a02b5ffdd9283da9 --- # While I do not have the resources to test this exhaustively (ie, # rebuild all of the packages defined by guix), I successfully # reconfigured my system to use a version of guix with this patch # included, and the output showed that at least dozens of grafts were # applied successfully. Additionally, the tests in `tests/grafts.scm` # pass. If anything needs to be improved please let me know and I will # work on a different patch to resolve this issue. guix/build/graft.scm | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) base-commit: 931d893c550128591018587c90d2491fd66a11a4 diff --git a/guix/build/graft.scm b/guix/build/graft.scm index 281dbaba6f..232c2a04ad 100644 --- a/guix/build/graft.scm +++ b/guix/build/graft.scm @@ -289,15 +289,11 @@ (define (rename-matching-files directory mapping) (assoc-ref mapping (basename file))) #:directories? #t))) - ;; XXX: This is not quite correct: if MAPPING contains "foo", and - ;; DIRECTORY contains "bar/foo/foo", we first rename "bar/foo" and then - ;; "bar/foo/foo" no longer exists so we fail. Oh well, surely that's good - ;; enough! (for-each (lambda (file) (let ((target (assoc-ref mapping (basename file)))) (rename-file file (string-append (dirname file) "/" target)))) - matches))) + (reverse matches)))) (define (exit-on-exception proc) "Return a procedure that wraps PROC so that 'primitive-exit' is called when