GNU bug report logs - #55913
run-guix-command catches too much, causing bogus "guix: ~a: command not found" error messages

Previous Next

Package: guix;

Reported by: Maxime Devos <maximedevos <at> telenet.be>

Date: Sat, 11 Jun 2022 19:24:01 UTC

Severity: normal

To reply to this bug, email your comments to 55913 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#55913; Package guix. (Sat, 11 Jun 2022 19:24:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxime Devos <maximedevos <at> telenet.be>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sat, 11 Jun 2022 19:24:01 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: bug-guix <at> gnu.org
Subject: run-guix-command catches too much, causing bogus "guix: ~a: command
 not found" error messages
Date: Sat, 11 Jun 2022 21:22:56 +0200
[Message part 1 (text/plain, inline)]
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
[signature.asc (application/pgp-signature, inline)]

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

Previous Next


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