[Home]

Summary:ASTERISK-15936: [patch] CLI prompt interfers with CLI output
Reporter:Miguel Molina (coolmig)Labels:
Date Opened:2010-04-09 16:20:12Date Closed:2010-06-09 11:54:07
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20100528__issue17160.diff.txt
( 1) 20100531__issue17160.diff.txt
Description:Some characters of the CLI prompt are printed in the asterisk CLI output:

virtual2_ast2*CLI> cdr show status
virtual2_ast2*CLI>
Call Detail Record (CDR) settings
----------------------------------
 Logging:                    Enabled
 Mode:                       Simple
 Log unanswered calls:       No

* Registered Backends
 -------------------
   csv2_ast2*CLI>              <<<-- Here
   cdr-customCLI>              <<<-- Here
   pgsqlast2*CLI>              <<<-- Here

virtual2_ast2*CLI> core show channels
Channel              Location             State   Application(Data)            
0 active channels>
0 active callsCLI>               <<<-- Here
0 calls processed>
virtual2_ast2*CLI>

This happens in a lot of commands.

Looks like in certain cases, when the line string has less than the CLI prompt characters, the remaining characters are printed. This makes output unclean.
Comments:By: Paul Belanger (pabelanger) 2010-04-09 17:31:34

Can't reproduce the issue. We need to know more information about your terminal. OS, shell, etc.

By: Leif Madsen (lmadsen) 2010-04-12 10:09:27

I've seen the same thing as well (I haven't reproduced this issue right now), so it likely has something to do with which shell and terminal is being used.

By: Miguel Molina (coolmig) 2010-04-12 11:06:07

Server OS: CentOS 5.4

Client OS: Ubuntu 9.10
Terminal used: bash over gnome-terminal (pretty standard)

Over the terminal I access the asterisk server via SSH and enter the CLI with asterisk -r. Pretty standard too.

As seen in the output that I posted, not all the lines get that kind of output, that behavior is quite random. So to reproduce the issue could be necessary to execute several commands until you see the "trailing" characters from the CLI prompt. So you can change the reproducibility from always to random if you want...

By: Miguel Molina (coolmig) 2010-04-12 11:10:48

The server is on an OpenVZ environment, so I have disabled the TTY9 on safe_asterisk. I don't know if it makes any difference, because I've seen this issue on normal physical servers with the TTY9 enabled.

By: Leif Madsen (lmadsen) 2010-04-13 14:02:53

I just tried doing this on my VMware virtual machine (I think it's running CentOS 5.3) and I saw it briefly, then changed something, and now I can't get it again. This was on some old version of trunk though. I'm recompiling in 1.6.2.7-rc1 to see if I get it or not though.

Will keep you posted.

By: Paul Belanger (pabelanger) 2010-05-12 12:36:13

Any update lmadsen?

By: Leif Madsen (lmadsen) 2010-05-17 10:56:28

Sorry, haven't really noticed it again... if I do I'll post something back here (if I remember :))

By: Tilghman Lesher (tilghman) 2010-05-28 17:19:37

Patch uploaded that should fix this issue.  Please test and verify that it works for you.

By: Miguel Molina (coolmig) 2010-05-31 10:12:36

Thanks for your patch Tilghman, it seems to work with certain commands like "cdr show status", but found one command that stays the same:

virtual2_ast2*CLI> core show calls
0 active callsCLI>                    
0 calls processed
virtual2_ast2*CLI> core show calls
0 active callsCLI>                    
0 calls processed
virtual2_ast2*CLI> core show calls
0 active callsCLI>                    
0 calls processed
virtual2_ast2*CLI> core show calls
0 active callsCLI>                    
0 calls processed
virtual2_ast2*CLI> core show calls
0 active callsCLI>                    
0 calls processed>                    
virtual2_ast2*CLI> core show calls
0 active callsCLI>                    
0 calls processed>                

On other command like "core show channels" the output seems to be clean.

I tested this in 1.6.2.8-rc1, the patch applied cleanly with -25 lines offset on all hunks.

By: Tilghman Lesher (tilghman) 2010-05-31 10:51:52

New patch uploaded.

By: Miguel Molina (coolmig) 2010-05-31 11:03:43

OK I reverted the first patch, applied the new one on 1.6.2.8-rc1 and all CLI output commands I tested have clean output. Very nice, thanks!

By: Digium Subversion (svnbot) 2010-06-01 10:17:46

Repository: asterisk
Revision: 266585

U   branches/1.4/main/asterisk.c

------------------------------------------------------------------------
r266585 | tilghman | 2010-06-01 10:17:45 -0500 (Tue, 01 Jun 2010) | 11 lines

Prevent CLI prompt from distorting output of lines shorter than the prompt.

Uses the VT100 method of clearing the line from the cursor position to the
end of the line:  Esc-0K

(closes issue ASTERISK-15936)
Reported by: coolmig
Patches:
      20100531__issue17160.diff.txt uploaded by tilghman (license 14)
Tested by: coolmig

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=266585

By: Digium Subversion (svnbot) 2010-06-01 10:19:00

Repository: asterisk
Revision: 266592

_U  trunk/
U   trunk/main/asterisk.c

------------------------------------------------------------------------
r266592 | tilghman | 2010-06-01 10:19:00 -0500 (Tue, 01 Jun 2010) | 18 lines

Merged revisions 266585 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r266585 | tilghman | 2010-06-01 10:17:46 -0500 (Tue, 01 Jun 2010) | 11 lines
 
 Prevent CLI prompt from distorting output of lines shorter than the prompt.
 
 Uses the VT100 method of clearing the line from the cursor position to the
 end of the line:  Esc-0K
 
 (closes issue ASTERISK-15936)
  Reported by: coolmig
  Patches:
        20100531__issue17160.diff.txt uploaded by tilghman (license 14)
  Tested by: coolmig
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=266592

By: Digium Subversion (svnbot) 2010-06-01 10:20:20

Repository: asterisk
Revision: 266598

_U  branches/1.6.2/
U   branches/1.6.2/main/asterisk.c

------------------------------------------------------------------------
r266598 | tilghman | 2010-06-01 10:20:20 -0500 (Tue, 01 Jun 2010) | 25 lines

Merged revisions 266592 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r266592 | tilghman | 2010-06-01 10:18:59 -0500 (Tue, 01 Jun 2010) | 18 lines
 
 Merged revisions 266585 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r266585 | tilghman | 2010-06-01 10:17:46 -0500 (Tue, 01 Jun 2010) | 11 lines
   
   Prevent CLI prompt from distorting output of lines shorter than the prompt.
   
   Uses the VT100 method of clearing the line from the cursor position to the
   end of the line:  Esc-0K
   
   (closes issue ASTERISK-15936)
    Reported by: coolmig
    Patches:
          20100531__issue17160.diff.txt uploaded by tilghman (license 14)
    Tested by: coolmig
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=266598