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

Empty parameterized build properties not quoted when passed to ant

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • ant-plugin, core
    • Jenkins 1.654 ; Jenkins 2.0 ; Jenkins 2.1
      Ant Plugin 1.2
      Windows 7 x86_64 (master and slave)
      Apache Ant 1.9.6

      I have a parameterized build job that defines multiple string parameters. The main build step in that job is "Invoke Ant".

      Even though I do not define any "Properties" under "Invoke Ant", all of my job parameters are being passed to ant using "-D<Name>=<Value>". That is fine, except when one of my string parameters is blank. In that case Jenkins passes ant "-D<Name>=", which causes ant to barf.

      If a job parameter is blank then either it should not be passed to ant, or (probably better) a quoted empty string ("") should be passed to ant.

      Attached are a trivial ant build.xml and Jenkins config.xml that demonstrate the problem.

      Here is a sample Console Output:

      Building remotely on iqautobuild14 in workspace F:\Jenkins\workspace\AntJobWithProperty
      [AntJobWithProperty] $ cmd.exe /C "F:\Jenkins\tools\hudson.tasks.Ant_AntInstallation\Ant_from_Apache_\bin\ant.bat -DMY_VAR= && exit %%ERRORLEVEL%%"
      Missing value for property MY_VAR
      Build step 'Invoke Ant' marked build as failure
      Finished: FAILURE

      Note that this issue appears to be the same as JENKINS-5157 and JENKINS-7204 (among others), but those issues are supposedly fixed already. Either there is a subtle difference here that I do not understand, or Jenkins has suffered a regression.

        1. build.xml
          0.1 kB
        2. config.xml
          1 kB

          [JENKINS-33712] Empty parameterized build properties not quoted when passed to ant

          K P added a comment -

          Jenkins has indeed has suffered a regression. (I don't know when it started; I'm using 1.656 but skipped some intermediate updates)

          Previous jenkins versions passed empty parameters to ant quoted as:
          -Dparam=""

          Version 1.656 passes them as:
          -Dparam=

          Now this fails ant horribly, because subsequent command line argument get parsed by ant as ant target ; which of course makes no sense, and fails the whole thing.

          K P added a comment - Jenkins has indeed has suffered a regression. (I don't know when it started; I'm using 1.656 but skipped some intermediate updates) Previous jenkins versions passed empty parameters to ant quoted as: -Dparam="" Version 1.656 passes them as: -Dparam= Now this fails ant horribly, because subsequent command line argument get parsed by ant as ant target ; which of course makes no sense, and fails the whole thing.

          The fix is under testing and I hope will release as ant plugin version

          Emilio Escobar added a comment - The fix is under testing and I hope will release as ant plugin version

          K P added a comment -

          Any news on this? It's been broken for > 1 month by now ; and it seems the cause has been found quite early on and a fix has been implemented and is proposed ?
          ... But seems no-one is bothering reviewing or accepting the pending fix for weeks now?

          So this blocker seems to be hanging around needlessly with a quick solution at hand?

          This blocker IS simply blocking us to make the transition to Jenkins 2.x , so it's not just an issue in some plugin, but hindering the strategic evolution of jenkins...

          K P added a comment - Any news on this? It's been broken for > 1 month by now ; and it seems the cause has been found quite early on and a fix has been implemented and is proposed ? ... But seems no-one is bothering reviewing or accepting the pending fix for weeks now? So this blocker seems to be hanging around needlessly with a quick solution at hand? This blocker IS simply blocking us to make the transition to Jenkins 2.x , so it's not just an issue in some plugin, but hindering the strategic evolution of jenkins...

          Ken Rachynski added a comment -

          I just encountered this bug this week after upgrading my LTS installation to 1.651.1. Rolling back to LTS 1.642.4 fixed the issue for me, but LTS is supposed to be stable, eh?

          Ken Rachynski added a comment - I just encountered this bug this week after upgrading my LTS installation to 1.651.1. Rolling back to LTS 1.642.4 fixed the issue for me, but LTS is supposed to be stable, eh?

          Code changed in jenkins
          User: Emilio Escobar
          Path:
          .gitignore
          src/main/java/hudson/tasks/Ant.java
          src/test/java/hudson/tasks/AntTest.java
          http://jenkins-ci.org/commit/ant-plugin/b6956b51c8c429b4690a7a1565386da64c15801c
          Log:
          JENKINS-33712 Fixed regression issue with empty parameters.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Emilio Escobar Path: .gitignore src/main/java/hudson/tasks/Ant.java src/test/java/hudson/tasks/AntTest.java http://jenkins-ci.org/commit/ant-plugin/b6956b51c8c429b4690a7a1565386da64c15801c Log: JENKINS-33712 Fixed regression issue with empty parameters.

          Finally the code has been merged.

          Emilio Escobar added a comment - Finally the code has been merged.

          Hi, the 1.3 version has been released. kcurrier, can you try it, please?

          Emilio Escobar added a comment - Hi, the 1.3 version has been released. kcurrier , can you try it, please?

          Ken Rachynski added a comment -

          I can report that I upgraded my LTS system and ant builds are running properly with 1.3.

          Ken Rachynski added a comment - I can report that I upgraded my LTS system and ant builds are running properly with 1.3.

          Keith Currier added a comment -

          Looks good. I tried Ant Plugin 1.3 with Jenkins 2.1, 2.2, and 2.3. In all cases, the behavior was as expected.

          Thanks for the help!

          Keith Currier added a comment - Looks good. I tried Ant Plugin 1.3 with Jenkins 2.1, 2.2, and 2.3. In all cases, the behavior was as expected. Thanks for the help!

          Thanks to all!

          Emilio Escobar added a comment - Thanks to all!

            escoem Emilio Escobar
            kcurrier Keith Currier
            Votes:
            8 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated:
              Resolved: