Node:Patching Time Stamps, Next:, Up:Merging with patch



Updating Time Stamps on Patched Files

When patch updates a file, it normally sets the file's last-modified time stamp to the current time of day. If you are using patch to track a software distribution, this can cause make to incorrectly conclude that a patched file is out of date. For example, if syntax.c depends on syntax.y, and patch updates syntax.c and then syntax.y, then syntax.c will normally appear to be out of date with respect to syntax.y even though its contents are actually up to date.

patch normally refrains from setting a file's time stamps if the file's original last-modified time stamp does not match the time given in the diff header, of if the file's contents do not exactly match the patch. However, if the -f or --force option is given, the file's time stamps are set regardless.

Due to the limitations of the current diff format, patch cannot update the times of files whose contents have not changed. Also, if you set file time stamps to values other than the current time of day, you should also remove (e.g., with make clean) all files that depend on the patched files, so that later invocations of make do not get confused by the patched files' times.