Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Jul 2021 00:28:29 GMT
From:      Ryan Libby <rlibby@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 4544f2ea7dd9 - stable/13 - ddb: reliably fail with ambiguous commands
Message-ID:  <202107030028.1630STKh096427@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=4544f2ea7dd98ad1f216b212a304817ee3bba1db

commit 4544f2ea7dd98ad1f216b212a304817ee3bba1db
Author:     Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2021-02-24 23:56:16 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2021-07-02 21:13:24 +0000

    ddb: reliably fail with ambiguous commands
    
    db_cmd_match had an even/odd bug, where if a third command was partially
    matched (or any odd number greater than one) the search result would be
    set back from CMD_AMBIGUOUS to CMD_FOUND, causing the last command in
    the list to be executed instead of failing the match.
    
    Reported by:    mlaier
    Reviewed by:    markj, mlaier, vangyzen
    Sponsored by:   Dell EMC Isilon
    Differential Revision:  https://reviews.freebsd.org/D28659
    
    (cherry picked from commit d85c9cef1380f4f135aee95ad8c1f4d3eca74c5b)
---
 sys/ddb/db_command.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index 21ff75f78e6a..bfd6c700dc22 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -293,7 +293,7 @@ db_cmd_match(char *name, struct command *cmd, struct command **cmdp,
 			*resultp = CMD_AMBIGUOUS;
 			/* but keep looking for a full match -
 			   this lets us match single letters */
-		} else {
+		} else if (*resultp == CMD_NONE) {
 			*cmdp = cmd;
 			*resultp = CMD_FOUND;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107030028.1630STKh096427>