GNU bug report logs - #76143
[PATCH] gnu: Canonicalize paths before comparing.

Previous Next

Package: guix-patches;

Reported by: Noé Lopez <noe <at> xn--no-cja.eu>

Date: Sat, 8 Feb 2025 13:37:01 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Noé Lopez <noe <at> xn--no-cja.eu>
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>, 76143 <at> debbugs.gnu.org, Christopher Baines <guix <at> cbaines.net>
Subject: [bug#76143] [PATCH] gnu: Canonicalize paths before comparing.
Date: Sun, 09 Feb 2025 12:28:55 +0100
Hi,

Noé Lopez <noe <at> noé.eu> skribis:

> --- a/gnu/packages.scm
> +++ b/gnu/packages.scm
> @@ -167,11 +167,12 @@ (define %patch-path
>    ;; Define it after '%package-module-path' so that '%load-path' contains user
>    ;; directories, allowing patches in $GUIX_PACKAGE_PATH to be found.
>    (make-parameter
> -   (map (lambda (directory)
> -          (if (string=? directory %distro-root-directory)
> -              (string-append directory "/gnu/packages/patches")
> -              directory))
> -        %load-path)))
> +   (let ((root (try-canonicalize-path %distro-root-directory)))
> +     (map (lambda (directory)
> +            (if (string=? (try-canonicalize-path directory) root)
> +                (string-append directory "/gnu/packages/patches")
> +                directory))
> +          %load-path))))

I’m not sure what the goal is but please keep in mind that
‘canonicalize-path’ is expensive in terms of system calls (especially if
‘%load-path’ is long, and we’d pay it for all program startup times),
and that the comparison here remains brittle (checking the dev/ino
fields of ‘stat’ would be more accurate).

Thanks,
Ludo’.




This bug report was last modified 118 days ago.

Previous Next


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