Applying a .patch file

13,811

Your patch command is fine. It is the patch file itself that gives the problem (at least for me (Kubuntu 11.04), as looking at the link you gave in the comment, all patch files contain the same error...?!)

To solve the problem for me, find this line in the patch file:

@@ -1562,6 +1562,8 @@ set_timezone() {

and remove the set_timezone() { part and the error you describe is gone.

This part is showing the function where the changes are made. When looking at the patches on the page you gave in your comment, it shows that all of them contain this extra information. As far as I know (but I am not a patch guru, so please correct me) is this not accepted by the default patch command.

(Unfortunately enough, your patch still fails and the expected lines in the patch file compared to the original file do not match...)

Share:
13,811
Admin
Author by

Admin

Updated on June 14, 2022

Comments

  • Admin
    Admin almost 2 years

    I want to apply a .patch file to one file. I placed both in the same folder and I tried this

    trinity@Zion ~/Desktop $ patch -i lalala.patch 
    patching file install.sub
    patch unexpectedly ends in middle of line
    Hunk #1 FAILED at 1562.
    1 out of 1 hunk FAILED -- saving rejects to file install.sub.rej
    

    But as you see in the output, it failed. The content of install.sub.rej is basically all the code from lalala.patch I tried similar commands but I got the same results. I guess I'm doing something wrong.

    I know applying a patch is just 1 command but I'm so lost at this. If someone tells me the command or directly patches the file (and also tells me the command) thanks

    original file http://pastebin.com/raw.php?i=PKru8m5r patch: http://pastebin.com/raw.php?i=kkMUHtj8