From unknown Mon Jun 16 19:33:58 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#68942 <68942@debbugs.gnu.org> To: bug#68942 <68942@debbugs.gnu.org> Subject: Status: [PATCH] grafts: rename files in deepest-first order. Reply-To: bug#68942 <68942@debbugs.gnu.org> Date: Tue, 17 Jun 2025 02:33:58 +0000 retitle 68942 [PATCH] grafts: rename files in deepest-first order. reassign 68942 guix-patches submitter 68942 skyvine@protonmail.com severity 68942 normal tag 68942 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 05 20:07:19 2024 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 To: guix-patches@gnu.org From: skyvine@protonmail.com Subject: [PATCH] grafts: rename files in deepest-first order. Message-ID: Feedback-ID: 40635331:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit Cc: Skyler Ferris X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 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(-) 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))) =20 - ;; XXX: This is not quite correct: if MAPPING contains "foo", and - ;; DIRECTORY contains "bar/foo/foo", we first rename "bar/foo" and the= n - ;; "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)))) =20 (define (exit-on-exception proc) "Return a procedure that wraps PROC so that 'primitive-exit' is called w= hen base-commit: 931d893c550128591018587c90d2491fd66a11a4 --=20 2.41.0