applying a patch

Michel Salim michel.salim at
Mon Sep 5 22:19:30 UTC 2005

Rakotomandimby Mihamina wrote:

>[ alredy sent to fedora-devel, i've been shot vecause i was off topic...]
>Hi use 2.6.12 kernel of FC4.
>I'm not used with patches, I did not try to apply the patch by hand.
>One of the kernel developpers has sent me a patch to diagnosys a problem
>on a notebook on wich the BIOS is very poor (just a few settings
>I would like to use the patch, but in a kernel src.rpm.
>I know building simple rpms, but here, it seems to be a bit more
>I attached the patch.
>I just 
>- copied the .patch file into /usr/src/redhat/SOURCES,
>- added a #1305 patch (just after #1304) into the spec file
>- applyied the #1305 (also just after #1304) into the specfile
>the problem is:
>$ rpmbuild -bp --target=i686 kernel-2.6.spec
>Patch #1305 (8139too-napi-revert.patch):
>+ patch -p1 -s
>8 out of 12 hunks FAILED -- saving rejects to file
>error: Bad exit status from /var/tmp/rpm-tmp.34513 (%prep)
>RPM build errors:
>    Bad exit status from /var/tmp/rpm-tmp.34513 (%prep)
>What did I do wrong?
(Note: this question is more appropriate to fedora-list or fedora-test-list)

You did nothing wrong - a patch might not applied cleanly if you try 
applying it to a different source tree than the one it was made against.

If you had tried applying the patch manually (rpmbuild -bp the original 
spec file, go to your RPM tmp directory (wherever it unpacked the 
source) and cat ~/my.patch | patch -p1 you'll get the same error.

What you need to do is open the .rej file that the patch program 
created, and see what was the problem. Try changing the patch so that it 
applies cleanly.

- Michel

More information about the fedora-extras-list mailing list