all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Skyler Ferris via Guix-patches via <guix-patches@gnu.org>
To: 68942@debbugs.gnu.org
Cc: Skyler Ferris <skyvine@protonmail.com>
Subject: [bug#68942] [PATCH] grafts: rename files in deepest-first order.
Date: Tue, 06 Feb 2024 01:06:38 +0000	[thread overview]
Message-ID: <db33d81668a73417611d61a85a4ed9898726378b.1706902756.git.skyvine@protonmail.com> (raw)

From: Skyler Ferris <skyvine@protonmail.com>

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)))
 
-    ;; 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

base-commit: 931d893c550128591018587c90d2491fd66a11a4
-- 
2.41.0






                 reply	other threads:[~2024-02-06  2:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=db33d81668a73417611d61a85a4ed9898726378b.1706902756.git.skyvine@protonmail.com \
    --to=guix-patches@gnu.org \
    --cc=68942@debbugs.gnu.org \
    --cc=skyvine@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.