HP-UX Reference (11i v3 07/02) - 1 User Commands N-Z (vol 2)
p
patch(1) patch(1)
1 One or more lines were written to a reject file.
>1 An error occurred.
For the non-UNIX Standard version, exit values vary as follows:
0 Successful completion or one or more lines were written to a reject file.
1 An error occurred.
DIAGNOSTICS
Most error messages indicate that patch could not parse your patch file.
The message Hmm... indicates that there is unprocessed text in the patch file and that
patch is attempt-
ing to intuit whether there is a patch in that text and, if so, what kind of patch it is.
Note that only few diagnostic messages are printed for the UNIX Standard version, because it does not sup-
port the verbose option.
WARNINGS
patch cannot tell if the line numbers are off in an ed script, and can only detect bad line numbers in a
normal diff when it finds a change or a delete command. A context diff using fuzz factor 3 may have the
same problem. Until a suitable interactive interface is added, you should probably do a context diff in these
cases to see if the changes made sense. Of course, compiling without errors is a pretty good indication that
the patch worked, but not always.
patch usually produces the correct results, even when it has to do a lot of guessing. However, the results
are guaranteed to be correct only when the patch is applied to exactly the same version of the file that the
patch was generated from.
The result obtained from the UNIX Standard options -c, -e, and -n
, which force the patch command to
interpret the diff file either as a context diff or as an
ed
script or as a normal diff respectively, is
unspecified. For example, if one forces the patch command to treat the context diff file as an
ed script, the
result is unspecified. The same is true if one forces patch to treat an
ed script as a context file and so on..
When a diff is forced with the above options, the diff file is searched for patterns that are specific to that
type of diff file. If the diff file is not what was specified by the option, the file is checked for
ed commands.
If
ed commands are present in the diff file, then the file is assumed to be an
ed_diff file and the patch
proceeds.
patch could be smarter about partial matches, excessively deviant offsets and swapped code, but that
would take an extra pass.
If code has been duplicated (for instance with #ifdef OLDCODE...#else...#endif), patch
is incapa-
ble of patching both versions, and, if it works at all, will likely patch the wrong one, and tell you that it suc-
ceeded.
If you apply a patch that you have already applied,
patch will think it is a reversed patch, and offer to
un-apply the patch. This could be construed as a feature.
UNIX Standard version: If you are using multiple patches for different files, group patches that have to be
applied to a single file. Otherwise, intermediate versions of the previous patches of a file will not be used
for the current patch.
FILES
/var/tmp/patch*
SEE ALSO
diff(1), ed(1), standards(5).
STANDARDS CONFORMANCE
patch: XPG4
98 Hewlett-Packard Company − 4 − HP-UX 11i Version 3: February 2007