I tested `patch -Z` on my local using this repository's README file.
I created below 2 files based on a result of `diff -u`.
I expected the patched file is updated as fixed value.
But actually on below cases, it is updated as system date even when using
`patch -Z`.
Just implementing `patch -Z` option is not enough.
Because I always want to see the patched file is updated as fixed date when
using the option.
```
$ rpm -q patch
patch-2.7.6-9.fc30.x86_64
$ patch -v | head -1
GNU patch 2.7.6
```
## diff file with date header
```
$ 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:
```
```
$ 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
```
`README` is updated as system date (Jul 12 16:58).
"Not setting time of file README (time mismatch)" message is here.
https://github.com/mirror/patch/blob/v2.7.6/src/patch.c#L581-L583
## diff file without date header
```
$ 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:
```
```
$ 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
```
`README` is updated as system date (Jul 12 17:03).
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/788#issuecomment-510922742
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint