<p>Neels Hofmeyr <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/12772">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Harald Welte: Looks good to me, approved
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">vty telnet: consistently never change nodes upon CTRL-C<br><br>Remove any special node exiting from the VTY CTRL-C handling.<br><br>From a curious VTY transcript test glitch, I noticed weird behavior by the VTY<br>telnet shell: usually, when the user hits CTRL-C, that means to cancel the<br>current command line and present a fresh, clean prompt. However, only on the<br>CONFIG_NODE and CFG_LOG_NODE, a CTRL-C also exits the current node and moves up<br>by one level. This behavior is unexplainable and makes zero sense.<br><br>No other nodes exit on CTRL-C:<br>- on the ENABLE node, a CTRL-C stays on the ENABLE_NODE and doesn't exit to the<br>  VIEW_NODE.<br>- any sub-nodes of the CONFIG_NODE stay unchanged, e.g. 'network' or 'bts' /<br>  'trx', etc.<br><br>There is no apparent special meaning of CTRL-C on CONFIG_NODE nor CFG_LOG_NODE<br>to justify this odd choice.<br><br>Particularly, the vty transcript tests using osmo_verify_transcript_vty.py rely<br>on sending CTRL-C to clear the command prompt, so that we can properly test<br>sending '?' to the VTY during transcripts. In a live session, a '?' prints<br>available options and then updates the prompt with identical command arguments.<br>In a transcript test, that doesn't make sense, because each time the transcript<br>writes out a new command to run. Consider e.g. a transcript test like:<br><br>      tdef_vty_test(config)# timer ?<br>          tea       Tea time<br>    test      Test timers<br>         software  Typical software development cycle<br><br>      tdef_vty_test(config)# timer tea ?<br>      [TNNNN]  T-number, optionally preceded by 't' or 'T'.<br><br>To be able to issue a fresh command after '?', osmo_verify_transcript_vty.py<br>explicitly sends a CTRL-C to clear the command buffer. Hence there we rely on<br>predictable behavior of CTRL-C.<br><br>More particularly, the upcoming osmo_tdef_vty transcript tests are apparently<br>the first that want to test '?' behavior on the CONFIG_NODE's root level and<br>fall on their face, because of the implicit exit that happens only there.<br><br>Change-Id: I4f339ba61f1c273fa7da85caf77ba116ae2697b1<br>---<br>M src/vty/vty.c<br>1 file changed, 0 insertions(+), 18 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/vty/vty.c b/src/vty/vty.c</span><br><span>index abce887..8c89197 100644</span><br><span>--- a/src/vty/vty.c</span><br><span>+++ b/src/vty/vty.c</span><br><span>@@ -1217,24 +1217,6 @@</span><br><span>       vty->cp = vty->length = 0;</span><br><span>     vty_clear_buf(vty);</span><br><span>  vty_out(vty, "%s", VTY_NEWLINE);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-      switch (vty->node) {</span><br><span style="color: hsl(0, 100%, 40%);">- case VIEW_NODE:</span><br><span style="color: hsl(0, 100%, 40%);">- case ENABLE_NODE:</span><br><span style="color: hsl(0, 100%, 40%);">-               /* Nothing to do. */</span><br><span style="color: hsl(0, 100%, 40%);">-            break;</span><br><span style="color: hsl(0, 100%, 40%);">-  case CONFIG_NODE:</span><br><span style="color: hsl(0, 100%, 40%);">-       case VTY_NODE:</span><br><span style="color: hsl(0, 100%, 40%);">-          vty_config_unlock(vty);</span><br><span style="color: hsl(0, 100%, 40%);">-         vty->node = ENABLE_NODE;</span><br><span style="color: hsl(0, 100%, 40%);">-             break;</span><br><span style="color: hsl(0, 100%, 40%);">-  case CFG_LOG_NODE:</span><br><span style="color: hsl(0, 100%, 40%);">-              vty->node = CONFIG_NODE;</span><br><span style="color: hsl(0, 100%, 40%);">-             break;</span><br><span style="color: hsl(0, 100%, 40%);">-  default:</span><br><span style="color: hsl(0, 100%, 40%);">-                /* Unknown node, we have to ignore it. */</span><br><span style="color: hsl(0, 100%, 40%);">-               break;</span><br><span style="color: hsl(0, 100%, 40%);">-  }</span><br><span>    vty_prompt(vty);</span><br><span> </span><br><span>         /* Set history pointer to the latest one. */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/12772">change 12772</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.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.osmocom.org/12772"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I4f339ba61f1c273fa7da85caf77ba116ae2697b1 </div>
<div style="display:none"> Gerrit-Change-Number: 12772 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Vadim Yanitskiy <axilirator@gmail.com> </div>