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

Cannot escape dollar sign in Windows environment

    Details

    • Type: Bug
    • Status: Reopened (View Workflow)
    • Priority: Blocker
    • Resolution: Unresolved
    • Component/s: envinject-plugin
    • Labels:
      None
    • Environment:
      EnvInject 1.71
    • Similar Issues:

      Description

      Fix JENKINS-13566 introduced the following bug.

      I can no longer escape the dollar sign value on a Windows environment.

      e.g.
      foobar1=foo\$bar
      foobar2=foo$bar

      Respectively becomes:
      foo\$bar
      foo

      The value "foo$bar" cannot be achieved.

      My opinion is that the "escaping" behaviour should be the same regardless of operating system. I propose that the JENKINS-13566 changes should be reverted, and that Vincent Latombe should double escape their path.
      i.e.
      C:\DOCUME~1\\$NCESE~1\LOCALS~1\Temp

        Attachments

          Issue Links

            Activity

            nickg Nick Grealy created issue -
            nickg Nick Grealy made changes -
            Field Original Value New Value
            Description Fix JENKINS-13566 introduced the following bug.

            I can no longer escape the dollar sign value on a Windows environment.

            e.g.
            foobar1=foo\$bar
            foobar2=foo$bar

            Respectively becomes:
            foo\$bar
            foo

            The value "foo$bar" cannot be achieved.

            My opinion is that the "escaping" behaviour should be the same regardless of operating system. I propose that the JENKINS-13566 changes should be reverted, and that Vincent Latombe should double escape his path.
            i.e.
            C:\DOCUME~1*\*\$NCESE~1\LOCALS~1\Temp
            Fix JENKINS-13566 introduced the following bug.

            I can no longer escape the dollar sign value on a Windows environment.

            e.g.
            foobar1=foo\$bar
            foobar2=foo$bar

            Respectively becomes:
            foo\$bar
            foo

            The value "foo$bar" cannot be achieved.

            My opinion is that the "escaping" behaviour should be the same regardless of operating system. I propose that the JENKINS-13566 changes should be reverted, and that Vincent Latombe should double escape his path.
            i.e.
            C:\DOCUME~1\\$NCESE~1\LOCALS~1\Temp
            nickg Nick Grealy made changes -
            Link This issue is related to JENKINS-13566 [ JENKINS-13566 ]
            nickg Nick Grealy made changes -
            Link This issue is duplicated by JENKINS-13157 [ JENKINS-13157 ]
            nickg Nick Grealy made changes -
            Description Fix JENKINS-13566 introduced the following bug.

            I can no longer escape the dollar sign value on a Windows environment.

            e.g.
            foobar1=foo\$bar
            foobar2=foo$bar

            Respectively becomes:
            foo\$bar
            foo

            The value "foo$bar" cannot be achieved.

            My opinion is that the "escaping" behaviour should be the same regardless of operating system. I propose that the JENKINS-13566 changes should be reverted, and that Vincent Latombe should double escape his path.
            i.e.
            C:\DOCUME~1\\$NCESE~1\LOCALS~1\Temp
            Fix JENKINS-13566 introduced the following bug.

            I can no longer escape the dollar sign value on a Windows environment.

            e.g.
            foobar1=foo\$bar
            foobar2=foo$bar

            Respectively becomes:
            foo\$bar
            foo

            The value "foo$bar" cannot be achieved.

            My opinion is that the "escaping" behaviour should be the same regardless of operating system. I propose that the JENKINS-13566 changes should be reverted, and that Vincent Latombe should double escape their path.
            i.e.
            C:\DOCUME~1\\$NCESE~1\LOCALS~1\Temp
            gbois Gregory Boissinot made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            Hide
            gbois Gregory Boissinot added a comment -

            I added a comment in the previous issue.
            I asked Vincent what is his opinion?
            However, do you have a specific use case when you need to escape dollars?

            Show
            gbois Gregory Boissinot added a comment - I added a comment in the previous issue. I asked Vincent what is his opinion? However, do you have a specific use case when you need to escape dollars?
            Hide
            nickg Nick Grealy added a comment -

            Hi Gregory,

            Sorry for the late reply (I don't have access to a windows Jenkins instance at the moment), but I'll use a similar use case to Vincent's:

            — User Story —

            As a Jenkins user
            I want to use the environment variable name "win_sys_path" with a value "\\127.0.0.1\c$\WINDOWS"
            So that I can access a windows system folder from a remote computer.

            — User Scenarios —

            Global: Given a Jenkins Windows instance

            Given the environment variable "win_sys_path" with value "\\127.0.0.1\c$\WINDOWS"
            When I echo the variable "win_sys_path"
            Then the value should be "\\127.0.0.1\c"

            Given the environment variable "win_sys_path" with value "\\127.0.0.1\c\$\WINDOWS"
            When I echo the variable "win_sys_path"
            Then the value should be "\\127.0.0.1\c$\WINDOWS"

            Given the environment variable "win_sys_path" with value "\\127.0.0.1\c\\$\WINDOWS"
            When I echo the variable "win_sys_path"
            Then the value should be "\\127.0.0.1\c\$\WINDOWS"

            Hope that makes sense.

            Nick

            Show
            nickg Nick Grealy added a comment - Hi Gregory, Sorry for the late reply (I don't have access to a windows Jenkins instance at the moment), but I'll use a similar use case to Vincent's: — User Story — As a Jenkins user I want to use the environment variable name "win_sys_path" with a value "\\127.0.0.1\c$\WINDOWS" So that I can access a windows system folder from a remote computer. — User Scenarios — Global: Given a Jenkins Windows instance Given the environment variable "win_sys_path" with value "\\127.0.0.1\c$\WINDOWS" When I echo the variable "win_sys_path" Then the value should be "\\127.0.0.1\c" Given the environment variable "win_sys_path" with value "\\127.0.0.1\c\$\WINDOWS" When I echo the variable "win_sys_path" Then the value should be "\\127.0.0.1\c$\WINDOWS" Given the environment variable "win_sys_path" with value "\\127.0.0.1\c\\$\WINDOWS" When I echo the variable "win_sys_path" Then the value should be "\\127.0.0.1\c\$\WINDOWS" Hope that makes sense. Nick
            Hide
            nickg Nick Grealy added a comment -

            Update: ignore the "Global: Given a Jenkins Windows instance", this same functionality should apply on ALL operating systems (but in this case, specifically on Windows).

            Show
            nickg Nick Grealy added a comment - Update: ignore the "Global: Given a Jenkins Windows instance", this same functionality should apply on ALL operating systems (but in this case, specifically on Windows).
            nickg Nick Grealy made changes -
            Assignee Gregory Boissinot [ gbois ] Nick Grealy [ nickg ]
            Hide
            nickg Nick Grealy added a comment -

            Looking at the code, the correct way to escape a dollar sign character, is by using two dollar sign characters.

            Using the following versions:
            Jenkins: 1.581
            Environment Injector Plugin: 1.90

            My test:

            Properties Content:
            test1=C:\DOCUME~1\$NCESE~1\LOCALS~1\Temp
            test2=\\127.0.0.1\c$\WINDOWS
            test3=Pas$word
            test4=C:\DOCUME~1\$$NCESE~1\LOCALS~1\Temp
            test5=\\127.0.0.1\c$$\WINDOWS
            test6=Pas$$word

            Windows Command:
            @echo off
            echo %test1%
            echo %test2%
            echo %test3%
            echo %test4%
            echo %test5%
            echo %test6%

            Output:
            C:\DOCUME~1\$NCESE~1\LOCALS~1\Temp
            \\127.0.0.1\c$\WINDOWS
            Pas$word
            C:\DOCUME~1\$NCESE~1\LOCALS~1\Temp
            \\127.0.0.1\c$\WINDOWS
            Pas$word

            Looks correct... closing this issue.

            Show
            nickg Nick Grealy added a comment - Looking at the code , the correct way to escape a dollar sign character, is by using two dollar sign characters. Using the following versions: Jenkins: 1.581 Environment Injector Plugin: 1.90 My test: Properties Content: test1=C:\DOCUME~1\$NCESE~1\LOCALS~1\Temp test2=\\127.0.0.1\c$\WINDOWS test3=Pas$word test4=C:\DOCUME~1\$$NCESE~1\LOCALS~1\Temp test5=\\127.0.0.1\c$$\WINDOWS test6=Pas$$word Windows Command: @echo off echo %test1% echo %test2% echo %test3% echo %test4% echo %test5% echo %test6% Output: C:\DOCUME~1\$NCESE~1\LOCALS~1\Temp \\127.0.0.1\c$\WINDOWS Pas$word C:\DOCUME~1\$NCESE~1\LOCALS~1\Temp \\127.0.0.1\c$\WINDOWS Pas$word Looks correct... closing this issue.
            nickg Nick Grealy made changes -
            Status In Progress [ 3 ] Open [ 1 ]
            Hide
            nickg Nick Grealy added a comment -

            Correct way to escape '$' is by using '$$'.

            Show
            nickg Nick Grealy added a comment - Correct way to escape '$' is by using '$$'.
            nickg Nick Grealy made changes -
            Status Open [ 1 ] Closed [ 6 ]
            Resolution Not A Defect [ 7 ]
            Hide
            apgray Andrew Gray added a comment -

            See my comment on JENKINS-13157. It appears if it is a TRAILING $ then two $ characters doesn't work on Windows

            Show
            apgray Andrew Gray added a comment - See my comment on JENKINS-13157 . It appears if it is a TRAILING $ then two $ characters doesn't work on Windows
            apgray Andrew Gray made changes -
            Resolution Not A Defect [ 7 ]
            Status Closed [ 6 ] Reopened [ 4 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 146552 ] JNJira + In-Review [ 186093 ]

              People

              • Assignee:
                nickg Nick Grealy
                Reporter:
                nickg Nick Grealy
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: