GNU bug report logs - #66901
[PATCH] scripts: edit: Fix relative file-name with 'load-path' option.

Previous Next

Package: guix-patches;

Reported by: Simon Tournier <zimon.toutoune <at> gmail.com>

Date: Thu, 2 Nov 2023 20:36:01 UTC

Severity: normal

Tags: patch

Done: Simon Tournier <zimon.toutoune <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 66901 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Simon Tournier <zimon.toutoune <at> gmail.com>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, Mathieu Othacehe <othacehe <at> gnu.org>,
 Tobias Geerinckx-Rice <me <at> tobias.gr>, Ricardo Wurmus <rekado <at> elephly.net>,
 66901 <at> debbugs.gnu.org, Christopher Baines <guix <at> cbaines.net>
Subject: Re: [bug#66901] [PATCH] scripts: edit: Fix relative file-name with
 'load-path' option.
Date: Sun, 05 Nov 2023 15:58:12 +0100
Hi!

Simon Tournier <zimon.toutoune <at> gmail.com> skribis:

> * guix/scripts/edit.scm (search-path*): Use 'canonicalize-path' if
> 'search-path' fails.

[...]

> $ guix edit -L src/example hi
> guix edit: error: file 'src/example/first.scm' not found in search path ("src/example" "/gnu/store/yzib23ah0rlmim0j4737g2wrhx1r1q3r-guix-module-union/share/guile/site/3.0" "/gnu/store/84rvhd3j7pfqrh7717cv7ddv2dc8xad5-guile-3.0.9/share/guile/3.0" "/gnu/store/84rvhd3j7pfqrh7717cv7ddv2dc8xad5-guile-3.0.9/share/guile/3.0" "/gnu/store/84rvhd3j7pfqrh7717cv7ddv2dc8xad5-guile-3.0.9/share/guile/site/3.0" "/gnu/store/84rvhd3j7pfqrh7717cv7ddv2dc8xad5-guile-3.0.9/share/guile/site" "/gnu/store/84rvhd3j7pfqrh7717cv7ddv2dc8xad5-guile-3.0.9/share/guile" "/home/simon/.guix-profile/share/guile/site/3.0" "/home/simon/.config/guix/profiles/emacs/emacs/share/guile/site/3.0" "/home/simon/.guix-profile/share/guile/site/3.0" "/home/simon/.config/guix/profiles/emacs/emacs/share/guile/site/3.0")
>
>
> The issue is that the procedure 'search-path' returns #f.  It looks similar as
> fixed bug #42543 [1] by d10474c38d58bdc676e64336769dc2e00cdfa8ed.
>
> Here, I do not know how to avoid 'canonicalize-path' when 'search-path'
> returns #f because some relative.

[...]

>  (define (search-path* path file)
>    "Like 'search-path' but exit if FILE is not found."
> -  (let ((absolute-file-name (search-path path file)))
> +  (let ((absolute-file-name (or (search-path path file)
> +                                ;; It could be that FILE is a relative name
> +                                ;; i.e., not relative to an element of PATH.
> +                                (and (file-exists? file)
> +                                     (canonicalize-path file)))))

I think we can remove the ‘canonicalize-path’ call here since we know
that FILE denotes a valid file at that point.  (That’d avoid the extra
work ‘canonicalize-path’ does.)

Otherwise LGTM!

Thanks,
Ludo’.




This bug report was last modified 1 year and 199 days ago.

Previous Next


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