<p> Attention is currently required from: Kevin Harwell. </p>
<p><a href="https://gerrit.asterisk.org/c/asterisk/+/18004">View Change</a></p><p>2 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="null">File main/asterisk.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/18004/comment/1e486540_618b8b91">Patch Set #1, Line 2929:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> if (ast_opt_remote) {<br> /*<br> * This fixes the bug where if the last char typed in<br> * the CLI before pressing TAB or ? is a backslash,<br> * then we get stuck in an infinite loop on the call<br> * to read in this function. This only affects remote<br> * console, so if we encounter a terminating backslash,<br> * get rid of it for the command completion, so the<br> * behavior is the same as foreground console. */<br> char *c = (char*) lf->buffer + strlen(lf->buffer) - 1;<br> if (*c == '\\') {<br> *c = '\0';<br> }<br> }<br></pre></blockquote></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">I'm not entirely sure this is the correct fix for this. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Ack</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/18004/comment/8d98db91_29a3f1aa">Patch Set #1, Line 2988:</a> <code style="font-family:monospace,monospace"> res = read(ast_consock, mbuf + mlen, 1024);</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">After a bit of testing here is where the code hangs. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Here is what is going on - I added log statements when the CLI process sends data to the main process, and whenever it reads something from the main process there.</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pbxdev*CLI> te\sent: _COMMAND MATCHESARRAY "te\" "te\"<br>mbuf now: Usage: _command matchesarray "<line>" text<br> This function is used internally to help with command completion and should.<br> never be called by the user directly.</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Compare this to a "normal" tab complete:<br>pbxdev*CLI> core shsent: _COMMAND MATCHESARRAY "core sh" "sh"<br>mbuf now: show show _EOF_<br> ow</pre><p style="white-space: pre-wrap; word-wrap: break-word;">So one suggestion that comes to mind is let the write to the main process happen as it does now, but if on the first read, we read something starting with "Usage: _command matchesarray" then we know something has gone wrong and we should abort and not continue reading.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Alternately, since it's waiting for AST_CLI_COMPLETE_EOF to appaer in the buffer before stopping the reads, it would seem that adding AST_CLI_COMPLETE_EOF to the usage for this internal command would make the most logical sense.</p><p style="white-space: pre-wrap; word-wrap: break-word;">If I do the latter, then "Usage: " gets printed out to the CLI, which shouldn't happen either, but at least it doesn't block forever.</p><p style="white-space: pre-wrap; word-wrap: break-word;">So that considered, maybe it does make sense to simply "do nothing", i.e. abort if on the first read, we get a "Usage:" - at least, I'm not sure what the sanest thing to do here would be. Thoughts?</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18004">change 18004</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/18004"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I9810ac59304fec162da701653c9c834f0ec8f670 </div>
<div style="display:none"> Gerrit-Change-Number: 18004 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Attention: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Wed, 18 May 2022 16:02:47 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>