The following is a collection of Frequently asked questions about patches in this page and some other useful information. All comments are welcome.
A patch gives you the ability to have today a feature for which otherwise
you would have to wait an undetermined amount of time. For example, a
patch may fix a bug in the program that you are using or may give
enhancements to its performance. It's the future today.
In order to apply a patch and use it, you need to be able to follow a few
directions, which are already written in this page. You do not need a deep
knowledge of computers, nor programming, nor will you become a geek if
you know how to apply a patch, in the same way that you will not become a speed
car racer because you speed in the freeway. This is the simple part of the
process, just apply the patch as described here and enjoy :).
You have to use the "patch" command to do so. The way I apply a patch in my
machine is as follows:
I change my directory to the directory that contains the source code of
pine (called pineX.YZ or so) and copy the patch into that directory, then I
execute the command:
If the above does not work try moving the patch to a directory in the same
level as the directory that contains the source code and execute the
following command:
You may have to try until it works. I had a experience in a AIX 4.2 machine
where none of these instructions worked. I had to apply the patch
using the command
If everything fails try reading the manual for the command for your machine. Use the command "man patch" to do so.
Danny Chapman sent me the following instructions for applying patches in Solaris 2.8, I hope they work in some other versions of Solaris too.
with the patch file at the same level as the pineX.YZ directory, the
following worked:
Usually the "patch" program will tell you which file is patching. If no other message that the filename being patched is returned then the application of the patch was successful and there's nothing to worry about. Just continue to compile the program again.
However you may also receive some of these messages:
Hunk #1 succeeded at 171 with fuzz 2 (offset 2 lines).
Hunk #2 FAILED at 414.
The first message says the patch program successfully applied the patch, there was no problem, except that the patch was not applied exactly where it was told to do, but it did, and probably did it correctly. If all you got was this kind of messages, go ahead and compile the program, the application of the patch was successful.
In the case of the second message, the application of the patch failed. This can occur because the patch
program assumed that you were trying to apply the patch over clean source
and you had applied a patch before, therefore not making the source clean.
Do not try to compile the program, it will probably not compile and even
if it does it won't work. Contact me and let me know which hunk failed in
which file. Also let me know which patches you had applied before or send
me a copy of the file you were trying to patch. In any case you may want to reverse the patch.
See also:
What is a hunk?
What is reversing a patch?
You need to build Pine and replace the old version of Pine by the new
one that you created. You can also simply make an alias so that the command
Pine will point to the location of the new version of Pine.
See also:
Instructions on Building Pine
There is some terminology which you will find in all the patches in this page,
this is the typical way a patch looks like
*** pine4.20/pico/msmenu.h Fri Feb 27 16:10:30 1998
--- pine4.20.subject/pico/msmenu.h Tue Nov 16 01:10:00 1999
***************
*** 94,101 ****
#define KS_SELECTCUR 196
#define KS_UNDO 197
#define KS_SPELLCHK 198
! #define KS_RANGEEND 198
#define KS_COUNT ((KS_RANGEEND - KS_RANGESTART) + 1)
--- 94,103 ----
#define KS_SELECTCUR 196
#define KS_UNDO 197
#define KS_SPELLCHK 198
+ #define KS_BIGSUBJ 199
+ #define KS_SMALLSUBJ 200
! #define KS_RANGEEND 200
#define KS_COUNT ((KS_RANGEEND - KS_RANGESTART) + 1)
The first line indicates the file being patched: pine4.20/pine/msmenu.h, it is symbolized by the sign ***, the file used to patch is called pine4.20.subject/pico/msmenu.h and it is symbolized by the string ---.
Then you find the string *************** to indicate the beginning of a hunk. Below that you find the symbol *** to indicate the file to be patched, in this case it begins in line 94 and end in line 101. On the other hand the file that contains the patch is signaled below by the --- string and lines 94 to 103 will be used to patch.
The string "! " in the beginning of a line is indicative that a change was done only to that line and no other line is affected by this change. In this case you can see the value of KS_RANGEEND was changed from 198 to 200.
The string "+ " in the beginning of a line indicates that a new line
containing the code after this string need to be added at that position in
the code. Two lines were added, which explains the change from 198 to 200.
You should reverse a patch in the same way you applied it but adding the -R option, so let's say you applied the patch using the command
then in order to reverse it you have to execute the command
See also:
What is reversing a patch?