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

Escaping of single quotes in commit message fails

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • gerrit-trigger-plugin
    • None
    • Gerrit-Trigger plugin version 2.18.3
      Gerrit-Trigger plugin version 2.10.1 on Jenkins ver. 1.523

    Description

      The gerrit-trigger plugin fails in escaping single quotes in the commit comment.
      After I entered the following text as commit comment the mvn call that was triggered by the gerrit-trigger plugin fails with error "The system cannot find the file specified.":

      Remove 'Custom' mode from "Connection Settings"

      In the output of the jenkins job I could see that double quotes were escaped like: from \"Connection Settings\"

      After I removed the single quotes from my comment the job run successful.

      Attachments

        Issue Links

          Activity

            henrik_bennin Henrik Bennin created issue -
            rtyler R. Tyler Croy made changes -
            Field Original Value New Value
            Workflow JNJira [ 152619 ] JNJira + In-Review [ 178266 ]

            Still a valid issue, for instance with the default format (single quotes around Build Failed <BUILDS_STATS>)

            gerrit review <CHANGE>,<PATCHSET> --message 'Build Failed <BUILDS_STATS>' --verified <VERIFIED>
            
            INFO: Notifying BuildCompleted to gerrit: gerrit review 9111,1 --message 'Build Failed 
            
            ahaha! ' ! /apps/proc : FAILURE' --verified -1
            Sep 09, 2016 12:28:02 PM com.sonymobile.tools.gerrit.gerritevents.workers.cmd.AbstractSendCommandJob sendCommand
            SEVERE: Could not run command gerrit review 9111,1 --message 'Build Failed 
            
            ahaha! ' ! /apps/proc : FAILURE' --verified -1
            java.io.IOException: Error during sending command
            	at com.sonymobile.tools.gerrit.gerritevents.workers.cmd.AbstractSendCommandJob.sendCommand2(AbstractSendCommandJob.java:118)
            	at com.sonymobile.tools.gerrit.gerritevents.workers.cmd.AbstractSendCommandJob.sendCommand(AbstractSendCommandJob.java:79)
            	at com.sonyericsson.hudson.plugins.gerrit.trigger.gerritnotifier.GerritNotifier.buildCompleted(GerritNotifier.java:118)
            	at com.sonyericsson.hudson.plugins.gerrit.trigger.gerritnotifier.job.ssh.BuildCompletedCommandJob.run(BuildCompletedCommandJob.java:71)
            	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
            	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
            	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
            	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
            	at java.lang.Thread.run(Thread.java:745)
            Caused by: com.sonymobile.tools.gerrit.gerritevents.ssh.SshException: fatal: "!" is not a valid patch set (1)
            	at com.sonymobile.tools.gerrit.gerritevents.ssh.SshConnectionImpl.executeCommand(SshConnectionImpl.java:254)
            	at com.sonymobile.tools.gerrit.gerritevents.workers.cmd.AbstractSendCommandJob.sendCommand2(AbstractSendCommandJob.java:116)
            	... 8 more
            

            So with single quotes, it's not possible to have single quotes in the message, and if it is double quotes, then it is not possible to have double quotes in the message.
            I would suggest that we escape single quotes by default for BUILD_STATS since the default is to have single quotes.

            corfr Bertrand Roussel added a comment - Still a valid issue, for instance with the default format (single quotes around Build Failed <BUILDS_STATS>) gerrit review <CHANGE>,<PATCHSET> --message 'Build Failed <BUILDS_STATS>' --verified <VERIFIED> INFO: Notifying BuildCompleted to gerrit: gerrit review 9111,1 --message 'Build Failed ahaha! ' ! /apps/proc : FAILURE' --verified -1 Sep 09, 2016 12:28:02 PM com.sonymobile.tools.gerrit.gerritevents.workers.cmd.AbstractSendCommandJob sendCommand SEVERE: Could not run command gerrit review 9111,1 --message 'Build Failed ahaha! ' ! /apps/proc : FAILURE' --verified -1 java.io.IOException: Error during sending command at com.sonymobile.tools.gerrit.gerritevents.workers.cmd.AbstractSendCommandJob.sendCommand2(AbstractSendCommandJob.java:118) at com.sonymobile.tools.gerrit.gerritevents.workers.cmd.AbstractSendCommandJob.sendCommand(AbstractSendCommandJob.java:79) at com.sonyericsson.hudson.plugins.gerrit.trigger.gerritnotifier.GerritNotifier.buildCompleted(GerritNotifier.java:118) at com.sonyericsson.hudson.plugins.gerrit.trigger.gerritnotifier.job.ssh.BuildCompletedCommandJob.run(BuildCompletedCommandJob.java:71) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: com.sonymobile.tools.gerrit.gerritevents.ssh.SshException: fatal: "!" is not a valid patch set (1) at com.sonymobile.tools.gerrit.gerritevents.ssh.SshConnectionImpl.executeCommand(SshConnectionImpl.java:254) at com.sonymobile.tools.gerrit.gerritevents.workers.cmd.AbstractSendCommandJob.sendCommand2(AbstractSendCommandJob.java:116) ... 8 more So with single quotes, it's not possible to have single quotes in the message, and if it is double quotes, then it is not possible to have double quotes in the message. I would suggest that we escape single quotes by default for BUILD_STATS since the default is to have single quotes.
            ssbarnea Sorin Sbarnea made changes -
            Environment Gerrit-Trigger plugin version 2.10.1 on Jenkins ver. 1.523 Gerrit-Trigger plugin version 2.18.3
            Gerrit-Trigger plugin version 2.10.1 on Jenkins ver. 1.523
            ssbarnea Sorin Sbarnea made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            ssbarnea Sorin Sbarnea added a comment -

            This bug is making the gerrit integration really unreliable because the side effects for the users is that they miss responses and they have no idea what happened. Even from investigating the jenkins logs, which are not really accessible to anyone, is hard to figure out what really happened.

            Because we can have both double and single quotes inside messages I would suggest replacing single quotes from original message with some other Unicode characters that are safe for command line usage and visually similar to the single quotes ones.

            I am open to any kind of fixes as long the final result will avoid loss of messages due to their content.

            ssbarnea Sorin Sbarnea added a comment - This bug is making the gerrit integration really unreliable because the side effects for the users is that they miss responses and they have no idea what happened. Even from investigating the jenkins logs, which are not really accessible to anyone, is hard to figure out what really happened. Because we can have both double and single quotes inside messages I would suggest replacing single quotes from original message with some other Unicode characters that are safe for command line usage and visually similar to the single quotes ones. I am open to any kind of fixes as long the final result will avoid loss of messages due to their content.
            ssbarnea Sorin Sbarnea made changes -
            Link This issue is duplicated by JENKINS-32291 [ JENKINS-32291 ]
            ssbarnea Sorin Sbarnea made changes -
            Link This issue is duplicated by JENKINS-28556 [ JENKINS-28556 ]
            ssbarnea Sorin Sbarnea made changes -
            Link This issue relates to JENKINS-15074 [ JENKINS-15074 ]
            ssbarnea Sorin Sbarnea made changes -
            Remote Link This issue links to "PR-307 (Web Link)" [ 15285 ]
            ssbarnea Sorin Sbarnea added a comment -

            Now there is a PR for addressing this issue https://github.com/jenkinsci/gerrit-trigger-plugin/pull/307

            ssbarnea Sorin Sbarnea added a comment - Now there is a PR for addressing this issue https://github.com/jenkinsci/gerrit-trigger-plugin/pull/307
            chantivlad chanti vlad made changes -
            Link This issue is duplicated by JENKINS-47016 [ JENKINS-47016 ]

            People

              rsandell rsandell
              henrik_bennin Henrik Bennin
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: