jenkinsci / jenkinsci/gerrit-trigger-plugin
[JENKINS-10440] gerrit trigger plugin fails to run mvn command when non escaped "" chards are in subject
- Dominant language
- Java
- Stars
- 226
- Forks
- 289
- PR merge metrics
- No merged PRs in 30d
Description
when jenkins triggers a build using gerrit trigger plugin and the -DGERRIT_CHANGE_SUBJECT contains " chars, it doesnt escapse the char properly and mvn command fails.
the original patch text: adding "\" to end of search will cause Exception message
example run:
/var/lib/jenkins/tools/maven_2.2.1/bin/mvn '-DGERRIT_CHANGE_SUBJECT=adding \"
" to end of search will cause Exception message ' -DGERRIT_REFSPEC=refs/changes/76/1076/6 -DGERRIT_BRANCH=review -DGERRIT_PATCHSET_NUMBER=6 -DGERRIT_CHANGE_URL=http://gerrit.server.com/1076 -DGERRIT_CHANGE_ID=Ied1bcb88901485a62a4ec236edd7d10816edf9ba -DGERRIT_PATCHSET_REVISION=226c6b02b5a12f0cfa2af1c9d9f634c1cf928184 -DGERRIT_CHANGE_NUMBER=1076 -DGERRIT_PROJECT=rhevm -Dmaven.repo.local=/mnt/iscsi/workspaces/gerrit_tests/.repository clean install findbugs:findbugs
maven fails with:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Invalid task 'to': you must specify a valid lifecycle phase, or a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Sun Jul 24 23:42:17 IDT 2011
[INFO] Final Memory: 45M/7850M
[INFO] ------------------------------------------------------------------------
Build step 'Invoke top-level Maven targets' marked build as failure
ERROR: Publisher hudson.plugins.findbugs.FindBugsPublisher aborted due to exception
java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at hudson.model.Run$Runner$CheckpointSet.waitForCheckPoint(Run.java:1267)
at hudson.model.Run.waitForCheckpoint(Run.java:1235)
at hudson.model.CheckPoint.block(CheckPoint.java:144)
at hudson.tasks.BuildStepMonitor$2.perform(BuildStepMonitor.java:25)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:682)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:657)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:635)
at hudson.model.Build$RunnerImpl.post2(Build.java:161)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:604)
at hudson.model.Run.run(Run.java:1400)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:175)
Finished: FAILURE
---
Originally reported by
eedri, imported from: gerrit trigger plugin fails to run mvn command when non escaped "" chards are in subject
rsandell
Raw content of original issue
when jenkins triggers a build using gerrit trigger plugin and the -DGERRIT_CHANGE_SUBJECT contains " chars, it doesnt escapse the char properly and mvn command fails.
the original patch text: adding "\" to end of search will cause Exception message
example run:
/var/lib/jenkins/tools/maven_2.2.1/bin/mvn '-DGERRIT_CHANGE_SUBJECT=adding \"
" to end of search will cause Exception message ' -DGERRIT_REFSPEC=refs/changes/76/1076/6 -DGERRIT_BRANCH=review -DGERRIT_PATCHSET_NUMBER=6 -DGERRIT_CHANGE_URL=http://gerrit.server.com/1076 -DGERRIT_CHANGE_ID=Ied1bcb88901485a62a4ec236edd7d10816edf9ba -DGERRIT_PATCHSET_REVISION=226c6b02b5a12f0cfa2af1c9d9f634c1cf928184 -DGERRIT_CHANGE_NUMBER=1076 -DGERRIT_PROJECT=rhevm -Dmaven.repo.local=/mnt/iscsi/workspaces/gerrit_tests/.repository clean install findbugs:findbugsmaven fails with:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Invalid task 'to': you must specify a valid lifecycle phase, or a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Sun Jul 24 23:42:17 IDT 2011
[INFO] Final Memory: 45M/7850M
[INFO] ------------------------------------------------------------------------
Build step 'Invoke top-level Maven targets' marked build as failure
ERROR: Publisher hudson.plugins.findbugs.FindBugsPublisher aborted due to exception
java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at hudson.model.Run$Runner$CheckpointSet.waitForCheckPoint(Run.java:1267)
at hudson.model.Run.waitForCheckpoint(Run.java:1235)
at hudson.model.CheckPoint.block(CheckPoint.java:144)
at hudson.tasks.BuildStepMonitor$2.perform(BuildStepMonitor.java:25)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:682)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:657)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:635)
at hudson.model.Build$RunnerImpl.post2(Build.java:161)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:604)
at hudson.model.Run.run(Run.java:1400)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:175)
Finished: FAILURE
environment
```
Jenkins 1.421
RedHat enterprize 6.1 x86_64
```
Contributor guide
Research direction
Start with the gerrit-trigger-plugin code that constructs the Maven command and passes -DGERRIT_CHANGE_SUBJECT, using the reported subject containing escaped quotation marks as the reproduction case. Done means Maven receives the complete subject as one argument without treating words such as "to" as separate tasks; add or run a regression test if the plugin has coverage for command construction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- ci-cd
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100