Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-55139

ansicolor 0.6.0 shows terminal escape sequences in console log

    Details

    • Type: Bug
    • Status: Reopened (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: ansicolor-plugin
    • Environment:
      Jenkins version: 2.150.1
      JDK: OpenJDK Runtime Environment 1.8.0_191-8u191-b12-0ubuntu0.16.04.1-b12
      OS: Ubuntu 16.04.5 LTS
      ansicolor 0.6.0
      timestamper 1.8.10
    • Similar Issues:
    • Released As:
      ansicolor 0.6.2

      Description

      Since I updated the ansicolor plugin to 0.6.0, I see escape sequences in the terminal log (the log is from an ansible-playbook run):

      consoleText in WebUI:
      ok: [essf0desc]

      log file:
      [[0;32mok: [essf0desc][[0m

      When i downgrade the ansicolor plugin to 0.5.3, I don't see the escape sequences in the log:

      consoleText in WebUI:
      ok: [essf0desc]

      log file:
      [[8mha:////4GByXBh6D5sO4uIaL/Xvo6rBHYkdqIOcMtgU7KVDnLnuAAAApR+LCAAAAAAAAP9b85aBtbiIQT2jNKU4P0+vIKc0PTOvWC8xrzgzOT8nv0gvODO3ICfVoyQ3xy+/JNU2Yj/Tagmf50wMjD4M7CWJ6SCJEgYhn6zEskT9nMS8dP3gkqLMvHTriiIGKaihyfl5xfk5qXrOEBpkDgMEMDIxMFQUlDDI2RQXJOYpFJdU5qTaKoEttlJQNjBwdjEwsFayAwAsE8VZpQAAAA==[[0mok: [essf0desc][[8mha:////4MLkG6V+s9c4kbbINbBZTN8IdUcULVaJJVRaElSmS5VEAAAAkR+LCAAAAAAAAP9b85aBtbiIQT2jNKU4P0+vIKc0PTOvWC8xrzgzOT8nv0gvODO3ICfVoyQ3xy+/JNU2Yj/Tagmf50wMjD4M7CWJ6SCJEgYhn6zEskT9nMS8dP3gkqLMvHTriiIGKaihyfl5xfk5qXrOEBpkDgMEMDIxMFQUlDCw2+gXFyTm2QEAI9P8iI4AAAA=[[0m

      The log output let me assume that the changes in 0.6.0 maybe interference with the timestamper plugin.

        Attachments

          Activity

          cloos Christian Loos created issue -
          dnusbaum Devin Nusbaum made changes -
          Field Original Value New Value
          Attachment ansicolor.hpi [ 45592 ]
          Hide
          dnusbaum Devin Nusbaum added a comment - - edited

          There is some additional discussion on https://github.com/jenkinsci/ansicolor-plugin/issues/145. I am not sure exactly what the issue is with ansible, but it looks like at least Terraform is using multiline input, which I think should be fixed by https://github.com/jenkinsci/ansicolor-plugin/pull/137 (merged but not released). If anyone seeing the issue can test out the attached SNAPSHOT build of the plugin based on the current master (ansicolor.hpi) and report on whether that fixes the issue, makes things better, makes things worse, or makes no difference, that would be very helpful.

          ansicolor.hpi

          Show
          dnusbaum Devin Nusbaum added a comment - - edited There is some additional discussion on https://github.com/jenkinsci/ansicolor-plugin/issues/145.  I am not sure exactly what the issue is with ansible, but it looks like at least Terraform is using multiline input, which I think should be fixed by https://github.com/jenkinsci/ansicolor-plugin/pull/137  (merged but not released). If anyone seeing the issue can test out the attached SNAPSHOT build of the plugin based on the current master ( ansicolor.hpi ) and report on whether that fixes the issue, makes things better, makes things worse, or makes no difference, that would be very helpful. ansicolor.hpi
          dnusbaum Devin Nusbaum made changes -
          Remote Link This issue links to "jenkinsci/ansicolor-plugin/#137 (Web Link)" [ 22157 ]
          dnusbaum Devin Nusbaum made changes -
          Remote Link This issue links to "jenkinsci/ansicolor-plugin#145 (Web Link)" [ 22158 ]
          Hide
          vektory79 Victor Verbitsky added a comment -

          I tried this snapshot and it's makes no difference...

          Show
          vektory79 Victor Verbitsky added a comment - I tried this snapshot and it's makes no difference...
          Hide
          dnusbaum Devin Nusbaum added a comment -

          Thanks for trying it out Victor Verbitsky! It would be great if anyone seeing the issue could report whether they are seeing variant 1 or 2 of the issue while ansicolor 0.6.x is installed as described in my comment on the GitHub issue.

          Show
          dnusbaum Devin Nusbaum added a comment - Thanks for trying it out Victor Verbitsky ! It would be great if anyone seeing the issue could report whether they are seeing variant 1 or 2 of the issue while ansicolor 0.6.x is installed as described in my comment on the GitHub issue .
          Hide
          vektory79 Victor Verbitsky added a comment -

          If ansicolor 0.6.x is installed then I see the 1 variant of the issue.

          Show
          vektory79 Victor Verbitsky added a comment - If ansicolor 0.6.x is installed then I see the 1 variant of the issue.
          Hide
          dnusbaum Devin Nusbaum added a comment -

          Are there any error messages in your logs? Do you see any kind of coloration in any jobs? What tools are producing colorized output in your logs (Ansible)? Can you copy-paste one of the lines that is showing up incorrectly here (preferably replacing literal occurrences of the character 0x1B with 0x1B here so we can see how control characters are being processed?)

          Show
          dnusbaum Devin Nusbaum added a comment - Are there any error messages in your logs? Do you see any kind of coloration in any jobs? What tools are producing colorized output in your logs (Ansible)? Can you copy-paste one of the lines that is showing up incorrectly here (preferably replacing literal occurrences of the character 0x1B with 0x1B here so we can see how control characters are being processed?)
          Hide
          vektory79 Victor Verbitsky added a comment - - edited

          > Are there any error messages in your logs?

          I haven't found any meaningful messages.

          > Do you see any kind of coloration in any jobs?

          No at all.

          > What tools are producing colorized output in your logs (Ansible)?

          Apache Maven 3.6.0 (with special flags to force the coloration).

          > Can you copy-paste one of the lines that is showing up incorrectly here

          [WARNING]
          [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
          [WARNING]
          [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
          [WARNING]
          [INFO] ------------------------------------------------------------------------
          [INFO] Reactor Build Order:
          [INFO]
          [INFO] ru.krista:root:pom [pom]
          [INFO] ru.krista:core:pom [pom]
          [INFO] ru.krista.core:common:pom [pom]
          [INFO] ru.krista.core.common:utils:jar [takari-jar]
          [INFO] ru.krista.core:ioc:pom [pom]

           > preferably replacing literal occurrences of the character 0x1B with 0x1B here so we can see how control characters are being processed?

          Sorry, but I don't know how to do this... I just see this log instead of color text. With 0.5.3 all colors is in place here.

           

          Show
          vektory79 Victor Verbitsky added a comment - - edited > Are there any error messages in your logs? I haven't found any meaningful messages. > Do you see any kind of coloration in any jobs? No at all. > What tools are producing colorized output in your logs (Ansible)? Apache Maven 3.6.0 (with special flags to force the coloration). > Can you copy-paste one of the lines that is showing up incorrectly here [WARNING [m] [WARNING [m] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING [m] [WARNING [m] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING [m] [INFO [m] ------------------------------------------------------------------------ [INFO [m] Reactor Build Order: [INFO [m] [INFO [m] ru.krista:root:pom [pom] [INFO [m] ru.krista:core:pom [pom] [INFO [m] ru.krista.core:common:pom [pom] [INFO [m] ru.krista.core.common:utils:jar [takari-jar] [INFO [m] ru.krista.core:ioc:pom [pom]  > preferably replacing literal occurrences of the character 0x1B with 0x1B here so we can see how control characters are being processed? Sorry, but I don't know how to do this... I just see this log instead of color text. With 0.5.3 all colors is in place here.  
          Hide
          vektory79 Victor Verbitsky added a comment -

          > preferably replacing literal occurrences of the character 0x1B with 0x1B here so we can see how control characters are being processed?

          Sorry twice! I found them!

          [0x1B[1;33mWARNING0x1B[m]
          [0x1B[1;33mWARNING0x1B[m] It is highly recommended to fix these problems because they threaten the stability of your build.
          [0x1B[1;33mWARNING0x1B[m]
          [0x1B[1;33mWARNING0x1B[m] For this reason, future Maven versions might no longer support building such malformed projects.
          [0x1B[1;33mWARNING0x1B[m]
          [0x1B[1;34mINFO0x1B[m] 0x1B[1m------------------------------------------------------------------------0x1B[m
          [0x1B[1;34mINFO0x1B[m] 0x1B[1mReactor Build Order:0x1B[m
          [0x1B[1;34mINFO0x1B[m]
          [0x1B[1;34mINFO0x1B[m] ru.krista:root:pom [pom]
          [0x1B[1;34mINFO0x1B[m] ru.krista:core:pom [pom]
          [0x1B[1;34mINFO0x1B[m] ru.krista.core:common:pom [pom]
          [0x1B[1;34mINFO0x1B[m] ru.krista.core.common:utils:jar [takari-jar]
          [0x1B[1;34mINFO0x1B[m] ru.krista.core:ioc:pom [pom]

          Show
          vektory79 Victor Verbitsky added a comment - > preferably replacing literal occurrences of the character 0x1B with 0x1B here so we can see how control characters are being processed? Sorry twice! I found them! [0x1B[1;33mWARNING0x1B [m] [0x1B[1;33mWARNING0x1B [m] It is highly recommended to fix these problems because they threaten the stability of your build. [0x1B[1;33mWARNING0x1B [m] [0x1B[1;33mWARNING0x1B [m] For this reason, future Maven versions might no longer support building such malformed projects. [0x1B[1;33mWARNING0x1B [m] [0x1B[1;34mINFO0x1B [m] 0x1B[1m------------------------------------------------------------------------0x1B[m [0x1B[1;34mINFO0x1B [m] 0x1B[1mReactor Build Order:0x1B[m [0x1B[1;34mINFO0x1B [m] [0x1B[1;34mINFO0x1B [m] ru.krista:root:pom [pom] [0x1B[1;34mINFO0x1B [m] ru.krista:core:pom [pom] [0x1B[1;34mINFO0x1B [m] ru.krista.core:common:pom [pom] [0x1B[1;34mINFO0x1B [m] ru.krista.core.common:utils:jar [takari-jar] [0x1B[1;34mINFO0x1B [m] ru.krista.core:ioc:pom [pom]
          Hide
          dnusbaum Devin Nusbaum added a comment -

          Victor Verbitsky Maven coloring is explicitly validated in this test case. Are you sure that you are seeing that output for a build while you are still running Ansicolor 0.6.0? If you have Ansicolor 0.5.3 installed, then the logs are expected to look like that for builds that originally ran while Ansicolor 0.6.0 was installed. I am not able to reproduce your issue on Ansicolor 0.6.0. If you are able to create a similar test case to the Maven one I linked that demonstrates the issue you are seeing, that would be very helpful.

          Show
          dnusbaum Devin Nusbaum added a comment - Victor Verbitsky Maven coloring is explicitly validated in this test case . Are you sure that you are seeing that output for a build while you are still running Ansicolor 0.6.0? If you have Ansicolor 0.5.3 installed, then the logs are expected to look like that for builds that originally ran while Ansicolor 0.6.0 was installed. I am not able to reproduce your issue on Ansicolor 0.6.0. If you are able to create a similar test case to the Maven one I linked that demonstrates the issue you are seeing, that would be very helpful.
          Hide
          jl68 Jonas Lindström added a comment - - edited

          Fairly minimal test case:

          • docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:2.150.2
          • Go to http://localhost:8080
          • Don't install any plugins
          • Go to Plugin Manager, install AnsiColor 0.5.3 from https://updates.jenkins.io/download/plugins/ansicolor/
          • Create a free-style job with "Color ANSI Console Output", and a build step "Execute shell" containing: echo "\e[1m\e[34mbold blue text\e[0m\e[0m"
          • Build the job. Output bold blue text
          • Go to Plugin Manager, upgrade AnsiColor to 0.6.1 and restart Jenkins
          • Build the job. Output: bold blue text
          Show
          jl68 Jonas Lindström added a comment - - edited Fairly minimal test case: docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:2.150.2 Go to http://localhost:8080 Don't install any plugins Go to Plugin Manager, install AnsiColor 0.5.3 from https://updates.jenkins.io/download/plugins/ansicolor/ Create a free-style job with "Color ANSI Console Output", and a build step "Execute shell" containing: echo "\e[1m\e[34mbold blue text\e[0m\e[0m" Build the job. Output bold blue text Go to Plugin Manager, upgrade AnsiColor to 0.6.1 and restart Jenkins Build the job. Output:  bold blue text 
          Hide
          dnusbaum Devin Nusbaum added a comment - - edited

          Jonas Lindström Thanks for the reproduction case. I think it would be handled by PR 147, which is ready to be merged and released, although I'm not sure when I'll have time to release the plugin.

          Show
          dnusbaum Devin Nusbaum added a comment - - edited Jonas Lindström Thanks for the reproduction case. I think it would be handled by PR 147 , which is ready to be merged and released, although I'm not sure when I'll have time to release the plugin.
          dnusbaum Devin Nusbaum made changes -
          Remote Link This issue links to "jenkinsci/ansicolor-plugin#147 (Web Link)" [ 22324 ]
          dnusbaum Devin Nusbaum made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          dnusbaum Devin Nusbaum made changes -
          Status In Progress [ 3 ] In Review [ 10005 ]
          dnusbaum Devin Nusbaum made changes -
          Assignee Devin Nusbaum [ dnusbaum ]
          Hide
          dnusbaum Devin Nusbaum added a comment -

          I just released 0.6.2 with a change that should fix this issue for the cases I am aware of. If you are still seeing it after the upgrade, please copy-and-paste some of the broken output from Jenkins here (preferably replacing literal occurrences of the ASCII character 0x1b with the text 0x1b so we can see what is happening to the escape sequences).

          Show
          dnusbaum Devin Nusbaum added a comment - I just released 0.6.2 with a change that should fix this issue for the cases I am aware of. If you are still seeing it after the upgrade, please copy-and-paste some of the broken output from Jenkins here (preferably replacing literal occurrences of the ASCII character 0x1b with the text 0x1b so we can see what is happening to the escape sequences).
          dnusbaum Devin Nusbaum made changes -
          Status In Review [ 10005 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Released As ansicolor 0.6.2
          Hide
          jl68 Jonas Lindström added a comment -

          As far I can see, it looks good now. Thanks for the fix!

          Show
          jl68 Jonas Lindström added a comment - As far I can see, it looks good now. Thanks for the fix!
          Hide
          cloos Christian Loos added a comment -

          Sorry for the delay. I had today time to test it again. And I still can see the control charcters.

          After updating to 0.6.2, control character in /console and /consoleText:
          [[0;32mok: [lxsrvmgi1360][[0m

          After downgrading to 0.5.3, no control character in /console and /consoleText:
          [[8mha:////4GByXBh6D5sO4uIaL/Xvo6rBHYkdqIOcMtgU7KVDnLnuAAAApR+LCAAAAAAAAP9b85aBtbiIQT2jNKU4P0+vIKc0PTOvWC8xrzgzOT8nv0gvODO3ICfVoyQ3xy+/JNU2Yj/Tagmf50wMjD4M7CWJ6SCJEgYhn6zEskT9nMS8dP3gkqLMvHTriiIGKaihyfl5xfk5qXrOEBpkDgMEMDIxMFQUlDDI2RQXJOYpFJdU5qTaKoEttlJQNjBwdjEwsFayAwAsE8VZpQAAAA==[[0mok: [lxsrvmgi1360][[8mha:////4MLkG6V+s9c4kbbINbBZTN8IdUcULVaJJVRaElSmS5VEAAAAkR+LCAAAAAAAAP9b85aBtbiIQT2jNKU4P0+vIKc0PTOvWC8xrzgzOT8nv0gvODO3ICfVoyQ3xy+/JNU2Yj/Tagmf50wMjD4M7CWJ6SCJEgYhn6zEskT9nMS8dP3gkqLMvHTriiIGKaihyfl5xfk5qXrOEBpkDgMEMDIxMFQUlDCw2+gXFyTm2QEAI9P8iI4AAAA=[[0m

          Show
          cloos Christian Loos added a comment - Sorry for the delay. I had today time to test it again. And I still can see the control charcters. After updating to 0.6.2, control character in /console and /consoleText: [[0;32mok: [lxsrvmgi1360] [[0m After downgrading to 0.5.3, no control character in /console and /consoleText: [[8mha:////4GByXBh6D5sO4uIaL/Xvo6rBHYkdqIOcMtgU7KVDnLnuAAAApR+LCAAAAAAAAP9b85aBtbiIQT2jNKU4P0+vIKc0PTOvWC8xrzgzOT8nv0gvODO3ICfVoyQ3xy+/JNU2Yj/Tagmf50wMjD4M7CWJ6SCJEgYhn6zEskT9nMS8dP3gkqLMvHTriiIGKaihyfl5xfk5qXrOEBpkDgMEMDIxMFQUlDDI2RQXJOYpFJdU5qTaKoEttlJQNjBwdjEwsFayAwAsE8VZpQAAAA== [[0mok: [lxsrvmgi1360] [[8mha:////4MLkG6V+s9c4kbbINbBZTN8IdUcULVaJJVRaElSmS5VEAAAAkR+LCAAAAAAAAP9b85aBtbiIQT2jNKU4P0+vIKc0PTOvWC8xrzgzOT8nv0gvODO3ICfVoyQ3xy+/JNU2Yj/Tagmf50wMjD4M7CWJ6SCJEgYhn6zEskT9nMS8dP3gkqLMvHTriiIGKaihyfl5xfk5qXrOEBpkDgMEMDIxMFQUlDCw2+gXFyTm2QEAI9P8iI4AAAA= [[0m
          cloos Christian Loos made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          rverduijn Robin Verduijn added a comment -

          Note that for me, I am also still seeing the control characters in the console output but only while watching an active build. Inspecting the console output after a build has completed does render them correctly.

          Show
          rverduijn Robin Verduijn added a comment - Note that for me, I am also still seeing the control characters in the console output but only while watching an active build. Inspecting the console output after a build has completed does render them correctly.
          Hide
          davida2009 David Aldrich added a comment -

          I am seeing the same behaviour as Robin Verduijn.

          Show
          davida2009 David Aldrich added a comment - I am seeing the same behaviour as Robin Verduijn .
          Hide
          apioli Anthony Pioli added a comment -

          I'm seeing the same behavior as Robin Verduijn as well

          Show
          apioli Anthony Pioli added a comment - I'm seeing the same behavior as Robin Verduijn as well
          Hide
          vmeghani88 Vishal Meghani added a comment - - edited

          I am also seeing the same issue with 0.6.2 version of plugin and CloudBees Jenkins Enterprise 2.164.3.2-rolling.

          After refreshing the page colors appear. Issue only happens when you have opened console output before the {{ansiColor }}option is executed.

          However, downgrading to 0.5.3, resolves the issue.
          Devin Nusbaum

          eg.

          [1;37;45m***************************************************************************** STAGE INIT *****************************************************************************

           

          Show
          vmeghani88 Vishal Meghani added a comment - - edited I am also seeing the same issue with 0.6.2 version of plugin and CloudBees Jenkins Enterprise 2.164.3.2-rolling. After refreshing the page colors appear. Issue only happens when you have opened console output before the {{ansiColor }}option is executed. However, downgrading to 0.5.3, resolves the issue. Devin Nusbaum eg. [1;37;45m***************************************************************************** STAGE INIT *****************************************************************************  
          Hide
          prifiz Valentin Baranov added a comment -

          Tried to downgrade to 0.5.3 - it didn't help.

          It is reproduced only on Maven Projects. Only checking "Color ANSI output" workarounds this but it's color schemes don't suite for us and there're lots of jobs to reconfigure.

          Can anybody please help with this issue?

          Show
          prifiz Valentin Baranov added a comment - Tried to downgrade to 0.5.3 - it didn't help. It is reproduced only on Maven Projects. Only checking "Color ANSI output" workarounds this but it's color schemes don't suite for us and there're lots of jobs to reconfigure. Can anybody please help with this issue?
          initialzero Marc Benstein made changes -
          Attachment image-2019-08-21-16-31-39-960.png [ 48393 ]
          Hide
          initialzero Marc Benstein added a comment -

          This seems similar to my issue with v0.6.2. This was working in v0.5.x I have a freestyle project where I have enabled ansi color with xterm. A single shell command with:

          echo "testing-1.2.300" | grep -E --color=always '[0-9]+.[0-9]+.[0-9]+'

          Results in:

          Show
          initialzero Marc Benstein added a comment - This seems similar to my issue with v0.6.2. This was working in v0.5.x I have a freestyle project where I have enabled ansi color with xterm. A single shell command with: echo "testing-1.2.300" | grep -E --color=always '[0-9]+.[0-9]+.[0-9]+' Results in:
          Hide
          dhoer Dennis Hoer added a comment - - edited

          I had the same issue with Jenkinsfile and ansible. The problem was I was using single quotes for multiline shell command, e.g.,

              sh '''
                . .venv/bin/activate
                molecule test
              '''
          
          

          Switching to double quotes fixed the issue, e.g.,

               pipeline {
                 ...
                 options { 
                   ansiColor('xterm') 
                   ... 
                 }
                 stages {
                   ...
                   stage('Test') {
                     steps { 
                       sh """
                          . .venv/bin/activate 
                          molecule test 
                       """ 
                     }
                   }
                   ...
                 }
               }
          
          Show
          dhoer Dennis Hoer added a comment - - edited I had the same issue with Jenkinsfile and ansible. The problem was I was using single quotes for multiline shell command, e.g., sh ''' . .venv/bin/activate molecule test ''' Switching to double quotes fixed the issue, e.g., pipeline { ... options { ansiColor( 'xterm' ) ... } stages { ... stage( 'Test' ) { steps { sh """ . .venv/bin/activate molecule test """ } } ... } }
          Hide
          kugel Thomas M added a comment -

          I can confirm this bug and also that downgrading to 0.5.3 (from http://updates.jenkins-ci.org/download/plugins/ansicolor/) helps.
           
          My sh commands use double quotes (but only single-line, as in sh "bash path/to/script ${arg1} ${arg2}") already so I cannot confirm Dennis Hoer workaround.

          With the 0.6.2 I get output similar to Marc Benstein comment.

          Show
          kugel Thomas M added a comment - I can confirm this bug and also that downgrading to 0.5.3 (from http://updates.jenkins-ci.org/download/plugins/ansicolor/) helps.   My sh commands use double quotes (but only single-line, as in sh "bash path/to/script ${arg1} ${arg2}" ) already so I cannot confirm Dennis Hoer workaround. With the 0.6.2 I get output similar to Marc Benstein comment.
          Hide
          initialzero Marc Benstein added a comment - - edited

          This issue is resolved as of 0.6.3

          Show
          initialzero Marc Benstein added a comment - - edited This issue is resolved as of 0.6.3
          Hide
          tomcruise81 Sean Dukehart added a comment -

          I concur that it is resolved as of 0.6.3. I do still see the terminal escape sequences in the console text output.

          Show
          tomcruise81 Sean Dukehart added a comment - I concur that it is resolved as of 0.6.3. I do still see the terminal escape sequences in the console text output.

            People

            • Assignee:
              dnusbaum Devin Nusbaum
              Reporter:
              cloos Christian Loos
            • Votes:
              12 Vote for this issue
              Watchers:
              28 Start watching this issue

              Dates

              • Created:
                Updated: