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

Build description longer than 30 chars has hex zero width space added

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • None
    • Jenkins 1.596.1, 2.124
    • Jenkins 2.276

      We use a Groovy script to write the package version into the build description of a job after it completes. Users then copy this from the Jenkins UI and paste it to perform a deploy. I have discovered occasional strange issues with this where what seems to be a valid version number is not found by our deploy system. Eventually I figured out that Jenkins is inserting a

      ​

      in the string if it exceeds 30 chars. This is invisible (obviously) in the UI but gets captured when the text is selected and copied/pasted (at least with Chrome on MacOS). This is a problem because this copy-paste workflow has been embedded here for several years, and a recent Jenkins upgrade has thrown this entropy into it

          [JENKINS-28022] Build description longer than 30 chars has hex zero width space added

          We've faced this issue on Jenkins 2.8.4 with the GitHub PR Builder plugin where we add the PR's URL to the description. People copy and paste it into their browser's window and, instead of going to the page, Chrome/Firefox won't consider it a URL and instead search for that value.

          Giovanni Tirloni added a comment - We've faced this issue on Jenkins 2.8.4 with the GitHub PR Builder plugin where we add the PR's URL to the description. People copy and paste it into their browser's window and, instead of going to the page, Chrome/Firefox won't consider it a URL and instead search for that value.

          Luke Street added a comment -

          We were able to work around this issue by adding the following to our custom theme JS:

          insertZeroWidthSpacesInElementText=function(){}

          Luke Street added a comment - We were able to work around this issue by adding the following to our custom theme JS: insertZeroWidthSpacesInElementText=function(){}

          Problem still exists in Jenkins 2, e.g. 2.124.

          We see it not at fixed widths, but at every space of the description string. _See below output, where the actual contents are shown with either xxd or od.

          In xxd you see extra bytes 'e2 80 8b' and in od you see 'b nul vt' (342 200 213).

          echo "(BR: ​5c12ee9f, ​SW: ​28d0325c, ​BLD: ​60.776) " |xxd
          00000000: 2842 523a 20e2 808b 3563 3132 6565 3966 (BR: ...5c12ee9f
          00000010: 2c20 e280 8b53 573a 20e2 808b 3238 6430 , ...SW: ...28d0
          00000020: 3332 3563 2c20 e280 8b42 4c44 3a20 e280 325c, ...BLD: ..
          00000030: 8b36 302e 3737 3629 200a .60.776) .
          
          echo "(BR: ​5c12ee9f, ​SW: ​28d0325c, ​BLD: ​60.776) " |od -ac 
          0000000   (   B   R   :  sp   b nul  vt   5   c   1   2   e   e   9   f
                    (   B   R   :     342 200 213   5   c   1   2   e   e   9   f
          0000020   ,  sp   b nul  vt   S   W   :  sp   b nul  vt   2   8   d   0
                    ,     342 200 213   S   W   :     342 200 213   2   8   d   0
          0000040   3   2   5   c   ,  sp   b nul  vt   B   L   D   :  sp   b nul
                    3   2   5   c   ,     342 200 213   B   L   D   :     342 200
          0000060  vt   6   0   .   7   7   6   )  sp  nl
                  213   6   0   .   7   7   6   )      \n
          0000072
          

          Thomas De Schampheleire added a comment - Problem still exists in Jenkins 2, e.g. 2.124. We see it not at fixed widths, but at every space of the description string. _See below output, where the actual contents are shown with either xxd or od. In xxd you see extra bytes 'e2 80 8b' and in od you see 'b nul vt' (342 200 213). echo "(BR: ​5c12ee9f, ​SW: ​28d0325c, ​BLD: ​60.776) " |xxd 00000000: 2842 523a 20e2 808b 3563 3132 6565 3966 (BR: ...5c12ee9f 00000010: 2c20 e280 8b53 573a 20e2 808b 3238 6430 , ...SW: ...28d0 00000020: 3332 3563 2c20 e280 8b42 4c44 3a20 e280 325c, ...BLD: .. 00000030: 8b36 302e 3737 3629 200a .60.776) . echo "(BR: ​5c12ee9f, ​SW: ​28d0325c, ​BLD: ​60.776) " |od -ac 0000000 ( B R : sp b nul vt 5 c 1 2 e e 9 f ( B R : 342 200 213 5 c 1 2 e e 9 f 0000020 , sp b nul vt S W : sp b nul vt 2 8 d 0 , 342 200 213 S W : 342 200 213 2 8 d 0 0000040 3 2 5 c , sp b nul vt B L D : sp b nul 3 2 5 c , 342 200 213 B L D : 342 200 0000060 vt 6 0 . 7 7 6 ) sp nl 213 6 0 . 7 7 6 ) \n 0000072

          Workaround suggested by encounter indeed works.

          The JavaScript function insertZeroWidthSpacesInElementText is defined and called from war/src/main/webapp/scripts/hudson-behavior.js and indicates that this is actually a feature.

          It was introduced by tfennelly in commit cb9036c4552 and refined in b31bb1cc1c5.

          tfennelly, could you give input on this issue, please?

          Thomas De Schampheleire added a comment - Workaround suggested by encounter indeed works. The JavaScript function insertZeroWidthSpacesInElementText is defined and called from war/src/main/webapp/scripts/hudson-behavior.js and indicates that this is actually a feature. It was introduced by tfennelly in commit cb9036c4552 and refined in b31bb1cc1c5. tfennelly , could you give input on this issue, please?

          Daniel Beck added a comment -

          I asked in https://github.com/jenkinsci/jenkins/pull/3377 that the author investigates whether a similar approach could be done for this. No response. Perhaps one of the watchers here feels up to the task?

          Daniel Beck added a comment - I asked in https://github.com/jenkinsci/jenkins/pull/3377 that the author investigates whether a similar approach could be done for this. No response. Perhaps one of the watchers here feels up to the task?

          Vladimir Looze added a comment - - edited

          We had just encountered same problem once we started using Build Name Setter Plugin.
          Can confirm that workaround provided by encounter does the job - makes build names copy-pasteable.
          As far as I can see this is only reproducible in Build History panel. Everywhere else names of builds were displayed without ​​ in HTML.

          Vladimir Looze added a comment - - edited We had just encountered same problem once we started using Build Name Setter Plugin . Can confirm that workaround provided by encounter does the job - makes build names copy-pasteable. As far as I can see this is only reproducible in Build History panel. Everywhere else names of builds were displayed without ​ ​ in HTML.

          Alexej Ismailov added a comment - - edited

          Hi, thank you for the suggested workarounds. Pardon my inexperience, do I need to have a custom theme to put encounter's JS line? It won't work with stock theme?
          Also waiting for the complete solution, it stole a lot of hours to find the invisible character. Btw, for description the character appears after 30 char and for name (the bold text) its after 20.

          Alexej Ismailov added a comment - - edited Hi, thank you for the suggested workarounds. Pardon my inexperience, do I need to have a custom theme to put encounter 's JS line? It won't work with stock theme? Also waiting for the complete solution, it stole a lot of hours to find the invisible character. Btw, for description the character appears after 30 char and for name (the bold text) its after 20.

          Mark Hudson added a comment -

          Still a problem in Jenkins 2.198 as of September 2020. Duped by JENKINS-40663 

          Mark Hudson added a comment - Still a problem in Jenkins 2.198 as of September 2020. Duped by  JENKINS-40663  

          Greg Dubicki added a comment -

          I just created a PR for just removing zero-width space adding altogether: https://github.com/jenkinsci/jenkins/pull/5021/files

          Greg Dubicki added a comment - I just created a PR for just removing zero-width space adding altogether: https://github.com/jenkinsci/jenkins/pull/5021/files

          Owen Mehegan added a comment -

          Hallelujah.

          Owen Mehegan added a comment - Hallelujah.

            Unassigned Unassigned
            owenmehegan Owen Mehegan
            Votes:
            19 Vote for this issue
            Watchers:
            25 Start watching this issue

              Created:
              Updated:
              Resolved: