[Home]

Summary:ASTERISK-13264: [patch] CLI shows colorization code incorrectly sometimes
Reporter:Miguel Molina (coolmig)Labels:
Date Opened:2008-12-23 08:02:16.000-0600Date Closed:2009-01-21 15:04:49.000-0600
Priority:TrivialRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20090121__bug14130.diff.txt
( 1) color_cli.png
( 2) consola.txt
( 3) vi_console_file.png
Description:When the CLI displays colored characters, sometimes looks like the colorization code fails to display, showing the underlying code of the color. See the examples.

****** ADDITIONAL INFORMATION ******

Some examples of the problem:

   -- Executing [agt2@gdincoming:2] WaitMusicOnHold("�[1    ;35;40mSIP/TRUNK_COBRANZAS-098f1648", "5") in new stack
   -- Started music on hold, class 'default', on SIP/TRUNK_COBRANZAS-098f1648
   -- Stopped music on hold on SIP/TRUNK_COBRANZAS-098f1648

(Notice the "�[1    ;35;40m before SIP/TRUNK...)

   -- Executing [711@agent:7] UserEvent("SIP/TRUNK_COBRANZAS-098a9cf0", "AgentCalled|Channel: SIP/TRUNK_COBRANZAS-098a9cf0|Agent/711 (3178115459) [1230040048.9847]) ~Telecobranzas4-3780-false~�[0;  37;40m") in new stack
   -- Executing [711@agent:8] MixMonitor("SIP/TRUNK_COBRANZAS-098a9cf0", "/var/grabaciones/.../salida/hoy/1230040048.9847.gsm|b") in new stack

(Notice the �[0;  37;40m after the text)

   -- Executing [716@agent:4] Set("SIP/TRUNK_COBRANZAS-098ac1f0", "AGENTCALLED=716") in new stack
   -- Executing [716@agent:5] Set("SIP/TRUNK_COBRANZAS-098ac1f0", "�[1;35;40   mDYNCONF=(3106600335)") in new stack
   -- Executing [716@agent:6] Set("SIP/TRUNK_COBRANZAS-098ac1f0", "UID=[1230040144.9865])") in new stack

(Notice the �[1;35;40   m before the text)
Comments:By: Tilghman Lesher (tilghman) 2008-12-23 08:52:46.000-0600

What's the output of "core show version" ?

By: Miguel Molina (coolmig) 2008-12-23 08:54:19.000-0600

core show version:

Asterisk 1.4.22 built by root @ electricaribe-telecobranzas on a i686 running Linux on 2008-12-19 13:56:09 UTC

By: Tilghman Lesher (tilghman) 2008-12-23 08:57:36.000-0600

What's the version of gcc and glibc?

By: Miguel Molina (coolmig) 2008-12-23 08:59:59.000-0600

Here are the versions:

# rpm -q gcc
gcc-4.1.2-42.el5
# rpm -q glibc
glibc-2.5-24.el5_2.2

The machine is a CentOS 5.2 with latest yum updates applied.

By: Tilghman Lesher (tilghman) 2008-12-23 09:03:20.000-0600

Something is inserting a space in the middle of the term color code, which isn't present in the 1.4.22 code.  I have no idea where that space is being generated.  The only thing that comes to mind is either additional patches that you have applied or library or compiler bugs.

By: Miguel Molina (coolmig) 2008-12-23 09:12:00.000-0600

OK thanks for the input, I'll check against a "pure" 1.4.22 version to discard patches as a source of the problem. I would like to see if someone else experiences the same issue, because I see it very often on different servers of the company.

By: Leif Madsen (lmadsen) 2008-12-23 09:24:52.000-0600

Is this over SSH? I see this too, but I always just assumed it was because of some sort of dropped packet.

By: Miguel Molina (coolmig) 2008-12-23 09:27:49.000-0600

Yes I usually always see the asterisk CLI over SSH sessions.

By: Leif Madsen (lmadsen) 2009-01-06 09:13:28.000-0600

Ya, I've never seen this locally, but I've seen it when going over SSH. I have a feeling this is really a network/external issue to Asterisk. I'm going to close this issue for now because I'm not convinced this is really an issue with Asterisk itself. Please find me as 'lmadsen' on irc.freenode.net in #asterisk-bugs if you would like to discuss further. Thanks!

By: Clod Patry (junky) 2009-01-17 17:51:10.000-0600

I've found a way where we can replicate this with latest trunk.

do a !reset it will return to black (where it should be).

do a core show application (any_app).

the CLI line will be gray (instead of black).

tested with both: asterisk -cvvvvv and asterisk -rvvvv

By: Tilghman Lesher (tilghman) 2009-01-17 22:37:13.000-0600

junky:  That's not exactly kosher, as you are inserting extra color codes into the stream, where Asterisk would not normally.  In fact, you can screw up many full screen programs by doing this, as they generally expect that the codes they set will continue to be effective.

We could, of course, reset the terminal codes everytime you execute an external command, but I don't really see the point.  If you screw up your own terminal settings intentionally, it's your own fault, not Asterisk's.

By: pj (pj) 2009-01-18 02:12:19.000-0600

I have this issue too, look at color_cli.png
It appears on pure asterisk 1.6branch (without any patches)
Asterisk SVN-branch-1.6.0-r147195-/trunk
I access asterisk cli through ssh

By: Miguel Molina (coolmig) 2009-01-19 08:25:07.000-0600

I don't feel this issue could be classified as packet loss over SSH. If packet loss really ocurred, we should see crippled data on the CLI, which clearly doesn't happen. Maybe the added spaces that Corydon76 saw are related to some sort of incompatibility over the SSH terminal.

By: Leif Madsen (lmadsen) 2009-01-19 09:00:22.000-0600

I've dropped the priority on this issue to 'trivial' because it seems to have no effect on your ability to actually use the asterisk console. There are a few other issues I have in my mind that require more attention than this one, so until those issues are resolved, this will remain a low priority issue.

This isn't to discourage continued work on this, but rather to keep expectations realistic of when this may be resolved.

Thanks!

By: Tilghman Lesher (tilghman) 2009-01-19 16:01:41.000-0600

One thing that occurs to me is that this might fix it.  If it does not, then it would be helpful if you would use 'tee' to output your terminal output to a file at the same time as you're seeing this, then upload the resulting file.  It would help to see if this issue is just one of the SSH client or if it happens before then.

By: Miguel Molina (coolmig) 2009-01-19 16:34:54.000-0600

No, it did not fix it. By the way the patch disconnects me from the console when I put single enter's with no text, and the console seems unresponsive:

vm-asttest-14-mike*CLI>
Unable to write: Success

Disconnected from Asterisk server

I tried teeing to a file, and retrieving the content of the file with 'cat' on the console shows the same issue.

When I opened the file with 'vi' to check it, it shows some strange '^@' characters (look at the middle of the attached screenshot), and it looks like when that characters occur in the middle of a 'term' code, the colorization fails on the terminal. I have no idea where this characters come from. Hope this helps.



By: Tilghman Lesher (tilghman) 2009-01-20 09:28:18.000-0600

coolmig:  Please upload the CONTENT of that file, not a photo of it.

By: Miguel Molina (coolmig) 2009-01-20 10:03:47.000-0600

OK attached is the console file obtained with 'tee'.

By: James Golovich (jamesgolovich) 2009-01-20 10:43:35.000-0600

It's been a while since I've dug in the code but I'd guess that the mystery character being inserted is the CC_REFRESH character.

By: Tilghman Lesher (tilghman) 2009-01-21 10:54:58.000-0600

jamesgolovich: No, it was extra NULL characters being inserted into the stream.  For some reason, though, my terminal is not treating the inserted NULLs as injurious to the color codes, while the reporter's terminal is.  I had the right idea before, though the wrong fix.

coolmig:  New patch uploaded, tested on my system with tee, and it seems to eliminate the NULLs properly.  Please test this patch and report back.

By: Miguel Molina (coolmig) 2009-01-21 14:05:03.000-0600

My test results are positive, the console file looks clean with no NULL characters inserted and the color codes problem gone. Great job!

By: Digium Subversion (svnbot) 2009-01-21 15:02:14.000-0600

Repository: asterisk
Revision: 169722

U   branches/1.4/main/asterisk.c

------------------------------------------------------------------------
r169722 | tilghman | 2009-01-21 15:02:12 -0600 (Wed, 21 Jan 2009) | 8 lines

Extra NULLs in the output cause some terminal types to abort in the middle of
a color code, causing terminal weirdness.
(closes issue ASTERISK-13264)
Reported by: coolmig
Patches:
      20090121__bug14130.diff.txt uploaded by Corydon76 (license 14)
Tested by: Corydon76, coolmig

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

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

By: Digium Subversion (svnbot) 2009-01-21 15:03:20.000-0600

Repository: asterisk
Revision: 169723

_U  trunk/
U   trunk/main/asterisk.c

------------------------------------------------------------------------
r169723 | tilghman | 2009-01-21 15:03:20 -0600 (Wed, 21 Jan 2009) | 15 lines

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

........
 r169722 | tilghman | 2009-01-21 15:02:32 -0600 (Wed, 21 Jan 2009) | 8 lines
 
 Extra NULLs in the output cause some terminal types to abort in the middle of
 a color code, causing terminal weirdness.
 (closes issue ASTERISK-13264)
  Reported by: coolmig
  Patches:
        20090121__bug14130.diff.txt uploaded by Corydon76 (license 14)
  Tested by: Corydon76, coolmig
........

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

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

By: Digium Subversion (svnbot) 2009-01-21 15:04:04.000-0600

Repository: asterisk
Revision: 169724

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

------------------------------------------------------------------------
r169724 | tilghman | 2009-01-21 15:04:04 -0600 (Wed, 21 Jan 2009) | 22 lines

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

................
 r169723 | tilghman | 2009-01-21 15:03:40 -0600 (Wed, 21 Jan 2009) | 15 lines
 
 Merged revisions 169722 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r169722 | tilghman | 2009-01-21 15:02:32 -0600 (Wed, 21 Jan 2009) | 8 lines
   
   Extra NULLs in the output cause some terminal types to abort in the middle of
   a color code, causing terminal weirdness.
   (closes issue ASTERISK-13264)
    Reported by: coolmig
    Patches:
          20090121__bug14130.diff.txt uploaded by Corydon76 (license 14)
    Tested by: Corydon76, coolmig
 ........
................

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

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

By: Digium Subversion (svnbot) 2009-01-21 15:04:47.000-0600

Repository: asterisk
Revision: 169725

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

------------------------------------------------------------------------
r169725 | tilghman | 2009-01-21 15:04:47 -0600 (Wed, 21 Jan 2009) | 22 lines

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

................
 r169723 | tilghman | 2009-01-21 15:03:40 -0600 (Wed, 21 Jan 2009) | 15 lines
 
 Merged revisions 169722 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r169722 | tilghman | 2009-01-21 15:02:32 -0600 (Wed, 21 Jan 2009) | 8 lines
   
   Extra NULLs in the output cause some terminal types to abort in the middle of
   a color code, causing terminal weirdness.
   (closes issue ASTERISK-13264)
    Reported by: coolmig
    Patches:
          20090121__bug14130.diff.txt uploaded by Corydon76 (license 14)
    Tested by: Corydon76, coolmig
 ........
................

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

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