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

Quotationmarks in commit message leads to merge failure (Praqma case 13083)

    XMLWordPrintable

Details

    Description

      From a customer we got the following report about failed merge, due to quotation marks in the git commit message.

      Example (customer specific information removed)

      07:28:45 [ready2master] $ git.exe pull origin master
      07:28:51 Preparing to merge changes in commit 1b395e86024bf8f5d6cad09953d8c70f94987b98 to integration branch master
      07:28:52 [PREINT] git.exe merge -m "Accumulated commit of the following from branch 'origin/ready/my-dev':
      07:28:52
      07:28:52 commit 1b395e86024bf8f5d6cad09953d8c70f94987b98
      07:28:52 Author: Praqma Support <support@praqma.net>
      07:28:52 Date: on maj 13 07:26:39 2015 +0200
      07:28:52
      07:28:52 Changes scons varible test to "build=rel or test"
      07:28:52
      07:28:52
      07:28:52 " 1b395e86024bf8f5d6cad09953d8c70f94987b98 --no-ff
      07:28:52 [ready2master] $ git.exe merge -m 'Accumulated commit of the following from branch 'origin/ready/my-dev':
      07:28:52
      07:28:52 commit 1b395e86024bf8f5d6cad09953d8c70f94987b98
      07:28:52 Author: Praqma Support <support@praqma.net>
      07:28:52 Date: on maj 13 07:26:39 2015 +0200
      07:28:52
      07:28:52 Changes scons varible test to "build=rel or test"
      07:28:52
      07:28:52
      07:28:52 ' 1b395e86024bf8f5d6cad09953d8c70f94987b98 --no-ff
      07:28:52 Failed to merge changes.
      07:28:52 merge: or - not something we can merge
      07:28:52
      07:28:52 Merge failure

      Attachments

        Activity

          bue Bue Petersen added a comment -

          Related to earlier reported problem, that was reproduced JENKINS-27662.

          From the log and other information received, the following can be relevant for reproducing the problem:

          • It is a Windows OS
          • It seems to be running Danish language

          The merge fails, as it can't understand 'or' which comes from

          test to "build=rel or test"

          where the quotation just before build end the commit message given to merge.

          I suggest to extend the tests written for JENKINS-27662.

          bue Bue Petersen added a comment - Related to earlier reported problem, that was reproduced JENKINS-27662 . From the log and other information received, the following can be relevant for reproducing the problem: It is a Windows OS It seems to be running Danish language The merge fails, as it can't understand 'or' which comes from test to "build=rel or test" where the quotation just before build end the commit message given to merge. I suggest to extend the tests written for JENKINS-27662 .
          bue Bue Petersen added a comment -

          Test repository for the test in JENKINS-27662 is generated like this:

          ...
          git commit -m "This is a commit message with double quotes (commit made on Windows), eg. \"test quotes\"."
          ...

          It might be the problem, the line should maybe have looked like this:

          ...
          git commit -m 'This is a commit message with double quotes (commit made on Windows), eg. "test quotes".'
          ...

          https://github.com/Praqma/pretested-integration-plugin/blob/master/src/test/resources/commitMessagesWithDoubleQuotes_windows.bat

          bue Bue Petersen added a comment - Test repository for the test in JENKINS-27662 is generated like this: ... git commit -m "This is a commit message with double quotes (commit made on Windows), eg. \"test quotes\"." ... It might be the problem, the line should maybe have looked like this: ... git commit -m 'This is a commit message with double quotes (commit made on Windows), eg. "test quotes".' ... https://github.com/Praqma/pretested-integration-plugin/blob/master/src/test/resources/commitMessagesWithDoubleQuotes_windows.bat
          bue Bue Petersen added a comment -

          Problem confirmed - it is still there. Might be mostly related to Windows.

          bue Bue Petersen added a comment - Problem confirmed - it is still there. Might be mostly related to Windows.
          meolsen Morten Engelhardt Olsen added a comment - - edited

          Attaching log

          [PREINT] Preparing environment using Pretested Integration Plugin 2.3.0-SNAPSHOT (cbd24) 
          [PREINT] Checking out integration branch master:
          [PREINT]  D:\Jenkins_MCU_Node\tools\git\bin\git checkout -B master atmelstudio/master
          [atmelstudio] $ D:\Jenkins_MCU_Node\tools\git\bin\git checkout -B master atmelstudio/master
          [PREINT]  D:\Jenkins_MCU_Node\tools\git\bin\git pull atmelstudio master
          [atmelstudio] $ D:\Jenkins_MCU_Node\tools\git\bin\git pull atmelstudio master
          [PREINT] Preparing to merge changes in commit fe50e64d497d722c41fe63f984dd1cf4702c3af5 on development branch atmelstudio/bugfix/ready_AVRSV-6716 to integration branch master
          [PREINT] Collecting commit messages on development branch atmelstudio/bugfix/ready_AVRSV-6716
          [PREINT] Done collecting commit messages
          [PREINT] Collecting author of last commit on development branch
          [PREINT] Done colecting last commit author:  <@> 1436164197 +0530
          [PREINT] Starting accumulated merge (no-ff) - without commit:
          [PREINT]  D:\Jenkins_MCU_Node\tools\git\bin\git merge -m "Accumulated commit of the following from branch 'atmelstudio/bugfix/ready_AVRSV-6716':
           
          commit fe50e64d497d722c41fe63f984dd1cf4702c3af5
          Author: 
          Date:   Mon Jul 6 07:29:57 2015 +0100
           
              Fixed isues AVRSV-6716
           
           
          commit 633f1a4b795f46a4fcb6e4910612bcc8c8325b50
          Author: 
          Date:   Mon Jul 6 07:10:21 2015 +0100
           
              AVRSV-6716 "program flash from RAM" option is disable under tools options in properties window and Memories tab in Device programming dialog
           
           
          " fe50e64d497d722c41fe63f984dd1cf4702c3af5 --no-ff --no-commit
          [atmelstudio] $ D:\Jenkins_MCU_Node\tools\git\bin\git merge -m 'Accumulated commit of the following from branch 'atmelstudio/bugfix/ready_AVRSV-6716':
           
          commit fe50e64d497d722c41fe63f984dd1cf4702c3af5
          Author: 
          Date:   Mon Jul 6 07:29:57 2015 +0100
           
              Fixed isuues AVRSV-6716
           
           
          commit 633f1a4b795f46a4fcb6e4910612bcc8c8325b50
          Author: 
          Date:   Mon Jul 6 07:10:21 2015 +0100
           
              AVRSV-6716 "program flash from RAM" option is disable under tools options in properties window and Memories tab in Device programming dialog
           
           
          ' fe50e64d497d722c41fe63f984dd1cf4702c3af5 --no-ff --no-commit
          [PREINT] Accumulated merge done
          [PREINT] Failed to merge.
          [PREINT] Git command failed with exit code '1' and error message:
          merge: flash - not something we can merge
           
          Could not merge changes. Git output: merge: flash - not something we can merge
          

          (anonymized)

          This build was running on a Windows Server 2012 R2 using javaws.

          meolsen Morten Engelhardt Olsen added a comment - - edited Attaching log [PREINT] Preparing environment using Pretested Integration Plugin 2.3.0-SNAPSHOT (cbd24) [PREINT] Checking out integration branch master: [PREINT] D:\Jenkins_MCU_Node\tools\git\bin\git checkout -B master atmelstudio/master [atmelstudio] $ D:\Jenkins_MCU_Node\tools\git\bin\git checkout -B master atmelstudio/master [PREINT] D:\Jenkins_MCU_Node\tools\git\bin\git pull atmelstudio master [atmelstudio] $ D:\Jenkins_MCU_Node\tools\git\bin\git pull atmelstudio master [PREINT] Preparing to merge changes in commit fe50e64d497d722c41fe63f984dd1cf4702c3af5 on development branch atmelstudio/bugfix/ready_AVRSV-6716 to integration branch master [PREINT] Collecting commit messages on development branch atmelstudio/bugfix/ready_AVRSV-6716 [PREINT] Done collecting commit messages [PREINT] Collecting author of last commit on development branch [PREINT] Done colecting last commit author: <@> 1436164197 +0530 [PREINT] Starting accumulated merge (no-ff) - without commit: [PREINT] D:\Jenkins_MCU_Node\tools\git\bin\git merge -m "Accumulated commit of the following from branch 'atmelstudio/bugfix/ready_AVRSV-6716' : commit fe50e64d497d722c41fe63f984dd1cf4702c3af5 Author: Date: Mon Jul 6 07:29:57 2015 +0100 Fixed isues AVRSV-6716 commit 633f1a4b795f46a4fcb6e4910612bcc8c8325b50 Author: Date: Mon Jul 6 07:10:21 2015 +0100 AVRSV-6716 "program flash from RAM" option is disable under tools options in properties window and Memories tab in Device programming dialog " fe50e64d497d722c41fe63f984dd1cf4702c3af5 --no-ff --no-commit [atmelstudio] $ D:\Jenkins_MCU_Node\tools\git\bin\git merge -m 'Accumulated commit of the following from branch ' atmelstudio/bugfix/ready_AVRSV-6716': commit fe50e64d497d722c41fe63f984dd1cf4702c3af5 Author: Date: Mon Jul 6 07:29:57 2015 +0100 Fixed isuues AVRSV-6716 commit 633f1a4b795f46a4fcb6e4910612bcc8c8325b50 Author: Date: Mon Jul 6 07:10:21 2015 +0100 AVRSV-6716 "program flash from RAM" option is disable under tools options in properties window and Memories tab in Device programming dialog ' fe50e64d497d722c41fe63f984dd1cf4702c3af5 --no-ff --no-commit [PREINT] Accumulated merge done [PREINT] Failed to merge. [PREINT] Git command failed with exit code '1' and error message: merge: flash - not something we can merge Could not merge changes. Git output: merge: flash - not something we can merge (anonymized) This build was running on a Windows Server 2012 R2 using javaws.

          Code changed in jenkins
          User: Bue Petersen
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/pretestedintegration/scm/git/AccumulatedCommitStrategy.java
          src/main/java/org/jenkinsci/plugins/pretestedintegration/scm/git/GitBridge.java
          src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CommitMessagesWithDoubleQuotes.java
          src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CommitMessagesWithSpecialChars.java
          src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CustomIntegrationBranch.java
          src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/StaticGitRepositoryTestBase.java
          src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/TestUtilsFactory.java
          src/test/resources/JENKINS-28640.md
          src/test/resources/JENKINS-28640.zip
          src/test/resources/commitMessagesWithDoubleQuotesSingleQuotesMade.md
          src/test/resources/commitMessagesWithDoubleQuotesSingleQuotesMade_linux-repo_description.log
          src/test/resources/commitMessagesWithDoubleQuotesSingleQuotesMade_linux.sh
          src/test/resources/commitMessagesWithDoubleQuotesSingleQuotesMade_linux.zip
          src/test/resources/commitMessagesWithDoubleQuotesSingleQuotesMade_windows-repo_description.log
          src/test/resources/commitMessagesWithDoubleQuotesSingleQuotesMade_windows.bat
          src/test/resources/commitMessagesWithDoubleQuotesSingleQuotesMade_windows.zip
          http://jenkins-ci.org/commit/pretested-integration-plugin/a48f690943cb79034717e495706c6428c7e710e4
          Log:
          JENKINS-28640: Quotation marks in commit msg:

          Only related to the accumulated strategy.

          Temporary fix for the bug with quotation marks in the commit message
          leading to merge failure because of not properly escaped and formatted
          command line arguments.

          Fix is temporary replacing " (quotation marks) with ' (plings).

          The squashed strategy is not affected, as the git command automatically
          generated the commit message, where as the plugin creates a look-a-like
          squash message, slightly modified, is using accumulated strategy.

          Other improvements:

          • fixed hard-coded dependency on the maven-hpi-plugin in the pom file,
            new version works now
          • cleaned few tests from wrong comments, and not clearly formatted error
            messages if the tests failed
          • renamed test suite for commit message prolems related to quotation
            marks to special chars test suite
          • shared a useful method from one test suite through test utils class
            that can pretty print console output from the job to use for
            verification in the tests.
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Bue Petersen Path: pom.xml src/main/java/org/jenkinsci/plugins/pretestedintegration/scm/git/AccumulatedCommitStrategy.java src/main/java/org/jenkinsci/plugins/pretestedintegration/scm/git/GitBridge.java src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CommitMessagesWithDoubleQuotes.java src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CommitMessagesWithSpecialChars.java src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CustomIntegrationBranch.java src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/StaticGitRepositoryTestBase.java src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/TestUtilsFactory.java src/test/resources/ JENKINS-28640 .md src/test/resources/ JENKINS-28640 .zip src/test/resources/commitMessagesWithDoubleQuotesSingleQuotesMade.md src/test/resources/commitMessagesWithDoubleQuotesSingleQuotesMade_linux-repo_description.log src/test/resources/commitMessagesWithDoubleQuotesSingleQuotesMade_linux.sh src/test/resources/commitMessagesWithDoubleQuotesSingleQuotesMade_linux.zip src/test/resources/commitMessagesWithDoubleQuotesSingleQuotesMade_windows-repo_description.log src/test/resources/commitMessagesWithDoubleQuotesSingleQuotesMade_windows.bat src/test/resources/commitMessagesWithDoubleQuotesSingleQuotesMade_windows.zip http://jenkins-ci.org/commit/pretested-integration-plugin/a48f690943cb79034717e495706c6428c7e710e4 Log: JENKINS-28640 : Quotation marks in commit msg: Only related to the accumulated strategy. Temporary fix for the bug with quotation marks in the commit message leading to merge failure because of not properly escaped and formatted command line arguments. Fix is temporary replacing " (quotation marks) with ' (plings). The squashed strategy is not affected, as the git command automatically generated the commit message, where as the plugin creates a look-a-like squash message, slightly modified, is using accumulated strategy. Other improvements: fixed hard-coded dependency on the maven-hpi-plugin in the pom file, new version works now cleaned few tests from wrong comments, and not clearly formatted error messages if the tests failed renamed test suite for commit message prolems related to quotation marks to special chars test suite shared a useful method from one test suite through test utils class that can pretty print console output from the job to use for verification in the tests.

          Code changed in jenkins
          User: Bue Petersen
          Path:
          src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CommitMessagesWithSpecialChars.java
          src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CommitMessagesWithSpecialCharsIT.java
          src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CustomIntegrationBranch.java
          src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CustomIntegrationBranchIT.java
          src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/DoNotAllowMasterBranchAsReadyBranch.java
          src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/DoNotAllowMasterBranchAsReadyBranchIT.java
          src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/UseAuthorOfLastCommit.java
          src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/UseAuthorOfLastCommitIT.java
          http://jenkins-ci.org/commit/pretested-integration-plugin/349570612582f04199683850676cad203b4d8fb9
          Log:
          JENKINS-28640: Quotation marks - enabled tests:

          Not all tests have automatically been executed before.

          Fixing the filenames to include all tests.

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Bue Petersen Path: src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CommitMessagesWithSpecialChars.java src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CommitMessagesWithSpecialCharsIT.java src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CustomIntegrationBranch.java src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CustomIntegrationBranchIT.java src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/DoNotAllowMasterBranchAsReadyBranch.java src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/DoNotAllowMasterBranchAsReadyBranchIT.java src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/UseAuthorOfLastCommit.java src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/UseAuthorOfLastCommitIT.java http://jenkins-ci.org/commit/pretested-integration-plugin/349570612582f04199683850676cad203b4d8fb9 Log: JENKINS-28640 : Quotation marks - enabled tests: Not all tests have automatically been executed before. Fixing the filenames to include all tests.

          People

            bue Bue Petersen
            bue Bue Petersen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: