From: Willy Tarreau Date: Thu, 11 May 2023 14:32:56 +0000 (+0200) Subject: BUG/MINOR: cli: don't complain about empty command on empty lines X-Git-Tag: v2.8-dev12~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=21d7125c923376f5d8b708f49093eeedbe596d6f;p=thirdparty%2Fhaproxy.git BUG/MINOR: cli: don't complain about empty command on empty lines There's something very irritating on the CLI, when just pressing ENTER, it complains "Unknown command: ''..." and dumps all the help. This action is often done to add a bit of clearance after a dump to visually find delimitors later, but this stupid error makes it unusable. This patch addresses this by just returning on empty command instead of trying to look up a matching keyword. It will result in an empty line to mark the end of the empty command and a prompt again. It's probably not worth backporting this given that nobody seems to have complained about it yet. --- diff --git a/src/cli.c b/src/cli.c index 7d058c5743..d66e483508 100644 --- a/src/cli.c +++ b/src/cli.c @@ -800,6 +800,9 @@ static int cli_parse_request(struct appctx *appctx) for (; i < MAX_CLI_ARGS + 1; i++) args[i] = p; + if (!**args) + return 0; + kw = cli_find_kw(args); if (!kw || (kw->level & ~appctx->cli_level & ACCESS_MASTER_ONLY) ||