10.3 Applying Imperfect Patches

patch tries to skip any leading text in the patch file, apply the diff, and then skip any trailing text. Thus you can feed a mail message directly to patch, and it should work. If the entire diff is indented by a constant amount of white space, patch automatically ignores the indentation. If a context diff contains trailing carriage return on each line, patch automatically ignores the carriage return. If a context diff has been encapsulated by prepending ‘ to lines beginning with ‘-’ as per Internet RFC 934, patch automatically unencapsulates the input.

However, certain other types of imperfect input require user intervention or testing.