Reading and applying patches

Chong Yu Meng chongym at cymulacrum.net
Tue Sep 5 12:28:53 UTC 2006


On Tue, 2006-09-05 at 01:44 -0400, Todd Zullinger wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Chong Yu Meng wrote:
> > Hi all,
> > 
> > I'm having some difficulty understanding patching in general. A
> > little background: I downloaded the source tarball for a program and
> > it will not "make" cleanly. Checking the forum on the website,
> > someone had published a patch in the form of text in an email that
> > looks like this:
> > 
> > --- mlrate/mlrate.c 2003-01-27 10:31:31.000000000 +0100 
> > +++ mlrate.new/mlrate.c 2004-11-22 12:37:52.086783325 +0100 
> > @@ -25,6 +25,8 @@ 
> > #include <string.h> 
> > ... and continues for a bit longer
> > 
> To apply this patch you would use the patch program.  Usage is
> something like this:
> 
> cd /where/your/mlrate/tarball/is/
> patch -p1 < /path/to/your/saved/patch
> 
> The -p1 option tells patch to strip off the first directory when
> looking for the file(s) to patch.  So if you have a diff that starts
> with "--- mlrate/mlrate.c" and you're in the directory where mlrate.c
> is, -p1 would remove the mlrate/ part from the diff and find the file
> to patch properly.

Thanks, all!

Let me see if I understand this correctly:

I have untarred the source tarball into /usr/src/mlrate, and mlrate.c
is now inside /use/src/mlrate/src directory. So, now I copy and paste
the text from the forum to a text file (say, mlrate.patch) and save it
under /usr/src/mlrate/src. Then I go into the directory
/usr/src/mlrate/src and enter the command:

patch -p0 < mlrate.patch

And the patch command will know what to do and patch it. 

Then I can run "make" and "make install" as per usual?

Thanks and Regards.

-- 
Pascal Chong 
email:  chongym at cymulacrum.net 
web:    http://cymulacrum.net
pgp:    http://cymulacrum.net/pgp/cymulacrum.asc

"La science ne connaît pas de frontière parce que la connaissance
appartient à l’humanité. et que c’est la flamme qui illumine le monde."

-- Louis Pasteur
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20060905/34e549bb/attachment-0001.sig>


More information about the fedora-list mailing list