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

Comma in Ant property Field not working

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: ant-plugin
    • Labels:
      None
    • Environment:
      Platform: PC, OS: Windows XP
    • Similar Issues:

      Description

      Entering

      foo=bar,baz

      in the Systremproperties field (in German Systemeigenschaften) of an Ant
      build-step of a freestyle project.

      Results in the consoleoutput of the build to:
      ...
      BUILD FAILED
      Target "baz" does not exist in the project "projectname".
      ...

      The Help text says one can use standardformat of properties files and commas are
      allowed there. (Using commas in a properties used by Ant)

      A workaround is to use:
      foo="bar,baz"

        Attachments

          Issue Links

            Activity

            Hide
            kohsuke Kohsuke Kawaguchi added a comment -

            I couldn't reproduce the problem. Any chance you can write a test case for us?

            Show
            kohsuke Kohsuke Kawaguchi added a comment - I couldn't reproduce the problem. Any chance you can write a test case for us?
            Hide
            michaelkebe michaelkebe added a comment -

            I can reproduce it on Windows. On Unix (Solaris) it works fine.

            The problem is the intepretation of "," of Windows' cmd.exe:

            > D:\workspace\project>ant -Dfoo=bar,baz
            > Buildfile: build.xml
            >
            > BUILD FAILED
            > Target "baz" does not exist in the project
            >
            > Total time: 5 seconds

            > D:\workspace\project>ant "-Dfoo=bar,baz"
            WORKS

            > D:\workspace\project>ant -Dfoo="bar,baz"
            WORKS

            But fixing this by just surrounding the "-D" arguments with " is not a real fix,
            because if the property contains " you have to escape them. But only on
            Windows... Quite complicated...

            Ant.java:
            ...
            for (Entry<Object,Object> entry : p.entrySet()) {
            args.add("-D" + entry.getKey() + "='" + entry.getValue());
            }
            ...

            Show
            michaelkebe michaelkebe added a comment - I can reproduce it on Windows. On Unix (Solaris) it works fine. The problem is the intepretation of "," of Windows' cmd.exe: > D:\workspace\project>ant -Dfoo=bar,baz > Buildfile: build.xml > > BUILD FAILED > Target "baz" does not exist in the project > > Total time: 5 seconds > D:\workspace\project>ant "-Dfoo=bar,baz" WORKS > D:\workspace\project>ant -Dfoo="bar,baz" WORKS But fixing this by just surrounding the "-D" arguments with " is not a real fix, because if the property contains " you have to escape them. But only on Windows... Quite complicated... Ant.java: ... for (Entry<Object,Object> entry : p.entrySet()) { args.add("-D" + entry.getKey() + "='" + entry.getValue()); } ...
            Hide
            kirill_evstigneev Kirill Evstigneev added a comment -

            Hudson 1.370 has changed Ant args quoting. So the above workaround doesn't work anymore.
            For
            foo="bar,baz"
            Ant command line is
            cmd.exe /C '"ant.bat "-Dfoo=""bar,baz""" && exit %%ERRORLEVEL%%"'
            and foo gets
            "bar,baz"
            value (including quotes).
            For
            foo=bar,baz
            Ant command line is
            cmd.exe /C '"ant.bat -Dfoo=bar,baz && exit %%ERRORLEVEL%%"'
            and the command fails.

            But for
            foo=bar, baz
            (with space) Ant command line is
            cmd.exe /C '"ant.bat "-Dfoo=bar, baz" && exit %%ERRORLEVEL%%"'
            and foo gets
            bar, baz
            value. Not a workaround too.

            Show
            kirill_evstigneev Kirill Evstigneev added a comment - Hudson 1.370 has changed Ant args quoting. So the above workaround doesn't work anymore. For foo="bar,baz" Ant command line is cmd.exe /C '"ant.bat "-Dfoo=""bar,baz""" && exit %%ERRORLEVEL%%"' and foo gets "bar,baz" value (including quotes). For foo=bar,baz Ant command line is cmd.exe /C '"ant.bat -Dfoo=bar,baz && exit %%ERRORLEVEL%%"' and the command fails. But for foo=bar, baz (with space) Ant command line is cmd.exe /C '"ant.bat "-Dfoo=bar, baz" && exit %%ERRORLEVEL%%"' and foo gets bar, baz value. Not a workaround too.
            Hide
            mindless Alan Harder added a comment -

            what will windows come up with next.. when I did the escaping changes it didn't even occur to me that comma might be a character needing escaping.

            Show
            mindless Alan Harder added a comment - what will windows come up with next.. when I did the escaping changes it didn't even occur to me that comma might be a character needing escaping.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in hudson
            User: : mindless
            Path:
            trunk/hudson/main/core/src/main/java/hudson/util/ArgumentListBuilder.java
            trunk/hudson/main/core/src/test/java/hudson/util/ArgumentListBuilderTest.java
            trunk/www/changelog.html
            http://jenkins-ci.org/commit/34229
            Log:
            [FIXED JENKINS-2149] add comma to list of characters that need escaping on windows

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : mindless Path: trunk/hudson/main/core/src/main/java/hudson/util/ArgumentListBuilder.java trunk/hudson/main/core/src/test/java/hudson/util/ArgumentListBuilderTest.java trunk/www/changelog.html http://jenkins-ci.org/commit/34229 Log: [FIXED JENKINS-2149] add comma to list of characters that need escaping on windows
            Hide
            dogfood dogfood added a comment -

            Integrated in hudson_main_trunk #235
            [FIXED JENKINS-2149] add comma to list of characters that need escaping on windows

            mindless :
            Files :

            • /trunk/hudson/main/core/src/test/java/hudson/util/ArgumentListBuilderTest.java
            • /trunk/www/changelog.html
            • /trunk/hudson/main/core/src/main/java/hudson/util/ArgumentListBuilder.java
            Show
            dogfood dogfood added a comment - Integrated in hudson_main_trunk #235 [FIXED JENKINS-2149] add comma to list of characters that need escaping on windows mindless : Files : /trunk/hudson/main/core/src/test/java/hudson/util/ArgumentListBuilderTest.java /trunk/www/changelog.html /trunk/hudson/main/core/src/main/java/hudson/util/ArgumentListBuilder.java
            Hide
            ssplett ssplett added a comment -

            Whew!
            After updating to Hudson 1.375 I got problems with my Ant targets like:
            – prepareSTX, prepareFKC
            because Ant told me that there was no target "prepareSTX,"

            I'd to change my configuration to:
            – preapreSTX prepareFKC

            (Just in the case someone'r getting the same problem)

            Show
            ssplett ssplett added a comment - Whew! After updating to Hudson 1.375 I got problems with my Ant targets like: – prepareSTX, prepareFKC because Ant told me that there was no target "prepareSTX," I'd to change my configuration to: – preapreSTX prepareFKC (Just in the case someone'r getting the same problem)

              People

              Assignee:
              mindless Alan Harder
              Reporter:
              michaelkebe michaelkebe
              Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: