From: zimoun <zimon.toutoune@gmail.com>
To: Leo Famulari <leo@famulari.name>
Cc: 46303@debbugs.gnu.org
Subject: bug#46303: Typo helper doesn't always know which command is missing
Date: Thu, 04 Feb 2021 22:29:52 +0100 [thread overview]
Message-ID: <86tuqrbjxr.fsf@gmail.com> (raw)
In-Reply-To: <YBxQxSO57N4kV4N0@jasmine.lan>
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
next prev parent reply other threads:[~2021-02-04 21:40 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-15 16:37 [bug#45893] [PATCH 0/2] DRAFT: Hint for options zimoun
2021-01-15 16:39 ` [bug#45893] [PATCH 1/2] scripts: search, show: Replace 'args-fold*' by 'parse-command-line' zimoun
2021-01-15 16:39 ` [bug#45893] [PATCH 2/2] guix: scripts: Add hint for option typo zimoun
2021-01-19 17:20 ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-19 17:35 ` zimoun
2021-01-16 0:09 ` [bug#45893] [PATCH v2 0/3] DRAFT: Hint command line typo zimoun
2021-01-16 0:26 ` [bug#45893] [PATCH v2 1/3] scripts: search, show: Replace 'args-fold*' by 'parse-command-line' zimoun
2021-01-16 0:26 ` [bug#45893] [PATCH v2 2/3] guix: scripts: Add hint for option typo zimoun
2021-01-19 17:31 ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-16 0:26 ` [bug#45893] [PATCH v2 3/3] ui: Add command hint zimoun
2021-01-19 17:38 ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-19 18:01 ` zimoun
2021-01-26 20:53 ` Ludovic Courtès
2021-01-26 21:27 ` zimoun
2021-01-19 23:59 ` [bug#45893] Hint for package name: too slow! zimoun
2021-01-20 9:49 ` [bug#45893] Hint for package name: full matrix iteration zimoun
2021-01-26 21:00 ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-26 21:44 ` zimoun
2021-01-27 22:09 ` Ludovic Courtès
2021-01-19 21:28 ` [bug#45893] [PATCH v3 1/3] utils: Add string distance zimoun
2021-01-19 21:28 ` [bug#45893] [PATCH v3 2/3] guix: scripts: Add hint for option typo zimoun
2021-01-19 21:28 ` [bug#45893] [PATCH v3 3/3] ui: Add hint for command typo zimoun
2021-01-26 21:18 ` [bug#45893] [PATCH 0/2] DRAFT: Hint for options Ludovic Courtès
2021-01-26 21:20 ` Ludovic Courtès
2021-01-26 22:05 ` zimoun
2021-02-03 11:28 ` bug#45893: " Ludovic Courtès
2021-02-03 12:15 ` [bug#45893] " zimoun
2021-02-24 23:47 ` option hint for all commands? zimoun
2021-03-01 14:07 ` Hartmut Goebel
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 [this message]
2021-02-04 23:08 ` [bug#45893] " zimoun
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86tuqrbjxr.fsf@gmail.com \
--to=zimon.toutoune@gmail.com \
--cc=46303@debbugs.gnu.org \
--cc=leo@famulari.name \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.