LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Error trying to patch source code (https://www.linuxquestions.org/questions/linux-newbie-8/error-trying-to-patch-source-code-808076/)

snowweb 05-15-2010 07:45 PM

Error trying to patch source code
 
I'm running spamassassin and want to install the fuzzyocr module for it. One of the dependencies of fuzzyocr is 'giflib' but according to the fuzzyocr page, it needs to be patched before I install it, with a patch which they supply on the fuzzyocr download page. I've tried to install the patch and get the following error. I'm wondering if anyone can tell me what I'm doing wrong please?

Code:

[root@s1 giflib-4.1.6]# patch --ignore-whitespace --input=/root/downloads/giftext-segfault.patch
can't find file to patch at input line 3
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
--------------------------
|*** giftext.c.orig 2006-08-21 15:41:47.000000000 -0400
|--- giftext.c 2006-08-21 15:41:55.000000000 -0400
--------------------------
File to patch: /giflib-temp/giflib-4.1.6/util/giftext.c
patching file /giflib-temp/giflib-4.1.6/util/giftext.c
Hunk #1 FAILED at 135.
1 out of 1 hunk FAILED -- saving rejects to file /giflib-temp/giflib-4.1.6/util/giftext.c.rej


To find the file to patch, I just looked through the files to find one called giftext.c or giftext.c.orig. I found giftext.c a directory lower, so specified that.

What did I do wrong please?

Regards,

Peter

AlucardZero 05-15-2010 07:52 PM

Perhaps you should have used the -p or --strip option?

grail 05-15-2010 08:36 PM

Try either -Np1 or -Np0 instead. I find these normally work.
Looks like:
Code:

patch -Np1 /path/to/patch

snowweb 05-16-2010 12:05 AM

Quote:

Originally Posted by grail (Post 3970154)
Try either -Np1 or -Np0 instead. I find these normally work.
Looks like:
Code:

patch -Np1 /path/to/patch

Thanks Grail. Here's the output:

Code:

[root@s1 giflib-4.1.6]# patch -Np1 < /root/downloads/giftext-segfault.patch
missing header for context diff at line 3 of patch
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|*** giftext.c.orig    2006-08-21 15:41:47.000000000 -0400
|--- giftext.c    2006-08-21 15:41:55.000000000 -0400
--------------------------
File to patch: /giflib-temp/giflib-4.1.6/util/giftext.c
patching file /giflib-temp/giflib-4.1.6/util/giftext.c
Hunk #1 FAILED at 135.
1 out of 1 hunk FAILED -- saving rejects to file /giflib-temp/giflib-4.1.6/util/giftext.c.rej

[root@s1 giflib-4.1.6]# patch -p < /root/downloads/giftext-segfault.patch
patch: option requires an argument -- p

I appreciate your help Grail.

peter


All times are GMT -5. The time now is 10:40 PM.