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

Ant properties escaping breaks url parameter for jsunit build

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • ant-plugin
    • None
    • hudson v1.378, Windows 2003

      I think the changes for JENKINS-7108 cause problems when trying to pass a property to ant whose value is a url with multiple query parameters. For example, if you run the standalone_test target for a jsunit build, you need to pass a property like this:

      url=file:///C:/Documents and Settings/hudson/.hudson/jobs/myjob/workspace/myproject/test/jsunit/jsunit/testRunner.html?testPage=c:/Documents and Settings/hudson/.hudson/jobs/myjob/workspace/myproject/test/jsunit/tests/allTests.html&autoRun=true&submitResults=localhost:8090/jsunit/acceptor

      This worked in hudson 1.360 (the last one we were running before upgrading last week). After upgrading to 1.378, the parameter gets passed to the browser as:

      file:///C:/Documents and Settings/hudson/.hudson/jobs/myjob/workspace/myproject/test/jsunit/jsunit/testRunner.html?testPage=c:/Documents and Settings/hudson/.hudson/jobs/myjob/workspace/myproject/test/jsunit/tests/allTests.html^&autoRun=true^&submitResults=localhost:8090/jsunit/acceptor

      This causes the tests not to run.

          [JENKINS-7657] Ant properties escaping breaks url parameter for jsunit build

          Alan Harder added a comment -

          can you make an ant build.xml file that does echo ${testparam} and make a Hudson job using this file with a "testparam" parameter? try running it with values:
          test&one
          test&two&test
          3&3&3&3test

          what are the results?

          Alan Harder added a comment - can you make an ant build.xml file that does echo ${testparam} and make a Hudson job using this file with a "testparam" parameter? try running it with values: test&one test&two&test 3&3&3&3test what are the results?

          Alan Harder added a comment -

          Here are some tests I ran that show why I used the ^ ..

          > ant.bat "-Dtestparam=foo<bar"
          > ant.bat "-Dtestparam=foo&bar"
          

          These work ok, but Hudson runs ant like this:

          > cmd.exe /C ""ant.bat" "-Dtestparam=foo^<bar" && exit %%ERRORLEVEL%%"
          > cmd.exe /C ""ant.bat" "-Dtestparam=foo^&bar" && exit %%ERRORLEVEL%%"
          

          In my tests on windows xp the above two work OK, but do NOT work if the ^ are removed. However, behavior when run from Hudson does appear to differ.. doing some more testing.

          Alan Harder added a comment - Here are some tests I ran that show why I used the ^ .. > ant.bat "-Dtestparam=foo<bar" > ant.bat "-Dtestparam=foo&bar" These work ok, but Hudson runs ant like this: > cmd.exe /C ""ant.bat" "-Dtestparam=foo^<bar" && exit %%ERRORLEVEL%%" > cmd.exe /C ""ant.bat" "-Dtestparam=foo^&bar" && exit %%ERRORLEVEL%%" In my tests on windows xp the above two work OK, but do NOT work if the ^ are removed. However, behavior when run from Hudson does appear to differ.. doing some more testing.

          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/36903
          Log:
          [FIXED JENKINS-7657] While testing from command prompt requires escaping of ^&<>|
          with a ^ character, this is apparently not needed when cmd.exe /C is invoked from
          Hudson.. commented that part of toWindowsCommand() and updated javadoc/unit test.

          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/36903 Log: [FIXED JENKINS-7657] While testing from command prompt requires escaping of ^&<>| with a ^ character, this is apparently not needed when cmd.exe /C is invoked from Hudson.. commented that part of toWindowsCommand() and updated javadoc/unit test.

          dogfood added a comment -

          Integrated in hudson_main_trunk #396
          [FIXED JENKINS-7657] While testing from command prompt requires escaping of ^&<>|
          with a ^ character, this is apparently not needed when cmd.exe /C is invoked from
          Hudson.. commented that part of toWindowsCommand() and updated javadoc/unit test.

          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

          dogfood added a comment - Integrated in hudson_main_trunk #396 [FIXED JENKINS-7657] While testing from command prompt requires escaping of ^&<>| with a ^ character, this is apparently not needed when cmd.exe /C is invoked from Hudson.. commented that part of toWindowsCommand() and updated javadoc/unit test. 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

            mindless Alan Harder
            esword esword
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: