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

patching fails if the patch contains changes from more than 1 file

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      We use the RBTools from Reviewboard to generate patches. When trying to integrate with Jenkins-reviewbot plugin, I found that the patching always works when the patch only contains changes from one single file; when the patch contains changes from more than one file, it throws exceptions.

      This is an critical issue, as majority of our patches contain changes from multiple files.

      Please assist.

      Thanks,
      Sherrie
      ===
      Started by user mas1
      [EnvInject] - Loading node environment variables.
      Building remotely on blinwv58h (BMEG_58) in workspace /space/jenkins/linux86w/dev_pc_linux86w
      Cleared workspace.
      Note: .repository direcotry in workspace (if exists) is skipped ...
      Using remote perforce client: dev_pc_linux86w_jks-169356631
      [dev_pc_linux86w] $ /usr/local/bin/p4 workspace -o dev_pc_linux86w_jks-169356631
      Last build changeset: 532769
      [dev_pc_linux86w] $ /usr/local/bin/p4 counter change
      [dev_pc_linux86w] $ /usr/local/bin/p4 -s changes //dev_pc_linux86w_jks-169356631/...@532770,@532799
      Sync'ing workspace to changelist 532799 (forcing sync of unchanged files).
      [dev_pc_linux86w] $ /usr/local/bin/p4 -s sync -f //dev_pc_linux86w_jks-169356631/...@532799
      Sync complete, took 11030 ms
      Applying the diff
      Failed to apply patch due to:
      java.io.IOException: remote file operation failed: /space/jenkins/linux86w/dev_pc_linux86w/patch.diff at hudson.remoting.Channel@40453292:blinwv58h
      at hudson.FilePath.act(FilePath.java:913)
      at hudson.FilePath.act(FilePath.java:895)
      at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.applyPatch(ReviewboardParameterValue.java:183)
      at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.access$200(ReviewboardParameterValue.java:51)
      at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ReviewboardBuildWrapper.setUp(ReviewboardParameterValue.java:227)
      at hudson.model.Build$BuildExecution.doRun(Build.java:154)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
      at hudson.model.Run.execute(Run.java:1740)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:89)
      at hudson.model.Executor.run(Executor.java:240)
      Caused by: java.io.IOException: Failed to patch /space/jenkins/linux86w/dev_pc_linux86w/NW/dev/main/nsr/mm/mm_mux.c
      at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:250)
      at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:240)
      at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2483)
      at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      at hudson.remoting.Request$2.run(Request.java:328)
      at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: com.cloudbees.diff.PatchException: Cannot apply hunk @@ 8
      at com.cloudbees.diff.ContextualPatch.applyHunk(ContextualPatch.java:228)
      at com.cloudbees.diff.ContextualPatch.applyPatch(ContextualPatch.java:155)
      at com.cloudbees.diff.ContextualPatch.patch(ContextualPatch.java:108)
      at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:246)
      ... 10 more
      FATAL: remote file operation failed: /space/jenkins/linux86w/dev_pc_linux86w/patch.diff at hudson.remoting.Channel@40453292:blinwv58h
      java.io.IOException: remote file operation failed: /space/jenkins/linux86w/dev_pc_linux86w/patch.diff at hudson.remoting.Channel@40453292:blinwv58h
      at hudson.FilePath.act(FilePath.java:913)
      at hudson.FilePath.act(FilePath.java:895)
      at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.applyPatch(ReviewboardParameterValue.java:183)
      at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.access$200(ReviewboardParameterValue.java:51)
      at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ReviewboardBuildWrapper.setUp(ReviewboardParameterValue.java:227)
      at hudson.model.Build$BuildExecution.doRun(Build.java:154)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
      at hudson.model.Run.execute(Run.java:1740)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:89)
      at hudson.model.Executor.run(Executor.java:240)
      Caused by: java.io.IOException: Failed to patch /space/jenkins/linux86w/dev_pc_linux86w/NW/dev/main/nsr/mm/mm_mux.c
      at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:250)
      at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:240)
      at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2483)
      at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      at hudson.remoting.Request$2.run(Request.java:328)
      at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
      Caused by: com.cloudbees.diff.PatchException: Cannot apply hunk @@ 8
      at com.cloudbees.diff.ContextualPatch.applyHunk(ContextualPatch.java:228)
      at com.cloudbees.diff.ContextualPatch.applyPatch(ContextualPatch.java:155)
      at com.cloudbees.diff.ContextualPatch.patch(ContextualPatch.java:108)
      at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:246)
      ... 10 more

        Attachments

          Activity

          Hide
          yair Yair Yogev added a comment -

          The issue is actually in diff4j (https://github.com/cloudbees/diff4j) which patch-parameter-plugin uses.
          And there is a proposed fix to it (https://github.com/henriquegontijo/diff4j/commit/b633b71f41ae40bc00fe11f4f7cb3fc193e47a85) but it never made it into the main branch of diff4j (seems to be not maintained anymore?)

          But there is a workaround for using Jenkins-reviewbot
          See "Patch in Unified Format and multiple files support" in https://wiki.jenkins-ci.org/display/JENKINS/Jenkins-Reviewbot

          Show
          yair Yair Yogev added a comment - The issue is actually in diff4j ( https://github.com/cloudbees/diff4j ) which patch-parameter-plugin uses. And there is a proposed fix to it ( https://github.com/henriquegontijo/diff4j/commit/b633b71f41ae40bc00fe11f4f7cb3fc193e47a85 ) but it never made it into the main branch of diff4j (seems to be not maintained anymore?) But there is a workaround for using Jenkins-reviewbot See "Patch in Unified Format and multiple files support" in https://wiki.jenkins-ci.org/display/JENKINS/Jenkins-Reviewbot

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            sherriexma Sherrie Ma
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: