From: Maxime Devos <maximedevos@telenet.be>
To: 55913@debbugs.gnu.org
Subject: bug#55913: run-guix-command catches too much, causing bogus "guix: ~a: command not found" error messages
Date: Sat, 11 Jun 2022 21:22:56 +0200 [thread overview]
Message-ID: <5d91e5d62cc52af3a0893c34e46b7a42c4eea8c5.camel@telenet.be> (raw)
[-- Attachment #1: Type: text/plain, Size: 1898 bytes --]
Hi,
Someone on IRC (#guix) didn't have guile-json in their environment or
something. When they did "./pre-inst-env guix lint", that failed with
"guix: lint: command not found", which is bogus, since
guix/scripts/lint.{scm,go} existed.
The issue was tracked down to the 'run-guix-command' procedure, in
particular the definition of module:
(define module
;; Check if there is a matching extension.
(match [something that returns #false in this situation]
(#f
(catch 'misc-error
(lambda ()
(resolve-interface `(guix scripts ,command)))
(lambda _
(let ((hint (command-hint command (commands))))
(format (current-error-port)
(G_ "guix: ~a: command not found~%") command)
(when hint
(display-hint (format #f (G_ "Did you mean @code{~a}?")
hint)))
(show-guix-usage)))))
(file [a case that doesn't apply here])))
To test the hypothesis that exception handling went wrong, the
exception handling was modified to do some 'pk':
(catch 'misc-error
(lambda ()
(resolve-interface `(guix scripts ,command)))
(lambda _
(pk 'what _) ; <---- new line!
[old code]))
which resulted in:
;;; (what (misc-error #f "no code for module ~S" ((json)) #f))
My proposal to avoid the wrong error message is (untested):
;; #:ensure #false: don't create an empty module when not found
;; (why is #:ensure #true even the default?).
(let ((module (resolve-module `(guix scripts ,command)
#:ensure #false)))
(if module
(module-public-interface module) ; script module was found
[display hints & error message & guix-usage etc.]))
(Reported-By: foobarxyz on #guix)
Greetings,
Maxime
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
reply other threads:[~2022-06-11 19:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5d91e5d62cc52af3a0893c34e46b7a42c4eea8c5.camel@telenet.be \
--to=maximedevos@telenet.be \
--cc=55913@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).