[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#58842: 29.0.50/tramp; copy-file KEEP-TIME gives the target earlier t
From: |
Michael Albinus |
Subject: |
bug#58842: 29.0.50/tramp; copy-file KEEP-TIME gives the target earlier time |
Date: |
Sun, 30 Oct 2022 16:42:21 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Sam Steingold <sds@gnu.org> writes:
Hi Sam,
> One property of `copy-file' that I came to expect is:
>
> (copy-file src dst ...) is successful
> ==>
> (file-newer-than-file-p src dst) is false
>
> This ensures that the same file is not copied over and over.
>
> Alas, this does not hold in the following corner case:
>
> 1. src is local on mac
> 2. dst is remote on linux
> 3. KEEP-TIME is passed to `copy-file'
>
> In this case, after `(copy-file src dst t t)`,
>
> (file-attribute-modification-time (file-attributes dst))
> => (25435 65247 0 0)
> (file-attribute-modification-time (file-attributes src))
> => (25435 65247 279367 729000)
>
> I understand this is bad behavior is covered by the `copy-file' doc
>
> Fourth arg KEEP-TIME non-nil means give the output file the same
> last-modified time as the old one. (This works on only some systems.)
>
> but it would seem to be relatively easy to fix by rounding _up_ the time
> before calling the tramp handler for `set-file-times'.
Well, another fix would be to teach file-newer-than-file-p to use only
seconds w/o fractions. Does the appended patch works for you?
> Thank you.
Best regards, Michael.
txtOHNVJCxNdS.txt
Description: Text Data