<p>I tested <code>patch -Z</code> on my local using this repository's README file.</p>
<p>I created below 2 files based on a result of <code>diff -u</code>.<br>
I expected the patched file is updated as fixed value.<br>
But actually on below cases, it is updated as system date even when using <code>patch -Z</code>.<br>
Just implementing <code>patch -Z</code> option is not enough.<br>
Because I always want to see the patched file is updated as fixed date when using the option.</p>
<pre><code>$ rpm -q patch
patch-2.7.6-9.fc30.x86_64

$ patch -v | head -1
GNU patch 2.7.6
</code></pre>
<h2>diff file with date header</h2>
<pre><code>$ cat readme.diff 
--- a/README    2019-07-11 16:33:14.340372704 +0200
+++ b/README    2019-07-12 16:00:00.684469239 +0200
@@ -1,3 +1,4 @@
+aaa
 This is RPM, the RPM Package Manager.
 
 The latest releases are always available at:
</code></pre>
<pre><code>$ touch -d 20190101 README 

$ ls -l README 
-rw-rw-r-- 1 jaruga jaruga 603 Jan  1  2019 README

$ patch -p1 -Z < readme.diff 
patching file README
Not setting time of file README (time mismatch)

$ ls -l README 
-rw-rw-r-- 1 jaruga jaruga 607 Jul 12 16:58 README
</code></pre>
<p><code>README</code> is updated as system date (Jul 12 16:58).</p>
<p>"Not setting time of file README (time mismatch)" message is here.<br>
<a href="https://github.com/mirror/patch/blob/v2.7.6/src/patch.c#L581-L583">https://github.com/mirror/patch/blob/v2.7.6/src/patch.c#L581-L583</a></p>
<h2>diff file without date header</h2>
<pre><code>$ cat readme2.diff 
--- a/README
+++ b/README
@@ -1,3 +1,4 @@
+aaa
 This is RPM, the RPM Package Manager.
 
 The latest releases are always available at:
</code></pre>
<pre><code>$ touch -d 20190101 README 

$ ls -l README 
-rw-rw-r-- 1 jaruga jaruga 603 Jan  1  2019 README

$ patch -p1 -Z < readme2.diff 
patching file README

$ ls -l README 
-rw-rw-r-- 1 jaruga jaruga 607 Jul 12 17:03 README
</code></pre>
<p><code>README</code> is updated as system date (Jul 12 17:03).</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/rpm-software-management/rpm/issues/788?email_source=notifications&email_token=ADLPZU4AFUAO642BLSJLGI3P7CNEHA5CNFSM4H7REH7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ2A75Q#issuecomment-510922742">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ADLPZU2OSPXPQAUPLU6GDKTP7CNEHANCNFSM4H7REH7A">mute the thread</a>.<img src="https://github.com/notifications/beacon/ADLPZU6CIEEK72Q2U7REV3LP7CNEHA5CNFSM4H7REH7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ2A75Q.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/rpm-software-management/rpm/issues/788?email_source=notifications\u0026email_token=ADLPZU4AFUAO642BLSJLGI3P7CNEHA5CNFSM4H7REH7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ2A75Q#issuecomment-510922742",
"url": "https://github.com/rpm-software-management/rpm/issues/788?email_source=notifications\u0026email_token=ADLPZU4AFUAO642BLSJLGI3P7CNEHA5CNFSM4H7REH7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ2A75Q#issuecomment-510922742",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>