PATCH(1) BSD General Commands Manual PATCH(1) NAME patch — apply a diff file to an original SYNOPSIS patch [-bCcEeflNnRstuv] [-B backup-prefix] [-D symbol] [-d directory] [-F max-fuzz] [-i patchfile] [-o out-file] [-p strip-count] [-r rej-name] [-V t | nil | never] [-x number] [-z backup-ext] [--posix] [origfile [patchfile]] patch 1 An error occurred. When applying a set of patches in a loop it behooves you to check this exit status so you do not apply a later patch to a partially patched file. DIAGNOSTICS Too many to list here, but generally indicative that patch couldn't parse your patch file. The message "Hmm..." indicates that there is unprocessed text in the patch file and that patch is attempting to intuit whether there is a patch in that text and, if so, what kind of patch it is. SEE ALSO diff(1) STANDARDS The patch utility is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”) specification, except as detailed above for the --posix option. The flags [-BCEFfstVvxz] and [--posix] are extensions to that specifica‐ tion. AUTHORS Larry Wall with many other contributors. CAVEATS 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. BUGS Could be smarter about partial matches, excessively deviant offsets and swapped code, but that would take an extra pass. Check patch mode (-C) will fail if you try to check several patches in succession that build on each other. The entire patch code would have to be restructured to keep temporary files around so that it can handle this situation. If code has been duplicated (for instance with #ifdef OLDCODE ... #else ... #endif), patch is incapable of patching both versions, and, if it works at all, will likely patch the wrong one, and tell you that it suc‐ ceeded to boot. If you apply a patch 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. BSD June 15, 2014 BSD