GNU bug report logs - #76376
[PATCH] guix: gexp: canonicalize file paths for import

Previous Next

Package: guix-patches;

Reported by: Ryan Sundberg <ryan <at> arctype.co>

Date: Mon, 17 Feb 2025 22:00:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ryan Sundberg <ryan <at> arctype.co>
Subject: bug#76376: closed (Re: [bug#76376] [PATCH] guix: gexp:
 canonicalize file paths for import)
Date: Mon, 10 Mar 2025 14:46:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#76376: [PATCH] guix: gexp: canonicalize file paths for import

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 76376 <at> debbugs.gnu.org.

-- 
76376: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76376
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: Ryan Sundberg <ryan <at> arctype.co>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>,
 Simon Tournier <zimon.toutoune <at> gmail.com>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Tobias Geerinckx-Rice <me <at> tobias.gr>, Christopher Baines <guix <at> cbaines.net>,
 76376-done <at> debbugs.gnu.org
Subject: Re: [bug#76376] [PATCH] guix: gexp: canonicalize file paths for import
Date: Mon, 10 Mar 2025 15:45:02 +0100
Hi Ryan,

Ludovic Courtès <ludo <at> gnu.org> skribis:

> I chose ‘readlink*’ because it’s less expensive that
> ‘canonicalize-path’: only one extra syscall (readlink) when ‘file-name’
> is already a regular file.

I went ahead and pushed this change as
24478808756c2787e4cb60d2d0e97f87924d2aa4, but leaving #:recursive? #t
since we still want to be able to import executable files.

Thanks again,
Ludo’.

[Message part 3 (message/rfc822, inline)]
From: Ryan Sundberg <ryan <at> arctype.co>
To: guix-patches <at> gnu.org
Cc: Ryan Sundberg <ryan <at> arctype.co>
Subject: [PATCH] guix: gexp: canonicalize file paths for import
Date: Mon, 17 Feb 2025 13:58:44 -0800
When we intern a file from the store during `imported-modules`, if the
file is a symlink (e.g., from a Guix profile), a dangling symlink can be
created in the module-import builder.

Follow any symlinks before interning the files to the store, so that the
file itself is imported and not the dangling link.

See also: https://issues.guix.gnu.org/73275

* guix/gexp.scm (imported-files/derivation): canonicalize-path

Change-Id: Ic0af90cda7c5c5819526e455cf62300e18408dbd
---
 guix/gexp.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/gexp.scm b/guix/gexp.scm
index e44aea6420..85351b0322 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -1576,7 +1576,7 @@ (define* (imported-files/derivation files
   (define file-pair
     (match-lambda
      ((final-path . (? string? file-name))
-      (mlet %store-monad ((file (interned-file file-name
+      (mlet %store-monad ((file (interned-file (canonicalize-path file-name)
                                                (basename final-path))))
         (return (list final-path file))))
      ((final-path . file-like)

base-commit: 91b18baa4274a025d28f06133682a9269217730d
-- 
2.41.0




This bug report was last modified 129 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.