guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

06/06: scripts: Don't trigger option hints for short options.


From: guix-commits
Subject: 06/06: scripts: Don't trigger option hints for short options.
Date: Mon, 22 Feb 2021 17:44:27 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 11f11d7ecb817d1421f8b5340bcced59396d8708
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Feb 22 23:38:46 2021 +0100

    scripts: Don't trigger option hints for short options.
    
    Previously, 'guix install foo -r bar' would crash with a backtrace
    because NAME would be #\r (a character instead of a string).
    
    * guix/scripts.scm (parse-command-line)[parse-options-from]: Call
    'option-hint' only when NAME is a string.
---
 guix/scripts.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/guix/scripts.scm b/guix/scripts.scm
index c9ea9f2..0c896a2 100644
--- a/guix/scripts.scm
+++ b/guix/scripts.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019, 2020 Ludovic Courtès 
<ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019, 2020, 2021, 2021 Ludovic 
Courtès <ludo@gnu.org>
 ;;; Copyright © 2014 Deck Pickard <deck.r.pickard@gmail.com>
 ;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
@@ -157,7 +157,8 @@ parameter of 'args-fold'."
     ;; Actual parsing takes place here.
     (apply args-fold* args options
            (lambda (opt name arg . rest)
-             (let ((hint (option-hint name options)))
+             (let ((hint (and (string? name)      ;not a short option
+                              (option-hint name options))))
                (report-error (G_ "~A: unrecognized option~%") name)
                (when hint
                  (display-hint



reply via email to

[Prev in Thread] Current Thread [Next in Thread]