Archive for November, 2009

How to apply a patch/diff and solve “hunk FAILED”, “can’t find file to patch” and others

November 27th, 2009

Hi :)

After you read this article, you’ll be able to apply patch files/diffs and deal with possible errors in the process.

Let’s assume the patch is in the file fix-bug.patch (the extension doesn’t matter). The directory software-1.0 contains the files to patch. Applying a patch file/diff then works like this:

  1. Make a backup. On Linux you can use the command:
    markus@ubuntu:~$ cp -a software1.0.before-patch
  2. Run patch (for Windows: patch.exe) like this:
    markus@ubuntu:~$ patch -Np1 -d software-1.0 < fix-bug.patch

Attention: this is patch minus N p digit one, not minus N p small letter L!
» Read more: How to apply a patch/diff and solve “hunk FAILED”, “can’t find file to patch” and others

© 2017 Markus Bertheau. All rights reserved.