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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Ryan Sundberg <ryan@HIDDEN>; Keywords: patch; dated Mon, 17 Feb 2025 22:00:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Added indication that bug 76376 blocks75810 Request was from Ludovic Courtès <ludo@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 76376 <at> debbugs.gnu.org:


Received: (at 76376) by debbugs.gnu.org; 25 Feb 2025 15:08:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 25 10:08:53 2025
Received: from localhost ([127.0.0.1]:47928 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tmwYG-0004IY-Ki
	for submit <at> debbugs.gnu.org; Tue, 25 Feb 2025 10:08:53 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:59182)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tmwYD-0004IE-EG
 for 76376 <at> debbugs.gnu.org; Tue, 25 Feb 2025 10:08:50 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1tmwY6-00049O-Tv; Tue, 25 Feb 2025 10:08:42 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=NqlmDkKXmd791dktd7JFRm1ptMsTAo1kd4b0n3SjG2Q=; b=YJNvn65/XTrImruSPkvv
 cYYyBqHDMtvpGGITGf8gPE3mTTgXc0tUXWlN+fLIanzi7PgTIkJU8aBeVJ5fv7Xg92G0b7vvy0Cwk
 gW1/xXB0a9lD9jRu68DVKgMe828bCLpk6FiL/lUgprPw0/BOlNcsZ3jZ5dmp5I7SomJNgsrf0+sYY
 1hnEQB5Uqbiv1/cTXbJr2Q4o87zgxIZXvG8DWNh+UVZ1NJXMEQ2mTgyLFL5KiNlpBcM2Iy6NhODu+
 dKJR8+BTx80083P6lCEfttHlo+p8y2VqbUVpCb4Eo4glXDp4WYFhyb5BIIfxiVuZFFYMY+jrH3xqV
 x/219N5bWksiuA==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Ryan Sundberg <ryan@HIDDEN>
Subject: Re: [bug#76376] [PATCH] guix: gexp: canonicalize file paths for import
In-Reply-To: <87v7t3a7m7.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?=
 =?utf-8?Q?s?= message of "Fri, 21 Feb 2025 11:56:48 +0100")
References: <0dafbea136e328cd214e7e1fb05ab91ab04b17da.1739829485.git.ryan@HIDDEN>
 <87v7t3a7m7.fsf@HIDDEN>
Date: Tue, 25 Feb 2025 16:08:24 +0100
Message-ID: <87seo2njtj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76376
Cc: Josselin Poiret <dev@HIDDEN>,
 Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>,
 76376 <at> debbugs.gnu.org, Tobias Geerinckx-Rice <me@HIDDEN>,
 Christopher Baines <guix@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hello Ryan,

Ludovic Court=C3=A8s <ludo@HIDDEN> skribis:

>>       ((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))))
>
> Instead of calling =E2=80=98canonicalize-path=E2=80=99, which leads to ma=
ny syscalls,
> I=E2=80=99d suggest:
>
>    (interned-file file-name (basename final-path)
>                   #:recursive? #f)

It was missing one bit; attached is an version of it that works.

I chose =E2=80=98readlink*=E2=80=99 because it=E2=80=99s less expensive that
=E2=80=98canonicalize-path=E2=80=99: only one extra syscall (readlink) when=
 =E2=80=98file-name=E2=80=99
is already a regular file.

For the record, I stumbled upon this bug just today while working on
<https://issues.guix.gnu.org/75810>: the "imported-files does not create
symlinks" in =E2=80=98tests/gexp.scm=E2=80=99 would fail when running in an=
 isolated
environment because file =E2=80=9Cx=E2=80=9D would be a symlink to a file o=
utside the
store.

Ludo=E2=80=99.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline

diff --git a/guix/gexp.scm b/guix/gexp.scm
index ad51bc55b78..ddd2e1a0812 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -1584,8 +1584,9 @@ (define* (imported-files/derivation files
   (define file-pair
     (match-lambda
      ((final-path . (? string? file-name))
-      (mlet %store-monad ((file (interned-file file-name
-                                               (basename final-path))))
+      (mlet %store-monad ((file (interned-file (readlink* file-name)
+                                               (basename final-path)
+                                               #:recursive? #f)))
         (return (list final-path file))))
      ((final-path . file-like)
       (mlet %store-monad ((file (lower-object file-like system)))

--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#76376; Package guix-patches. Full text available.

Message received at 76376 <at> debbugs.gnu.org:


Received: (at 76376) by debbugs.gnu.org; 21 Feb 2025 10:57:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 21 05:57:02 2025
Received: from localhost ([127.0.0.1]:54729 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tlQiL-0002Dh-Vv
	for submit <at> debbugs.gnu.org; Fri, 21 Feb 2025 05:57:02 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:54526)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tlQiK-0002CY-BP
 for 76376 <at> debbugs.gnu.org; Fri, 21 Feb 2025 05:57:01 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1tlQiC-0003aV-VM; Fri, 21 Feb 2025 05:56:52 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=xv4MNlKLRm8M8tN/wUKKtvtyfmYpBGimUhdUuLK4V+Y=; b=lbwRiX5xy2Gz3wFUjv5l
 euoU9qVr4sX8bPff1J0ysGkOIIYTwosv08+C7Ho7qdQUFLWUrtuE8F57qxTdU97c6YUKA0tBD2KDp
 ZUISin4X0zvX5wPz4GFdCQiN0ET9nnuI8unOO89V6uBEB/5U6K47nY0M+wkHFAtxzf3yB7WXSrjlI
 Lc4uEnYsdvVEbxWrOJIwL26OxcsEn5ZKQCCEdFYVhZTpmva4YBeYAVJEme8qjeRznG3rRFmyCyf29
 XgRD3xm04s+zMC02e4dveBKUScH3JhW3xQBxqNlEZtyREFlM5bQn6tkex24Z+O1Bey4C/aASUxKXG
 oS2aFIaMqexyLA==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Ryan Sundberg <ryan@HIDDEN>
Subject: Re: [bug#76376] [PATCH] guix: gexp: canonicalize file paths for import
In-Reply-To: <0dafbea136e328cd214e7e1fb05ab91ab04b17da.1739829485.git.ryan@HIDDEN>
 (Ryan Sundberg's message of "Mon, 17 Feb 2025 13:58:44 -0800")
References: <0dafbea136e328cd214e7e1fb05ab91ab04b17da.1739829485.git.ryan@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: Tridi 3 =?utf-8?Q?Vent=C3=B4se?= an 233 de la
 =?utf-8?Q?R=C3=A9volution=2C?= jour du Violier
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Fri, 21 Feb 2025 11:56:48 +0100
Message-ID: <87v7t3a7m7.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76376
Cc: Josselin Poiret <dev@HIDDEN>,
 Simon Tournier <zimon.toutoune@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>,
 76376 <at> debbugs.gnu.org, Tobias Geerinckx-Rice <me@HIDDEN>,
 Christopher Baines <guix@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Ryan Sundberg <ryan@HIDDEN> skribis:

> 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

[...]

>       ((final-path . (? string? file-name))
> -      (mlet %store-monad ((file (interned-file file-name
> +      (mlet %store-monad ((file (interned-file (canonicalize-path file-n=
ame)
>                                                 (basename final-path))))

Instead of calling =E2=80=98canonicalize-path=E2=80=99, which leads to many=
 syscalls,
I=E2=80=99d suggest:

   (interned-file file-name (basename final-path)
                  #:recursive? #f)

I believe that would have the desired effect.

Could you also add a test that reproduces the problem?

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#76376; Package guix-patches. Full text available.

Message received at 76376 <at> debbugs.gnu.org:


Received: (at 76376) by debbugs.gnu.org; 17 Feb 2025 22:18:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 17 17:18:46 2025
Received: from localhost ([127.0.0.1]:50600 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tk9Rt-0007lo-RC
	for submit <at> debbugs.gnu.org; Mon, 17 Feb 2025 17:18:46 -0500
Received: from mail.arctype.co ([138.68.9.245]:50055)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <ryan@HIDDEN>) id 1tk9Rq-0007l8-N6
 for 76376 <at> debbugs.gnu.org; Mon, 17 Feb 2025 17:18:43 -0500
Received: from authenticated-user (mail.arctype.co [138.68.9.245])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))
 (No client certificate requested)
 by mail.arctype.co (Postfix) with ESMTPSA id A5F0B13B17F
 for <76376 <at> debbugs.gnu.org>; Mon, 17 Feb 2025 22:18:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=arctype.co; s=mail;
 t=1739830685; bh=Z+nV1P1yxH6YCGKYsmeGhSAq8ngzDO+ae0XslTso6Mc=;
 h=Date:To:From:Subject:From;
 b=hCees22OseckGq8yRqXxKAPYJuPwSfuUeifekM0VAETKbm4RhNbwYYOZlDz5Psh4r
 JDeQIvWvOI3Gp2E4p81jP+pIRwnHdrkbjkOLvmsbYNjREVva1DAZnLBaFRM7qXRc1v
 motA3kaxQE9htHkMzA99H1VfO24B49GiLqbJKDSwrtw031axa/q8S5wYXzjMJBTsDZ
 kf8lgY7FGF/Zi/VdxlHp5w/191mtwsc+Kj34tXD3tqbXllPQi/ViX9L/e86h3R5BwB
 7LKXEBgLnbZNucfBRRv03b+oNaGcH07TV/2bgwpVadLd5u+6iIqj1iJzlwi6cIUzRp
 nsuk4lLYfAs9g==
Message-ID: <8155d903-bfd1-447d-b639-c98018a19119@HIDDEN>
Date: Mon, 17 Feb 2025 14:18:05 -0800
MIME-Version: 1.0
To: 76376 <at> debbugs.gnu.org
Content-Language: en-US
From: Ryan Sundberg <ryan@HIDDEN>
Subject: Additional context for #76376 - gexp / canonicalize-path
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76376
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello team,

This is a patch for a "deep" bug in Guix gexp processing which evokes in 
circumstances when using g-expressions to build things that try to 
create module closures with code that is referenced in the current 
environment via symlink.

It can manifest in difficult to comprehend errors, such as "no code for 
module: (guix utils)` when guix/utils.scm is correctly defined in the 
load path of the program and exists (but it is a symlink, such as by 
using `guix shell` to load another guix environment, e.g. where the 
shell imports a different guix itself).

In my use case, I was using `guix` to build raw os disk images with my 
own set of customized packages and services when this bug blocked me at 
a dead stop.

The root cause of this after much complex debugging, tracing, and 
reading helped me to identify the bug report from Ludo at 
https://issues.guix.gnu.org/73275 and understand the dangling symlink 
issue. What happens here, and what this patch fixes, is that the 
`interned-file` procedure will not follow symlinks, and will intern a 
symlink if it is told to. In most scenarios this is harmless as the 
symlinks intersect to something (e.g. guix/utils.scm) which is already 
in the profile anyways, so the bug is dormant.
However, in other cases, it is possible to create a dangling symlink 
here when `imported-modules` references a file which is a symlink on the 
Guile %load-path, and `interned-file` in this line of gexp.scm can 
intern a dangling symlink.

This patch closes that possibility by canonicalizing the path of the 
interned file before loading it into the module closure path, so that 
`imported-modules` will never import a dangling symlink to a guile file 
used by a module-closure.

--Ryan






Information forwarded to guix-patches@HIDDEN:
bug#76376; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 17 Feb 2025 21:59:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 17 16:59:26 2025
Received: from localhost ([127.0.0.1]:50460 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tk99C-000310-6D
	for submit <at> debbugs.gnu.org; Mon, 17 Feb 2025 16:59:26 -0500
Received: from lists.gnu.org ([2001:470:142::17]:36440)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ryan@HIDDEN>) id 1tk994-0002zz-BJ
 for submit <at> debbugs.gnu.org; Mon, 17 Feb 2025 16:59:19 -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 <ryan@HIDDEN>) id 1tk98y-0003nY-RQ
 for guix-patches@HIDDEN; Mon, 17 Feb 2025 16:59:12 -0500
Received: from mail.arctype.co ([138.68.9.245])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <ryan@HIDDEN>) id 1tk98w-0002G2-Id
 for guix-patches@HIDDEN; Mon, 17 Feb 2025 16:59:12 -0500
Received: from authenticated-user (mail.arctype.co [138.68.9.245])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
 (No client certificate requested)
 by mail.arctype.co (Postfix) with ESMTPSA id 94FCC13B3B6;
 Mon, 17 Feb 2025 21:58:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=arctype.co; s=mail;
 t=1739829535; bh=vKdpgzDvEqBWHS27E/U7tzuRVcQnsZqymzUUgd8zWo4=;
 h=From:To:Cc:Subject:Date:From;
 b=qNe77IicaLsunoHx7ZwbQgz+aa7VmV0xeTtEmwP2wabbn0Zu8Fi0A5CK5bdrYDbjL
 RDI0BCW6tUI1eQ6d7ZIaC+HCaPq4S46SZcbf9QXS8/bu7BYfZgmeyOjyx9pA9vbK2u
 AZVESw4i6CZN3vIduxINwGpWYPbWxpb+/VGEo9NmYhAL2B90IKnDoKDkOJRaqMtLyt
 PVcg+Ir8WJ34OILI6wW3btDs8rVOvgOsKtkKIDrQfvetE/FF9oITHY1BdLe6vvumaS
 DtCgniWZWljU7P6ZUb9FWbIZOj8CylED9S4YR2yOPTYGP7WtvcBUaCg7qpO1l8nCh0
 F7namNiBdCKTg==
From: Ryan Sundberg <ryan@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] guix: gexp: canonicalize file paths for import
Date: Mon, 17 Feb 2025 13:58:44 -0800
Message-ID: <0dafbea136e328cd214e7e1fb05ab91ab04b17da.1739829485.git.ryan@HIDDEN>
MIME-Version: 1.0
X-Debbugs-Cc: Christopher Baines <guix@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=138.68.9.245; envelope-from=ryan@HIDDEN;
 helo=mail.arctype.co
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,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
Cc: Ryan Sundberg <ryan@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

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





Acknowledgement sent to Ryan Sundberg <ryan@HIDDEN>:
New bug report received and forwarded. Copy sent to guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN. Full text available.
Report forwarded to guix@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN:
bug#76376; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 28 Feb 2025 11:15:02 UTC

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