unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#46303: Typo helper doesn't always know which command is missing
       [not found] ` <20210119212810.20681-1-zimon.toutoune@gmail.com>
@ 2021-02-04 19:53   ` Leo Famulari
  2021-02-04 21:29     ` zimoun
  0 siblings, 1 reply; 3+ messages in thread
From: Leo Famulari @ 2021-02-04 19:53 UTC (permalink / raw)
  To: zimoun; +Cc: 46303

On Tue, Jan 19, 2021 at 10:28:08PM +0100, zimoun wrote:
> * guix/utils.scm (string-distance): New procedure.
> (string-closest): New procedure.
> * tests/utils.scm: Test it.

This is a great feature, but I found a tricky failure:

------
$ ./pre-inst-env guix system vm --no-grafts doc/os-config-bare-bones.texi --substitute-urls=https://ci.guix.gnu.org -d
guix: system: command not found                                                                                                          
hint: Did you mean `system'?

Try `guix --help' for more information.
$ guix environment guix
$ ./pre-inst-env guix system vm --no-grafts doc/os-config-bare-bones.texi -d
/gnu/store/pw453xpixcll02w1nz9mfggm2cn0jqpx-run-vm.sh.drv
------

It will only be seen by developers, so not a big deal, but it would
still be nice to correctly report which command is missing. Some
run-time dependency of guix is missing.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#46303: Typo helper doesn't always know which command is missing
  2021-02-04 19:53   ` bug#46303: Typo helper doesn't always know which command is missing Leo Famulari
@ 2021-02-04 21:29     ` zimoun
  2021-02-04 23:08       ` [bug#45893] " zimoun
  0 siblings, 1 reply; 3+ messages in thread
From: zimoun @ 2021-02-04 21:29 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 46303

Hi Leo,

On Thu, 04 Feb 2021 at 14:53, Leo Famulari <leo@famulari.name> wrote:
> On Tue, Jan 19, 2021 at 10:28:08PM +0100, zimoun wrote:
>> * guix/utils.scm (string-distance): New procedure.
>> (string-closest): New procedure.
>> * tests/utils.scm: Test it.
>
> This is a great feature, but I found a tricky failure:
>
> ------
> $ ./pre-inst-env guix system vm --no-grafts doc/os-config-bare-bones.texi --substitute-urls=https://ci.guix.gnu.org -d
> guix: system: command not found                                                                                                          
> hint: Did you mean `system'?
>
> Try `guix --help' for more information.
> $ guix environment guix
> $ ./pre-inst-env guix system vm --no-grafts doc/os-config-bare-bones.texi -d
> /gnu/store/pw453xpixcll02w1nz9mfggm2cn0jqpx-run-vm.sh.drv
> ------
>
> It will only be seen by developers, so not a big deal, but it would
> still be nice to correctly report which command is missing. Some
> run-time dependency of guix is missing.

I am missing, because the command line is not wrong. :-)

Well, I am missing what you are suggesting.  I mean if “./pre-inst-env
guix <foo>” is run in an incorrect environment, then, I am not sure what
could be done.  How does it work with a commit which predates the hint
introduction?  How does it fail?  I guess it fails, if not I am missing
something. :-)


Basically, when “guix system” is called (or any other command), it
enters in ’run-guix-command’ and does this snippet:

--8<---------------cut here---------------start------------->8---
       (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)))))
--8<---------------cut here---------------end--------------->8---

Therefore, it means that “(resolve-interface `(guix scripts ,command))”
fails for some reasons.  It seems really hard to catch the reasons.
Well, this cannot happen with regular “guix <foo>” otherwise it is
severe bug.  And in a developer setup, so much stuff could be wrong.

Well, these run-time dependencies could be checked by the script
“./pre-inst-env” but I do not know if it is worth.

Could you explain more what you would like?


On a side note, trying I get that the hint seems to work…

--8<---------------cut here---------------start------------->8---
$ guix system vm --no-grafts ~/src/guix/guix/doc/os-config-bare-bones.texi --substitute-urls=https://ci.guix.gnu.org --dry-run --derivatio
guix system: error: derivatio: unrecognized option
hint: Did you mean `derivation'?
--8<---------------cut here---------------end--------------->8---

…but not work for all the options:

--8<---------------cut here---------------start------------->8---
$ guix system vm --no-grafts ~/src/guix/guix/doc/os-config-bare-bones.texi --substitute-rls=https://ci.guix.gnu.org --dr-run --derivation
guix system: error: substitute-rls=https://ci.guix.gnu.org: unrecognized option
--8<---------------cut here---------------end--------------->8---

Another story than your report, right?


Cheers,
simon




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug#45893] Typo helper doesn't always know which command is missing
  2021-02-04 21:29     ` zimoun
@ 2021-02-04 23:08       ` zimoun
  0 siblings, 0 replies; 3+ messages in thread
From: zimoun @ 2021-02-04 23:08 UTC (permalink / raw)
  To: Leo Famulari; +Cc: Bug Guix

Hi,

On Thu, 4 Feb 2021 at 22:39, zimoun <zimon.toutoune@gmail.com> wrote:

> …but not work for all the options:
>
> --8<---------------cut here---------------start------------->8---
> $ guix system vm --no-grafts ~/src/guix/guix/doc/os-config-bare-bones.texi --substitute-rls=https://ci.guix.gnu.org --dr-run --derivation
> guix system: error: substitute-rls=https://ci.guix.gnu.org: unrecognized option
> --8<---------------cut here---------------end--------------->8---

Fixed by patch#46308.  <http://issues.guix.gnu.org/issue/46308>

All the best,
simon




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-04 23:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210115163732.53665-1-zimon.toutoune@gmail.com>
     [not found] ` <20210119212810.20681-1-zimon.toutoune@gmail.com>
2021-02-04 19:53   ` bug#46303: Typo helper doesn't always know which command is missing Leo Famulari
2021-02-04 21:29     ` zimoun
2021-02-04 23:08       ` [bug#45893] " zimoun

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).