Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi
I am trying to put patch on my customized OS but it gives an error
saying
Hunk #1 succeeded at 38 (offset -2 lines).
Hunk #2 succeeded at 113 with fuzz 2 (offset -2 lines).
Hunk #3 FAILED at 152.
there is no reject file in the current dir.Any possible explanations why it is not getting formed?
there are lines like @@ -52,12 +115,16 @@ int patch file.what does it mean?
what can be the possible reason for HUNK FAILED?
Well the failure means that the changes defined in the file were not able to be applied, as the lines used to identify the area of code to be modified were probably not consistent. Just look at it yourself and verify what is trying to be done.
I am presuming this is a patch with diff -u ( has - and +). Hunk 1 and 2 succeed at low offsets. To find out what is going on, look at hunk 3. As you read through the patch, watch iout for a line like
patching file somedir/foo.c
There might be many of these, so watch for the one relating to hunk 3
@@ -52,12 +115,16 @@
This is the beginning of a hunk. The usual invocation of patch is
diff -Naur mysoftware-version.orig mysoftware.version
The first being the original software and the second the same package with a bug fixed.
So That hunk begins at line 52 and goes on for 12 lines in the .orig file marked with a - and it goes in at 115 in the patched file and goes on for 16 lines. So 12 come out and 16 go in.
The usual reason patches fail is that they are already applied - you're fixing a bug that's already fixed. Next main reason is getting the p number wrong. The way I use patch is to put the patch beside the source tree, cd into the source tree, and run patch -p1 ../the_patch.patch
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.