GNU bug report logs - #45910
[PATCH] ui: Switch precedence for extensions.

Previous Next

Package: guix-patches;

Reported by: zimoun <zimon.toutoune <at> gmail.com>

Date: Sat, 16 Jan 2021 00:58:02 UTC

Severity: normal

Tags: patch

Done: Ricardo Wurmus <rekado <at> elephly.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45910 in the body.
You can then email your comments to 45910 AT debbugs.gnu.org in the normal way.

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

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


Report forwarded to guix-patches <at> gnu.org:
bug#45910; Package guix-patches. (Sat, 16 Jan 2021 00:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to zimoun <zimon.toutoune <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 16 Jan 2021 00:58:02 GMT) Full text and rfc822 format available.

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

From: zimoun <zimon.toutoune <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: zimoun <zimon.toutoune <at> gmail.com>
Subject: [PATCH] ui: Switch precedence for extensions.
Date: Sat, 16 Jan 2021 01:57:08 +0100
* guix/ui.scm (run-guix-command): Modify order that extensions are allowed to
override default commands.
---
 guix/ui.scm | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index bd504c68da..ad78d5cedd 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -2126,18 +2126,18 @@ found."
   (define module
     (catch 'misc-error
       (lambda ()
-        (resolve-interface `(guix scripts ,command)))
-      (lambda _
         ;; Check if there is a matching extension.
+        (match (search-path (extension-directories)
+                            (format #f "~a.scm" command))
+          (#f
+           (throw 'misc-error))
+          (file
+           (load file)
+           (resolve-interface `(guix extensions ,command)))))
+      (lambda _
         (catch 'misc-error
           (lambda ()
-            (match (search-path (extension-directories)
-                                (format #f "~a.scm" command))
-              (#f
-               (throw 'misc-error))
-              (file
-                (load file)
-                (resolve-interface `(guix extensions ,command)))))
+            (resolve-interface `(guix scripts ,command)))
           (lambda _
             (format (current-error-port)
                     (G_ "guix: ~a: command not found~%") command)

base-commit: 884f320e7ceb35cb8472510e47fc5f1944675d82
-- 
2.29.2





Information forwarded to guix-patches <at> gnu.org:
bug#45910; Package guix-patches. (Thu, 28 Jan 2021 09:23:02 GMT) Full text and rfc822 format available.

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

From: Ricardo Wurmus <rekado <at> elephly.net>
To: 45910 <at> debbugs.gnu.org
Cc: Ricardo Wurmus <rekado <at> elephly.net>, zimoun <zimon.toutoune <at> gmail.com>
Subject: [PATCH] ui: Look up extensions before built-in commands.
Date: Thu, 28 Jan 2021 10:20:56 +0100
From: zimoun <zimon.toutoune <at> gmail.com>

We can do without the extra throw here.  What do you think of this
simpler variant?

* guix/ui.scm (run-guix-command): Modify order so that extensions are allowed
to override default commands.

Co-authored-by: Ricardo Wurmus <rekado <at> elephly.net>
---
 guix/ui.scm | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index bd504c68da..45ae14f83c 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -2124,24 +2124,20 @@ Run COMMAND with ARGS.\n"))
   "Run COMMAND with the given ARGS.  Report an error when COMMAND is not
 found."
   (define module
-    (catch 'misc-error
-      (lambda ()
-        (resolve-interface `(guix scripts ,command)))
-      (lambda _
-        ;; Check if there is a matching extension.
-        (catch 'misc-error
-          (lambda ()
-            (match (search-path (extension-directories)
-                                (format #f "~a.scm" command))
-              (#f
-               (throw 'misc-error))
-              (file
-                (load file)
-                (resolve-interface `(guix extensions ,command)))))
-          (lambda _
-            (format (current-error-port)
-                    (G_ "guix: ~a: command not found~%") command)
-            (show-guix-usage))))))
+    ;; Check if there is a matching extension.
+    (match (search-path (extension-directories)
+                        (format #f "~a.scm" command))
+      (#f
+       (catch 'misc-error
+         (lambda ()
+           (resolve-interface `(guix scripts ,command)))
+         (lambda _
+           (format (current-error-port)
+                   (G_ "guix: ~a: command not found~%") command)
+           (show-guix-usage))))
+      (file
+       (load file)
+       (resolve-interface `(guix extensions ,command)))))
 
   (let ((command-main (module-ref module
                                   (symbol-append 'guix- command))))
-- 
2.29.2






Information forwarded to guix-patches <at> gnu.org:
bug#45910; Package guix-patches. (Thu, 28 Jan 2021 16:38:01 GMT) Full text and rfc822 format available.

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

From: zimoun <zimon.toutoune <at> gmail.com>
To: Ricardo Wurmus <rekado <at> elephly.net>, 45910 <at> debbugs.gnu.org
Cc: Ricardo Wurmus <rekado <at> elephly.net>
Subject: Re: [PATCH] ui: Look up extensions before built-in commands.
Date: Thu, 28 Jan 2021 17:26:49 +0100
Hi Ricardo,

On Thu, 28 Jan 2021 at 10:20, Ricardo Wurmus <rekado <at> elephly.net> wrote:

> We can do without the extra throw here.  What do you think of this
> simpler variant?

Yeah that’s much better. :-)

Thanks,
simon




Reply sent to Ricardo Wurmus <rekado <at> elephly.net>:
You have taken responsibility. (Thu, 28 Jan 2021 17:54:01 GMT) Full text and rfc822 format available.

Notification sent to zimoun <zimon.toutoune <at> gmail.com>:
bug acknowledged by developer. (Thu, 28 Jan 2021 17:54:01 GMT) Full text and rfc822 format available.

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

From: Ricardo Wurmus <rekado <at> elephly.net>
To: zimoun <zimon.toutoune <at> gmail.com>
Cc: 45910-done <at> debbugs.gnu.org
Subject: Re: [PATCH] ui: Look up extensions before built-in commands.
Date: Thu, 28 Jan 2021 18:53:00 +0100
Pushed!

-- 
Ricardo




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 26 Feb 2021 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 31 days ago.

Previous Next


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