[Asterisk-code-review] cli: Fix CLI blocking forever on terminating backslash (asterisk[master])

N A asteriskteam at digium.com
Sat Jun 11 15:30:07 CDT 2022


Attention is currently required from: N A.
Hello Kevin Harwell, Friendly Automation, 

I'd like you to reexamine a change. Please visit

    https://gerrit.asterisk.org/c/asterisk/+/18004

to look at the new patch set (#4).

Change subject: cli: Fix CLI blocking forever on terminating backslash
......................................................................

cli: Fix CLI blocking forever on terminating backslash

A corner case exists in CLI parsing where if
a CLI user in a remote console ends with
a backslash and then invokes command completion
(using TAB or ?), then the console will freeze
forever until a SIGQUIT signal is sent to the
process, due to getting blocked forever
reading the command completion. CTRL+C
and other key combinations have no impact on
the CLI session.

This occurs because, in such cases, the CLI
process is waiting for AST_CLI_COMPLETE_EOF
to appear in the buffer from the main process,
but instead the main process is confused by
the funny syntax and thus prints out the CLI help.
As a result, the CLI process is stuck on the
read call, waiting for the completion that
will never come.

This prevents blocking forever by checking
if the data from the main process starts with
"Usage:". If it does, that means that CLI help
was sent instead of the tab complete vector,
and thus the CLI should bail out and not wait
any longer.

ASTERISK-29822 #close

Change-Id: I9810ac59304fec162da701653c9c834f0ec8f670
---
M main/asterisk.c
1 file changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/04/18004/4
-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18004
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I9810ac59304fec162da701653c9c834f0ec8f670
Gerrit-Change-Number: 18004
Gerrit-PatchSet: 4
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Attention: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newpatchset
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220611/50e1fccb/attachment.html>


More information about the asterisk-code-review mailing list