GNU bug report logs - #43818
search-patches fails when there is a trailing slash on the Guix load path

Previous Next

Package: guix;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Mon, 5 Oct 2020 17:37:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 43818 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#43818; Package guix. (Mon, 05 Oct 2020 17:37:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Mon, 05 Oct 2020 17:37:01 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: bug-guix <bug-guix <at> gnu.org>
Cc: "Mark H. Weaver" <mhw <at> netris.org>
Subject: Use of local-file in icecat-source definition breaks REPL
Date: Mon, 05 Oct 2020 13:36:07 -0400
CC: Mark H Weaver, one of the Icecat maintainer.

Hello,

The problem is that local-file doesn't work in Geiser.  This breaks
working at the REPL:

Enter `,help' for help.
scheme@(guile-user)> ,m (gnu packages linux)
While executing meta-command:
ERROR:
  1. &formatted-message:
      format: "~a: patch not found\n"
      arguments: ("icecat-use-older-reveal-hidden-html.patch")

Any ideas of what could be done about it?

Maxim




Information forwarded to bug-guix <at> gnu.org:
bug#43818; Package guix. (Mon, 05 Oct 2020 17:40:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 43818 <at> debbugs.gnu.org
Cc: "Mark H. Weaver" <mhw <at> netris.org>
Subject: Re: bug#43818: Use of local-file in icecat-source definition breaks
 REPL
Date: Mon, 05 Oct 2020 13:39:34 -0400
Maxim Cournoyer <maxim.cournoyer <at> gmail.com> writes:

> CC: Mark H Weaver, one of the Icecat maintainer.
>
> Hello,
>
> The problem is that local-file doesn't work in Geiser.  This breaks
> working at the REPL:
>
> Enter `,help' for help.
> scheme@(guile-user)> ,m (gnu packages linux)
> While executing meta-command:
> ERROR:
>   1. &formatted-message:
>       format: "~a: patch not found\n"
>       arguments: ("icecat-use-older-reveal-hidden-html.patch")
>
> Any ideas of what could be done about it?
>
> Maxim

The same also occurs for linux-libre patches:

While executing meta-command:
ERROR:
  1. &formatted-message:
      format: "~a: patch not found\n"
      arguments: ("linux-libre-support-for-Pinebook-Pro.patch")

I'll try progressing on the Gexp as a thunked field experiment; this
should allow us to rewrite the orgins in a more straight forward way,
hopefully eschewing this issue.

Maxim




Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Sat, 24 Oct 2020 04:56:02 GMT) Full text and rfc822 format available.

Notification sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
bug acknowledged by developer. (Sat, 24 Oct 2020 04:56:04 GMT) Full text and rfc822 format available.

Message #13 received at 43818-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 43818-done <at> debbugs.gnu.org
Cc: "Mark H. Weaver" <mhw <at> netris.org>, Christopher Baines <mail <at> cbaines.net>
Subject: Re: bug#43818: Use of local-file in icecat-source definition breaks
 REPL
Date: Sat, 24 Oct 2020 00:55:16 -0400
Hello,

Maxim Cournoyer <maxim.cournoyer <at> gmail.com> writes:

> CC: Mark H Weaver, one of the Icecat maintainer.
>
> Hello,
>
> The problem is that local-file doesn't work in Geiser.  This breaks
> working at the REPL:
>
> Enter `,help' for help.
> scheme@(guile-user)> ,m (gnu packages linux)
> While executing meta-command:
> ERROR:
>   1. &formatted-message:
>       format: "~a: patch not found\n"
>       arguments: ("icecat-use-older-reveal-hidden-html.patch")

Thanks for Christopher Baines on #guix who pointed that local-file
seemed to behave correctly at the REPL and Geiser (indeed!).  It made me
try to reproduce it in a --pure environment and I couldn't.

After a couple hours digging, I found that this snippet in my modified
.dir-locals file:

--8<---------------cut here---------------start------------->8---
(with-eval-after-load 'geiser-guile
  (let ((root-dir (locate-dominating-file
                   default-directory ".dir-locals.el")))
    (setq geiser-guile-load-path
          (cons root-dir
                (delete root-dir geiser-guile-load-path)))))
--8<---------------cut here---------------end--------------->8---

Was the culprit, especially the use of with-eval-after-load (which
turned out to be unnecessary).

This snippet allows to switch between git worktrees and always have the
geiser-guile-load-path (which configures both the Guile %load-path and
the %load-compiled-path) set correctly.

Here's the diff of my (fixed) .dir-locals in my Guix git checkout:

--8<---------------cut here---------------start------------->8---
~/src/guix$ git diff .dir-locals.el
diff --git a/.dir-locals.el b/.dir-locals.el
index 19f15b3e1a..0869fbaa20 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -8,7 +8,17 @@
      ;; For use with 'bug-reference-prog-mode'.
      (bug-reference-url-format . "http://bugs.gnu.org/%s")
      (bug-reference-bug-regexp
-      . "<https?://\\(debbugs\\|bugs\\)\\.gnu\\.org/\\([0-9]+\\)>")))
+      . "<https?://\\(debbugs\\|bugs\\)\\.gnu\\.org/\\([0-9]+\\)>")
+
+     ;; Emacs-Guix
+     (eval . (setq guix-directory
+                   (locate-dominating-file default-directory ".dir-locals.el")))
+     ;; Geiser
+     (eval . (let ((root-dir (locate-dominating-file
+                              default-directory ".dir-locals.el")))
+               (setq geiser-guile-load-path
+                     (cons root-dir
+                           (delete root-dir geiser-guile-load-path)))))))
  (c-mode          . ((c-file-style . "gnu")))
  (scheme-mode
   .
--8<---------------cut here---------------end--------------->8---

I am closing this issue, sorry for the noise!

Maxim




Information forwarded to bug-guix <at> gnu.org:
bug#43818; Package guix. (Sun, 25 Oct 2020 02:15:02 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 43818 <at> debbugs.gnu.org
Cc: GNU Debbugs <control <at> debbugs.gnu.org>
Subject: bug#43818: Use of local-file in icecat-source definition breaks REPL)
Date: Sat, 24 Oct 2020 22:14:32 -0400
reopen
thanks

I thought I had this understood, but there is still an issue.  At least
this time I could pinpoint precisely what makes it fail.  It had nothing
to do with the use of `eval-after-load' in my .dir-locals file.

To reproduce the problem, it suffices to append a trailing slash to the Guix entry in the
GUILE_LOAD_PATH:

--8<---------------cut here---------------start------------->8---
maxim <at> hurd ~/src/guix$ GUILE_LOAD_PATH=$PWD:$GUILE_LOAD_PATH GUILE_LOAD_COMPILED_PATH=$PWD:$GUILE_LOAD_COMPILED_PATH guile
GNU Guile 3.0.4
Copyright (C) 1995-2020 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> %load-path
$1 = ("/home/maxim/src/guix" "/home/maxim/src/guile-hacks" "/home/maxim/.guix-profile/share/guile/site/3.0" "/run/current-system/profile/share/g0.4/share/guile/3.0" "/gnu/store/ah16zr8mmfkqy23rr7jy5a842ca1q9h1-guile-3.0.4/share/guile/site/3.0" "/gnu/store/ah16zr8mmfkqy23rr7jy5a842ca1q9h1ca1q9h1-guile-3.0.4/share/guile")
scheme@(guile-user)> ,use (gnu packages linux)
scheme@(guile-user)> 

maxim <at> hurd ~/src/guix$ GUILE_LOAD_PATH=$PWD/:$GUILE_LOAD_PATH GUILE_LOAD_COMPILED_PATH=$PWD/:$GUILE_LOAD_COMPILED_PATH guile
GNU Guile 3.0.4
Copyright (C) 1995-2020 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> %load-path
$1 = ("/home/maxim/src/guix/" "/home/maxim/src/guile-hacks" "/home/maxim/.guix-profile/share/guile/site/3.0" "/run/current-system/profile/share/.0.4/share/guile/3.0" "/gnu/store/ah16zr8mmfkqy23rr7jy5a842ca1q9h1-guile-3.0.4/share/guile/site/3.0" "/gnu/store/ah16zr8mmfkqy23rr7jy5a842ca1q9h2ca1q9h1-guile-3.0.4/share/guile")
scheme@(guile-user)> ,use (gnu packages linux)
While executing meta-command:
ERROR:
  1. &formatted-message:
      format: "~a: patch not found\n"
      arguments: ("icecat-use-older-reveal-hidden-html.patch")
scheme@(guile-user)>
--8<---------------cut here---------------end--------------->8---

To be continued...

Maxim




Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 25 Oct 2020 02:39:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#43818; Package guix. (Sun, 25 Oct 2020 05:54:01 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 43818 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH] packages: Fix a bug in %patch-path.
Date: Sun, 25 Oct 2020 01:52:34 -0400
Fixes <https://issues.guix.gnu.org/43818>.

Having the Guix root trailed by a slash in the GUILE_LOAD_PATH would
previously cause %patch-path to not return an entry with the patches
sub-directory, leading to errors such as:

   While executing meta-command:
   ERROR:
     1. &formatted-message:
         format: "~a: patch not found\n"
         arguments: ("icecat-use-older-reveal-hidden-html.patch")

* gnu/packages.scm (strip-trailing-slash): New procedure.
(%patch-path): Use it to strip any trailing slash from the %load-path entries.
---
 gnu/packages.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/packages.scm b/gnu/packages.scm
index ccfc83dd11..f5acbda897 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2014 Eric Bavier <bavier <at> member.fsf.org>
 ;;; Copyright © 2016, 2017 Alex Kost <alezost <at> gmail.com>
 ;;; Copyright © 2016 Mathieu Lirzin <mthl <at> gnu.org>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -159,6 +160,12 @@ flags."
              %default-package-module-path
              channels-scm))))
 
+(define (strip-trailing-slash s)
+  ;; Strip the trailing slash of a string, if present.
+  (if (string-suffix? "/" s)
+      (string-drop-right s 1)
+      s))
+
 (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.
@@ -167,7 +174,7 @@ flags."
           (if (string=? directory %distro-root-directory)
               (string-append directory "/gnu/packages/patches")
               directory))
-        %load-path)))
+        (map strip-trailing-slash %load-path))))
 
 ;; This procedure is used by Emacs-Guix up to 0.5.1.1, so keep it for now.
 ;; See <https://github.com/alezost/guix.el/issues/30>.
-- 
2.28.0





Added tag(s) patch. Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 25 Oct 2020 05:54:02 GMT) Full text and rfc822 format available.

Changed bug title to 'search-patches fails when there is a trailing slash on the Guix load path' from 'Use of local-file in icecat-source definition breaks REPL' Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 25 Oct 2020 05:57:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#43818; Package guix. (Mon, 26 Oct 2020 23:16:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 43818 <at> debbugs.gnu.org
Subject: Re: bug#43818: [PATCH] packages: Fix a bug in %patch-path.
Date: Tue, 27 Oct 2020 00:15:06 +0100
Hi,

Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis:

> Fixes <https://issues.guix.gnu.org/43818>.
>
> Having the Guix root trailed by a slash in the GUILE_LOAD_PATH would
> previously cause %patch-path to not return an entry with the patches
> sub-directory, leading to errors such as:
>
>    While executing meta-command:
>    ERROR:
>      1. &formatted-message:
>          format: "~a: patch not found\n"
>          arguments: ("icecat-use-older-reveal-hidden-html.patch")
>
> * gnu/packages.scm (strip-trailing-slash): New procedure.
> (%patch-path): Use it to strip any trailing slash from the %load-path entries.
> ---
>  gnu/packages.scm | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)

How can this be reproduced, outside Geiser?  I tried:

  ./pre-inst-env sh -c 'GUILE_LOAD_PATH=$PWD/:$GUILE_LOAD_PATH guix build icecat -n'

with an explicit trailing slash, but it doesn’t trigger the problem.

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#43818; Package guix. (Tue, 27 Oct 2020 16:42:01 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 43818 <at> debbugs.gnu.org
Subject: Re: bug#43818: [PATCH] packages: Fix a bug in %patch-path.
Date: Tue, 27 Oct 2020 12:41:40 -0400
Hello,

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

> Hi,
>
> Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis:
>
>> Fixes <https://issues.guix.gnu.org/43818>.
>>
>> Having the Guix root trailed by a slash in the GUILE_LOAD_PATH would
>> previously cause %patch-path to not return an entry with the patches
>> sub-directory, leading to errors such as:
>>
>>    While executing meta-command:
>>    ERROR:
>>      1. &formatted-message:
>>          format: "~a: patch not found\n"
>>          arguments: ("icecat-use-older-reveal-hidden-html.patch")
>>
>> * gnu/packages.scm (strip-trailing-slash): New procedure.
>> (%patch-path): Use it to strip any trailing slash from the %load-path entries.
>> ---
>>  gnu/packages.scm | 9 ++++++++-
>>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> How can this be reproduced, outside Geiser?  I tried:
>
>   ./pre-inst-env sh -c 'GUILE_LOAD_PATH=$PWD/:$GUILE_LOAD_PATH guix build icecat -n'
>
> with an explicit trailing slash, but it doesn’t trigger the problem.

That's because %patch-path searches for a match in all of the entries in
GUILE_LOAD_PATH, and pre-inst-env added a correct version:

modified   gnu/packages.scm
@@ -167,7 +167,7 @@ flags."
           (if (string=? directory %distro-root-directory)
               (string-append directory "/gnu/packages/patches")
               directory))
-        %load-path)))
+        (pk '%load-path %load-path))))

;;; (%load-path ("/home/maxim/src/guix/" "/home/maxim/src/guix"
    "/home/maxim/src/guix"
    "/gnu/store/dgnjvl87m41rmlcgskl9w1lq47wi77i3-profile/share/guile/site/3.0"
    "/gnu/store/9c4l0pj3rz2kgr984fqxa8fwblkllnz1-profile/share/guile/site/3.0"
    [...]
    "/gnu/store/ah16zr8mmfkqy23rr7jy5a842ca1q9h1-guile-3.0.4/share/guile"))

The following should reproduce it:

$ GUILE_LOAD_PATH=$PWD/:$GUILE_LOAD_PATH GUILE_LOAD_COMPILED_PATH=$PWD:$GUILE_LOAD_COMPILED_PATH guile -c '(use-modules (gnu packages linux))'
Backtrace:
In ice-9/boot-9.scm:
  3393:24 19 (_)
   222:29 18 (map1 (((guix licenses) #:select (lgpl2.0+)) ((guix packages)) ((guix download)) ((guix build-system cmake)) ((guix build-system gnu)) ((gnu packages)) ((gnu packages freedesktop)) ((gnu # #)) # …))
   222:29 17 (map1 (((guix packages)) ((guix download)) ((guix build-system cmake)) ((guix build-system gnu)) ((gnu packages)) ((gnu packages freedesktop)) ((gnu packages glib)) ((gnu packages gtk)) ((# …)) …))
   222:29 16 (map1 (((guix download)) ((guix build-system cmake)) ((guix build-system gnu)) ((gnu packages)) ((gnu packages freedesktop)) ((gnu packages glib)) ((gnu packages gtk)) ((gnu packages gnuzilla)) …))
   222:29 15 (map1 (((guix build-system cmake)) ((guix build-system gnu)) ((gnu packages)) ((gnu packages freedesktop)) ((gnu packages glib)) ((gnu packages gtk)) ((gnu packages gnuzilla)) ((gnu packages …)) …))
   222:29 14 (map1 (((guix build-system gnu)) ((gnu packages)) ((gnu packages freedesktop)) ((gnu packages glib)) ((gnu packages gtk)) ((gnu packages gnuzilla)) ((gnu packages linux)) ((gnu packages nss)) # …))
   222:29 13 (map1 (((gnu packages)) ((gnu packages freedesktop)) ((gnu packages glib)) ((gnu packages gtk)) ((gnu packages gnuzilla)) ((gnu packages linux)) ((gnu packages nss)) ((gnu packages perl)) ((…)) …))
   222:29 12 (map1 (((gnu packages freedesktop)) ((gnu packages glib)) ((gnu packages gtk)) ((gnu packages gnuzilla)) ((gnu packages linux)) ((gnu packages nss)) ((gnu packages perl)) ((gnu packages #)) (#) #))
   222:29 11 (map1 (((gnu packages glib)) ((gnu packages gtk)) ((gnu packages gnuzilla)) ((gnu packages linux)) ((gnu packages nss)) ((gnu packages perl)) ((gnu packages pkg-config)) ((gnu packages qt)) ((…))))
   222:29 10 (map1 (((gnu packages gtk)) ((gnu packages gnuzilla)) ((gnu packages linux)) ((gnu packages nss)) ((gnu packages perl)) ((gnu packages pkg-config)) ((gnu packages qt)) ((gnu packages xml))))
   222:17  9 (map1 (((gnu packages gnuzilla)) ((gnu packages linux)) ((gnu packages nss)) ((gnu packages perl)) ((gnu packages pkg-config)) ((gnu packages qt)) ((gnu packages xml))))
  3297:17  8 (resolve-interface (gnu packages gnuzilla) #:select _ #:hide _ #:prefix _ #:renamer _ #:version _)
In ice-9/threads.scm:
    390:8  7 (_ _)
In ice-9/boot-9.scm:
  3223:13  6 (_)
In ice-9/threads.scm:
    390:8  5 (_ _)
In ice-9/boot-9.scm:
  3507:20  4 (_)
   2806:4  3 (save-module-excursion #<procedure 7f27e7785030 at ice-9/boot-9.scm:3508:21 ()>)
  3527:26  2 (_)
In unknown file:
           1 (primitive-load-path "gnu/packages/gnuzilla" #<procedure 7f27e7795aa0 at ice-9/boot-9.scm:3514:37 ()>)
In gnu/packages/gnuzilla.scm:
   598:23  0 (_)

gnu/packages/gnuzilla.scm:598:23: ERROR:
  1. &formatted-message:
      format: "~a: patch not found\n"
      arguments: ("icecat-use-older-reveal-hidden-html.patch")

Thanks!

Maxim




This bug report was last modified 4 years and 230 days ago.

Previous Next


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