junkblocker / patchreview-vim

Vim/Neovim plugin for doing single, multi-patch or diff code reviews
http://www.vim.org/scripts/script.php?script_id=1563
108 stars 8 forks source link

ERROR: 1 out of 1 hunk FAILED -- saving rejects to file /tmp/v8YAN3Y/349.rej¬ #14

Closed albasili closed 7 years ago

albasili commented 7 years ago

I'm using Gundo to view hunks of changes in the preview window, save the buffer as a patch and try to apply a reverse patch through ReversePatchReview.

Unfortunately PatchReview fails to apply the patch and I have no '.rej' file written in /tmp. Any idea why?

p.s.: the patch file is modified in order to include the correct filename and path.

junkblocker commented 7 years ago

Is the patch file correct? Can you apply it with something like

patch -R -p1 < patchfile

from a shell command line? Part of the purpose of this plugin is to avoid the .rej files.

albasili commented 7 years ago

Well, the -p1 doesn't make sense here since the file to be patched is in the same location as the patch. But what is more puzzling is that the patch file is not really recognized correctly. Here it is:

--- manage_regression.py    2017-06-27 08:49:37 AM
+++ manage_regression.py    2017-06-27 08:49:42 AM
@@ -115,7 +115,7 @@
     # Code coverage log file
     PE['file_pc_covered_log']                         = {}
     PE['file_pc_covered_log']['name']                 = irun_ng_config.PC_COVERED_LOG_FILENAME
-    PE['file_pc_covered_log']['path']                 = os.path.join(PE['run_dir'], irun_ng_config.IRUN_LOG_FOLDER, PE['file_pc_covered_log']['name'])
+    PE['file_pc_covered_log']['path']                 = os.path.join(PE['run_dir'], PE['file_pc_covered_log']['name'])
     PE['file_pc_covered_log']['path_bak']             = os.path.join(PE['run_dir'], irun_ng_config.IRUN_LOG_FOLDER, "%(name)s.bak"%PE['file_pc_covered_log'])
     PE['file_pc_covered_log']['path_testrun']         = os.path.join(PE['testrun_dir'], PE['file_pc_covered_log']['name'])
     # Filtered log file

The manage_regression.py is sitting in the very same directory so I don't understand why is not working...

junkblocker commented 7 years ago

So it sounds like your hand crafted patch is corrupt to start with and thus this plugin is not going to handle it. If you can share the origin and patch files somewhere then I can take a look. Either way, not a patchreview-vim issue.

albasili commented 7 years ago

I've created an example file with a patch file generated through Gundo diff view and manually modifying the path information to reflect the filename instead of the version: file: http://sprunge.us/CXcQ patch: http://sprunge.us/aSjN

What's wrong in the patchfile?

I may agree with the fact that the issue is not related to patchreview-vim, unless the patch has a correct format and it's just a matter of configuration (the way we call the patch utility)

junkblocker commented 7 years ago

Ah, that makes it clearer. You are expecting to see .rej files in a temporary folder and they disappear. One goal of the plugin was to improve upon the vim's :diffpatch behavior and not leave .rej polluting the workspace. Any remaining .rej conflicts are shown at the top of the respective edit window.

Secondly, the (reverse) patch is not applying because it is expecting a line without a comma while the test.json has a comma in

"width": 500

vs.

"width": 500,
albasili commented 7 years ago

Indeed it works! Thanks a lot.

koushikfs commented 3 years ago

i am getting an error while building a kernel for this kali nethunter --> git clone https://github.com/Re4son/android_kernel_xiaomi_davinci_hasty -b nethunter-10.0

the error is

root@kali# patch -p1 < mac80211.compat08082009.wl_frag+ack_v1.patch
patching file net/mac80211/tx.c Hunk #1 FAILED at 677. 1 out of 1 hunk FAILED -- saving rejects to file net/mac80211/tx.c.rej

pls try to solve , i cant able to do wireless injections using the present kernel i am using