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

Backslashes in Environment / Script-Variables are not quoted correctly for Groovy

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: scripttrigger-plugin
    • Labels:
      None
    • Environment:
      Windows

      Description

      Under windows, the variable "WORKSPACE" usually contains backward-shlashes (i.e. "C:\Jenkins\foo\bar"). Trying to assign a string variable like

      String baz = "$WORKSPACE
      sandbox";

      is not possible. After the variables are substitued Groovy complains about illegal character, since the statement looks like this:

      String baz = "C:\Jenkins\foo\bar
      sandbox";
      ^ illegal escape sequence

        Activity

        Hide
        pschaefer_de Peter Schaefer added a comment -

        Great. Escaping issues even here in the Wiki-text! It was meant to be

         
        String baz = "$WORKSPACE\\sandbox";
        

        and

         
        String baz = "C:\Jenkins\foo\bar\\sandbox";
                        ^ illegal escape sequence
        

        respectively.

        Show
        pschaefer_de Peter Schaefer added a comment - Great. Escaping issues even here in the Wiki-text! It was meant to be String baz = "$WORKSPACE\\sandbox"; and String baz = "C:\Jenkins\foo\bar\\sandbox"; ^ illegal escape sequence respectively.
        Hide
        scm_issue_link SCM/JIRA link daemon added a comment -

        Code changed in jenkins
        User: Gregory Boissinot
        Path:
        src/main/java/org/jenkinsci/plugins/scripttrigger/groovy/GroovyScriptTriggerExecutor.java
        http://jenkins-ci.org/commit/scripttrigger-plugin/60c3a2407be16529b4da0c7dc18d62e96a7960fe
        Log:
        Fix JENKINS-13542

        Show
        scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/org/jenkinsci/plugins/scripttrigger/groovy/GroovyScriptTriggerExecutor.java http://jenkins-ci.org/commit/scripttrigger-plugin/60c3a2407be16529b4da0c7dc18d62e96a7960fe Log: Fix JENKINS-13542

          People

          • Assignee:
            gbois Gregory Boissinot
            Reporter:
            pschaefer_de Peter Schaefer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: