| Comparing and Merging Files with GNU diff and patch by David MacKenzie, Paul Eggert, and Richard Stallman Paperback (6"x9"), 120 pages ISBN 0954161750 RRP £12.95 ($19.95) "Well packaged... the quality of information is excellent" --- Linux User and Developer Magazine (Issue 36, Feb 2004) Get a printed copy>>> |
10.5 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.
The -Z or --set-utc option causes patch to
set a patched file's modification and access times to the time stamps
given in context diff headers. If the context diff headers do not
specify a time zone, they are assumed to use Coordinated Universal
Time (UTC, often known as GMT).
The -T or --set-time option acts like -Z or
--set-utc, except that it assumes that the context diff
headers' time stamps use local time instead of UTC. This option
is not recommended, because patches using local time cannot easily be
used by people in other time zones, and because local time stamps are
ambiguous when local clocks move backwards during daylight-saving time
adjustments. If the context diff headers specify a time zone, this
option is equivalent to -Z or --set-utc.
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.
| ISBN 0954161750 | Comparing and Merging Files with GNU diff and patch | See the print edition |