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

ansicolor 0.6.0 shows terminal escape sequences in console log

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • ansicolor-plugin
    • 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
    • ansicolor 0.6.2

      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.

          [JENKINS-55139] ansicolor 0.6.0 shows terminal escape sequences in console log

          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

          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

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

          Victor Verbitsky added a comment - I tried this snapshot and it's makes no difference...

          Devin Nusbaum added a comment -

          Thanks for trying it out vektory79! 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.

          Devin Nusbaum added a comment - Thanks for trying it out vektory79 ! 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 .

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

          Victor Verbitsky added a comment - If ansicolor 0.6.x is installed then I see the 1 variant of the issue.

          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?)

          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?)

          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.

           

          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.  

          > 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]

          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]

          Devin Nusbaum added a comment -

          vektory79 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.

          Devin Nusbaum added a comment - vektory79 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.

          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

          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 

          Devin Nusbaum added a comment - - edited

          jl68 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.

          Devin Nusbaum added a comment - - edited jl68 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.

          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).

          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).

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

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

          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

          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

          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.

          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.

          David Aldrich added a comment -

          I am seeing the same behaviour as rverduijn.

          David Aldrich added a comment - I am seeing the same behaviour as rverduijn .

          Anthony Pioli added a comment -

          I'm seeing the same behavior as rverduijn as well

          Anthony Pioli added a comment - I'm seeing the same behavior as rverduijn as well

          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.
          dnusbaum

          eg.

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

           

          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. dnusbaum eg. [1;37;45m***************************************************************************** STAGE INIT *****************************************************************************  

          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?

          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?

          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:

          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:

          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 
                       """ 
                     }
                   }
                   ...
                 }
               }
          

          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 """ } } ... } }

          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 dhoer workaround.

          With the 0.6.2 I get output similar to initialzero comment.

          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 dhoer workaround. With the 0.6.2 I get output similar to initialzero comment.

          Marc Benstein added a comment - - edited

          This issue is resolved as of 0.6.3

          Marc Benstein added a comment - - edited This issue is resolved as of 0.6.3

          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.

          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.

          Marc Benstein added a comment -

          I see this issue has been reopened. In the 0.7.2 release the escape sequences are showing. For example, 

          [1mPROCESSED

          Marc Benstein added a comment - I see this issue has been reopened. In the 0.7.2 release the escape sequences are showing. For example,  [1mPROCESSED

          Marc Benstein added a comment -

          This issue must be related to a dependency. In the latest update to 0.7.2 I noticed the "[1mPROCESSED" issue in log files with Jenkins 2.235.5. However, I rolled back ansicolor to the last known working version which was 0.6.3 and this issue is still present.

          Marc Benstein added a comment - This issue must be related to a dependency. In the latest update to 0.7.2 I noticed the "[1mPROCESSED" issue in log files with Jenkins 2.235.5. However, I rolled back ansicolor to the last known working version which was 0.6.3 and this issue is still present.

            dnusbaum Devin Nusbaum
            cloos Christian Loos
            Votes:
            13 Vote for this issue
            Watchers:
            28 Start watching this issue

              Created:
              Updated: