The POSIX standard specifies behavior that differs from GNU patch.

  • In POSIX patch when -b is not used, backups are not made even when there is a mismatch. In GNU patch, this behavior is enabled with the --no-backup-if-mismatch option, or by conforming to POSIX with the --posix option or by setting the POSIXLY_CORRECT environment variable.
  • When intuiting the name of the file to be patched from the patch header, patch uses a complicated method that is optionally POSIX-conforming. The method is equivalent to POSIX if the file names in the context diff header and the Index: line are all identical after prefix-stripping. Your patch is normally compatible if each header's file names all contain the same number of slashes.
  • Limit yourself to the following options when sending instructions meant to be executed by anyone running GNU patch or a patch that conforms to POSIX. Spaces are optional in the following list.


    -b -c -d dir -D define -e -i patchfile -l -n -N -o outfile -p num -R -r rejectfile -u