jenkinsci / jenkinsci/gerrit-trigger-plugin
[JENKINS-11779] Gerrit-plugin modifies ant command line which is not compatible on windows
- Dominant language
- Java
- Stars
- 226
- Forks
- 289
- PR merge metrics
- No merged PRs in 30d
Description
Gerrit modified my ant task by adding GIT specific environment variables in a way that causes the ant task to go belly up.
Here is a snippet from the log from a build where I have turned the escaping off. Note that the escaping option doesn't really fix the problem. Both variants (escaping on and off) fail.
```
16:18:18 c:\temp\hudsonwork\gerrit>exit 0
16:18:18 [TestProject] $ cmd.exe /C '"c:\java\apache-ant-1.8.2\bin\ant.bat -file build.xml "-DGERRIT_PATCHSET_UPLOADER=""Some Dude"" " -DGERRIT_CHANGE_URL=http://edo-git:8082/7 -DGERRIT_CHANGE_ID=I497fbd0d12d27ce4fa540a7cda578c1a41ced7ad -DGERRIT_CHANGE_NUMBER=7 "-DGERRIT_PATCHSET_UPLOADER_NAME=Some Dude" "-DGERRIT_CHANGE_SUBJECT=dont rely on the existence of local.properties" -DGERRIT_PATCHSET_UPLOADER_EMAIL=somedude@hotmail.com -DGERRIT_BRANCH=master -DGERRIT_REFSPEC=refs/changes/07/7/1 -DGERRIT_PATCHSET_NUMBER=1 "-DGERRIT_CHANGE_OWNER_NAME=Some Dude" -DGERRIT_PATCHSET_REVISION=497fbd0d12d27ce4fa540a7cda578c1a41ced7ad -DGERRIT_PROJECT=com.test.project "-DGERRIT_CHANGE_OWNER=""Some Dude"" " -DGERRIT_CHANGE_OWNER_EMAIL=somedude@hotmail.com -Dsdk.dir=c:/java/android-sdk-windows debug && exit %%ERRORLEVEL%%"'
16:18:18 Buildfile: c:\temp\hudsonwork\gerrit\TestProject\build.xml
16:18:19
16:18:19 BUILD FAILED
16:18:19 Target "Dude" does not exist in the project "TestProject".
```
When I build the project without the gerrit-trigger plugin I get the following (correct) format.
```
16:45:09 [TestProject] $ cmd.exe /C '"c:\java\apache-ant-1.8.2\bin\ant.bat -file build.xml -Dsdk.dir=c:/java/android-sdk-windows debug && exit %%ERRORLEVEL%%"'
16:45:09 Buildfile: c:\temp\hudsonwork\gerrit\TestProject\build.xml
```
Why are those attributes added in the first place? It would probably be easiest to just add a configuration switch to disable modification of the command line.
---
Originally reported by rburgst2, imported from: Gerrit-plugin modifies ant command line which is not compatible on windows
rsandell
Raw content of original issue
Gerrit modified my ant task by adding GIT specific environment variables in a way that causes the ant task to go belly up.
Here is a snippet from the log from a build where I have turned the escaping off. Note that the escaping option doesn't really fix the problem. Both variants (escaping on and off) fail.
16:18:18 c:\temp\hudsonwork\gerrit>exit 0
16:18:18 [TestProject] $ cmd.exe /C '"c:\java\apache-ant-1.8.2\bin\ant.bat -file build.xml "-DGERRIT_PATCHSET_UPLOADER=""Some Dude"" <somedude@hotmail.com>" -DGERRIT_CHANGE_URL=http://edo-git:8082/7 -DGERRIT_CHANGE_ID=I497fbd0d12d27ce4fa540a7cda578c1a41ced7ad -DGERRIT_CHANGE_NUMBER=7 "-DGERRIT_PATCHSET_UPLOADER_NAME=Some Dude" "-DGERRIT_CHANGE_SUBJECT=dont rely on the existence of local.properties" -DGERRIT_PATCHSET_UPLOADER_EMAIL=somedude@hotmail.com -DGERRIT_BRANCH=master -DGERRIT_REFSPEC=refs/changes/07/7/1 -DGERRIT_PATCHSET_NUMBER=1 "-DGERRIT_CHANGE_OWNER_NAME=Some Dude" -DGERRIT_PATCHSET_REVISION=497fbd0d12d27ce4fa540a7cda578c1a41ced7ad -DGERRIT_PROJECT=com.test.project "-DGERRIT_CHANGE_OWNER=""Some Dude"" <somedude@hotmail.com>" -DGERRIT_CHANGE_OWNER_EMAIL=somedude@hotmail.com -Dsdk.dir=c:/java/android-sdk-windows debug && exit %%ERRORLEVEL%%"'
16:18:18 Buildfile: c:\temp\hudsonwork\gerrit\TestProject\build.xml
16:18:19
16:18:19 BUILD FAILED
16:18:19 Target "Dude" does not exist in the project "TestProject".When I build the project without the gerrit-trigger plugin I get the following (correct) format.
16:45:09 [TestProject] $ cmd.exe /C '"c:\java\apache-ant-1.8.2\bin\ant.bat -file build.xml -Dsdk.dir=c:/java/android-sdk-windows debug && exit %%ERRORLEVEL%%"'
16:45:09 Buildfile: c:\temp\hudsonwork\gerrit\TestProject\build.xmlWhy are those attributes added in the first place? It would probably be easiest to just add a configuration switch to disable modification of the command line.
- environment:
Windows XP
Contributor guide
Research direction
Compare the generated command in the report with the working command that invokes ant.bat and build.xml on Windows. Trace where the Gerrit-specific arguments are added, then verify that the resulting command preserves those values without making Ant interpret the uploader name as a target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, java
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100