* Emacs 29 and Tramp and Remote Dired confusion
@ 2023-07-07 12:14 Bill Benedetto
2023-07-07 12:39 ` Michael Albinus
2023-07-07 13:05 ` Eli Zaretskii
0 siblings, 2 replies; 10+ messages in thread
From: Bill Benedetto @ 2023-07-07 12:14 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
Good day.
I'm confused about what I'm seeing in Emacs 29.
Heretofore, when I copied a file in a remote dired, it would keep the same timestamp.
AFAIK, that's always worked and always been the default.
However, that is not the default in Emacs 29.
When I copy a file, it copies it with the current timestamp instead of the original.
I'm an admin and do this stuff all day.
This is a deal breaker for me.
I've nosed around and didn't see anything in the NEWS about a change like that.
And I've tried to figure out what variable I need to (re)set to get the old behavior back, but haven't found it yet.
I'm using emacs 29.0.92 (but I saw the same result in the previous two pretests).
Can someone shed some light on this for me?
Thanks!
- Bill
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
Bill Benedetto bbenedetto@goodyear.com<mailto:bbenedetto@goodyear.com> The Goodyear Tire & Rubber Co.
I don't speak for Goodyear and they don't speak for me. We're both happy.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Emacs 29 and Tramp and Remote Dired confusion
2023-07-07 12:14 Emacs 29 and Tramp and Remote Dired confusion Bill Benedetto
@ 2023-07-07 12:39 ` Michael Albinus
2023-07-07 12:58 ` [EXT] " Bill Benedetto
2023-07-07 13:05 ` Eli Zaretskii
1 sibling, 1 reply; 10+ messages in thread
From: Michael Albinus @ 2023-07-07 12:39 UTC (permalink / raw)
To: Bill Benedetto; +Cc: help-gnu-emacs@gnu.org
Bill Benedetto <bbenedetto@goodyear.com> writes:
> Good day.
Hi Bill,
> I'm confused about what I'm seeing in Emacs 29.
>
> Heretofore, when I copied a file in a remote dired, it would keep the same timestamp.
> AFAIK, that's always worked and always been the default.
>
> However, that is not the default in Emacs 29.
> When I copy a file, it copies it with the current timestamp instead of the original.
>
> I'm an admin and do this stuff all day.
> This is a deal breaker for me.
>
> I've nosed around and didn't see anything in the NEWS about a change like that.
> And I've tried to figure out what variable I need to (re)set to get the old behavior back, but haven't found it yet.
>
> I'm using emacs 29.0.92 (but I saw the same result in the previous two pretests).
>
> Can someone shed some light on this for me?
I cannot reproduce it here. Scenario, using a recent build of Emacs 29:
# ~/src/emacs-29/src/emacs ~/
;; There is a file ccc, which is from last year. Dired shows it like
--8<---------------cut here---------------start------------->8---
-rw-rw-r--. 1 albinus albinus 173 Jun 22 2022 ccc
--8<---------------cut here---------------end--------------->8---
;; I type "C", and give as remote target "/ssh:anotherhost:/tmp"
;; It is copied to the remote host, where it didn't exist before.
;; Then I type "C-x C-f /ssh:anotherhost:/tmp", and I see there
--8<---------------cut here---------------start------------->8---
-rw-rw-r-- 1 albinus albinus 173 Jun 22 2022 ccc
--8<---------------cut here---------------end--------------->8---
Could you pls give me your recipe when it fails?
> Thanks!
>
> - Bill
Best regards, Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [EXT] Re: Emacs 29 and Tramp and Remote Dired confusion
2023-07-07 12:39 ` Michael Albinus
@ 2023-07-07 12:58 ` Bill Benedetto
2023-07-07 13:10 ` Eli Zaretskii
2023-07-07 17:30 ` [EXT] " Michael Albinus
0 siblings, 2 replies; 10+ messages in thread
From: Bill Benedetto @ 2023-07-07 12:58 UTC (permalink / raw)
To: Michael Albinus; +Cc: help-gnu-emacs@gnu.org
Hello, Michael.
Sorry I wasn't clearer.
If I do like you said, copy from a remote to a local dired, it does retain the timestamp.
And if I copy from a remote to a different remote dired, the timestamp is still retained.
But if I copy within the same remote dired to a new name within that same remote dired, the timestamp changes.
(Like to make a backup copy of the original file.)
It used to keep the original timestamp in earlier emacs/tramps.
Thanks!
-Bill
-----Original Message-----
From: Michael Albinus <michael.albinus@gmx.de>
Sent: Friday, July 7, 2023 8:39 AM
To: Bill Benedetto <bbenedetto@goodyear.com>
Cc: help-gnu-emacs@gnu.org
Subject: [EXT] Re: Emacs 29 and Tramp and Remote Dired confusion
WARNING: This is an EXTERNAL email. THINK before you open attachments, click links or respond. USE the Outlook button to REPORT suspicious email.
Bill Benedetto <bbenedetto@goodyear.com> writes:
> Good day.
Hi Bill,
> I'm confused about what I'm seeing in Emacs 29.
>
> Heretofore, when I copied a file in a remote dired, it would keep the same timestamp.
> AFAIK, that's always worked and always been the default.
>
> However, that is not the default in Emacs 29.
> When I copy a file, it copies it with the current timestamp instead of the original.
>
> I'm an admin and do this stuff all day.
> This is a deal breaker for me.
>
> I've nosed around and didn't see anything in the NEWS about a change like that.
> And I've tried to figure out what variable I need to (re)set to get the old behavior back, but haven't found it yet.
>
> I'm using emacs 29.0.92 (but I saw the same result in the previous two pretests).
>
> Can someone shed some light on this for me?
I cannot reproduce it here. Scenario, using a recent build of Emacs 29:
# ~/src/emacs-29/src/emacs ~/
;; There is a file ccc, which is from last year. Dired shows it like
--8<---------------cut here---------------start------------->8---
-rw-rw-r--. 1 albinus albinus 173 Jun 22 2022 ccc
--8<---------------cut here---------------end--------------->8---
;; I type "C", and give as remote target "/ssh:anotherhost:/tmp"
;; It is copied to the remote host, where it didn't exist before.
;; Then I type "C-x C-f /ssh:anotherhost:/tmp", and I see there
--8<---------------cut here---------------start------------->8---
-rw-rw-r-- 1 albinus albinus 173 Jun 22 2022 ccc
--8<---------------cut here---------------end--------------->8---
Could you pls give me your recipe when it fails?
> Thanks!
>
> - Bill
Best regards, Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Emacs 29 and Tramp and Remote Dired confusion
2023-07-07 12:14 Emacs 29 and Tramp and Remote Dired confusion Bill Benedetto
2023-07-07 12:39 ` Michael Albinus
@ 2023-07-07 13:05 ` Eli Zaretskii
1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2023-07-07 13:05 UTC (permalink / raw)
To: help-gnu-emacs
> From: Bill Benedetto <bbenedetto@goodyear.com>
> Date: Fri, 7 Jul 2023 12:14:37 +0000
>
> I'm confused about what I'm seeing in Emacs 29.
>
> Heretofore, when I copied a file in a remote dired, it would keep the same timestamp.
> AFAIK, that's always worked and always been the default.
>
> However, that is not the default in Emacs 29.
> When I copy a file, it copies it with the current timestamp instead of the original.
Is your value of dired-copy-preserve-time nil per chance? It's t by
default.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [EXT] Re: Emacs 29 and Tramp and Remote Dired confusion
2023-07-07 12:58 ` [EXT] " Bill Benedetto
@ 2023-07-07 13:10 ` Eli Zaretskii
2023-07-07 14:42 ` Bill Benedetto
2023-07-07 17:30 ` [EXT] " Michael Albinus
1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2023-07-07 13:10 UTC (permalink / raw)
To: help-gnu-emacs
> From: Bill Benedetto <bbenedetto@goodyear.com>
> CC: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
> Date: Fri, 7 Jul 2023 12:58:55 +0000
>
> If I do like you said, copy from a remote to a local dired, it does retain the timestamp.
> And if I copy from a remote to a different remote dired, the timestamp is still retained.
>
> But if I copy within the same remote dired to a new name within that same remote dired, the timestamp changes.
> (Like to make a backup copy of the original file.)
What do you mean by "that same remote dired"? What is "the same" in
this case?
How about showing a complete recipe, starting from "emacs -Q" and
showing all the commands and key sequences you type to reproduce the
problem?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Emacs 29 and Tramp and Remote Dired confusion
2023-07-07 13:10 ` Eli Zaretskii
@ 2023-07-07 14:42 ` Bill Benedetto
0 siblings, 0 replies; 10+ messages in thread
From: Bill Benedetto @ 2023-07-07 14:42 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
Great idea!
Remembering that this is emacs 29.
1. emacs -Q
2. C-x C-f
3. /ssh:me@remotemachine:.
4. C-x 1
5. C (dired-do-copy)
6. type a new name for the target file and hit <return>
The new file will have the current timestamp instead of the original timestamp.
In previous versions of emacs/tramp, it would have the original timestamp.
I also checked dired-copy-preserve-time and it is t in both versions that I am testing (28 and 29 pretest 29.0.92)
Is this any clearer?
-Bill
-----Original Message-----
From: help-gnu-emacs-bounces+bbenedetto=goodyear.com@gnu.org <help-gnu-emacs-bounces+bbenedetto=goodyear.com@gnu.org> On Behalf Of Eli Zaretskii
Sent: Friday, July 7, 2023 9:11 AM
To: help-gnu-emacs@gnu.org
Subject: Re: [EXT] Re: Emacs 29 and Tramp and Remote Dired confusion
> From: Bill Benedetto <bbenedetto@goodyear.com>
> CC: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
> Date: Fri, 7 Jul 2023 12:58:55 +0000
>
> If I do like you said, copy from a remote to a local dired, it does retain the timestamp.
> And if I copy from a remote to a different remote dired, the timestamp is still retained.
>
> But if I copy within the same remote dired to a new name within that same remote dired, the timestamp changes.
> (Like to make a backup copy of the original file.)
What do you mean by "that same remote dired"? What is "the same" in this case?
How about showing a complete recipe, starting from "emacs -Q" and showing all the commands and key sequences you type to reproduce the problem?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [EXT] Re: Emacs 29 and Tramp and Remote Dired confusion
2023-07-07 12:58 ` [EXT] " Bill Benedetto
2023-07-07 13:10 ` Eli Zaretskii
@ 2023-07-07 17:30 ` Michael Albinus
2023-07-07 17:57 ` Bill Benedetto
1 sibling, 1 reply; 10+ messages in thread
From: Michael Albinus @ 2023-07-07 17:30 UTC (permalink / raw)
To: Bill Benedetto; +Cc: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 515 bytes --]
Bill Benedetto <bbenedetto@goodyear.com> writes:
> Hello, Michael.
Hi Bill,
> But if I copy within the same remote dired to a new name within that same remote dired, the timestamp changes.
> (Like to make a backup copy of the original file.)
I can reproduce this. And indeed, there is an error in Tramp, a stale
cache. Could you pls test the appended patch?
I'll give it more testing over the weekend, before I push it to the
emacs-29 branch.
> Thanks!
>
> -Bill
Best regards, Michael.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 6073 bytes --]
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 48ba3d09e3e..cb5907e98a1 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2061,7 +2061,11 @@ tramp-do-copy-or-rename-file
(t2 (tramp-tramp-file-p newname))
(length (file-attribute-size
(file-attributes (file-truename filename))))
- (msg-operation (if (eq op 'copy) "Copying" "Renaming")))
+ (file-times (file-attribute-modification-time
+ (file-attributes filename)))
+ (file-modes (tramp-default-file-modes filename))
+ (msg-operation (if (eq op 'copy) "Copying" "Renaming"))
+ copy-keep-date)
(with-parsed-tramp-file-name (if t1 filename newname) nil
(unless length
@@ -2094,6 +2098,8 @@ tramp-do-copy-or-rename-file
((and
(tramp-method-out-of-band-p v1 length)
(tramp-method-out-of-band-p v2 length))
+ (setq copy-keep-date
+ (tramp-get-method-parameter v 'tramp-copy-keep-date))
(tramp-do-copy-or-rename-file-out-of-band
op filename newname ok-if-already-exists keep-date))
@@ -2122,6 +2128,8 @@ tramp-do-copy-or-rename-file
;; If the Tramp file has an out-of-band method, the
;; corresponding copy-program can be invoked.
((tramp-method-out-of-band-p v length)
+ (setq copy-keep-date
+ (tramp-get-method-parameter v 'tramp-copy-keep-date))
(tramp-do-copy-or-rename-file-out-of-band
op filename newname ok-if-already-exists keep-date))
@@ -2149,10 +2157,19 @@ tramp-do-copy-or-rename-file
;; When newname did exist, we have wrong cached values.
(when t2
(with-parsed-tramp-file-name newname v2
- (tramp-flush-file-properties v2 v2-localname)))))))))
+ (tramp-flush-file-properties v2 v2-localname)))
+
+ ;; KEEP-DATE handling.
+ (when (and keep-date (not copy-keep-date))
+ (tramp-compat-set-file-times
+ newname file-times (unless ok-if-already-exists 'nofollow)))
+
+ ;; Set the mode.
+ (unless (and keep-date copy-keep-date)
+ (set-file-modes newname file-modes))))))))
(defun tramp-do-copy-or-rename-file-via-buffer
- (op filename newname ok-if-already-exists keep-date)
+ (op filename newname _ok-if-already-exists _keep-date)
"Use an Emacs buffer to copy or rename a file.
First arg OP is either `copy' or `rename' and indicates the operation.
FILENAME is the source file, NEWNAME the target file.
@@ -2179,14 +2196,7 @@ tramp-do-copy-or-rename-file-via-buffer
(with-temp-file newname
(set-buffer-multibyte nil)
(insert-file-contents-literally filename)))
- ;; KEEP-DATE handling.
- (when keep-date
- (tramp-compat-set-file-times
- newname
- (file-attribute-modification-time (file-attributes filename))
- (unless ok-if-already-exists 'nofollow)))
- ;; Set the mode.
- (set-file-modes newname (tramp-default-file-modes filename))
+
;; If the operation was `rename', delete the original file.
(unless (eq op 'copy) (delete-file filename)))
@@ -2202,10 +2212,7 @@ tramp-do-copy-or-rename-file-directly
the uid and gid from FILENAME."
;; FILENAME and NEWNAME are already expanded.
(let ((t1 (tramp-tramp-file-p filename))
- (t2 (tramp-tramp-file-p newname))
- (file-times (file-attribute-modification-time
- (file-attributes filename)))
- (file-modes (tramp-default-file-modes filename)))
+ (t2 (tramp-tramp-file-p newname)))
(with-parsed-tramp-file-name (if t1 filename newname) nil
(let* ((cmd (cond ((and (eq op 'copy) preserve-uid-gid) "cp -f -p")
((eq op 'copy) "cp -f")
@@ -2336,14 +2343,7 @@ tramp-do-copy-or-rename-file-directly
(list tmpfile localname2 ok-if-already-exists)))))
;; Save exit.
- (ignore-errors (delete-file tmpfile)))))))))
-
- ;; Set the time and mode. Mask possible errors.
- (ignore-errors
- (when keep-date
- (tramp-compat-set-file-times
- newname file-times (unless ok-if-already-exists 'nofollow))
- (set-file-modes newname file-modes))))))
+ (ignore-errors (delete-file tmpfile))))))))))))
(defun tramp-do-copy-or-rename-file-out-of-band
(op filename newname ok-if-already-exists keep-date)
@@ -2355,7 +2355,7 @@ tramp-do-copy-or-rename-file-out-of-band
(v2 (and (tramp-tramp-file-p newname)
(tramp-dissect-file-name newname)))
(v (or v1 v2))
- copy-program copy-args copy-env copy-keep-date listener spec
+ copy-program copy-args copy-env listener spec
options source target remote-copy-program remote-copy-args p)
(if (and v1 v2 (zerop (length (tramp-scp-direct-remote-copying v1 v2))))
@@ -2427,8 +2427,6 @@ tramp-do-copy-or-rename-file-out-of-band
?y (tramp-scp-force-scp-protocol v)
?z (tramp-scp-direct-remote-copying v1 v2))
copy-program (tramp-get-method-parameter v 'tramp-copy-program)
- copy-keep-date (tramp-get-method-parameter
- v 'tramp-copy-keep-date)
copy-args
;; " " has either been a replacement of "%k" (when
;; keep-date argument is non-nil), or a replacement for
@@ -2536,19 +2534,7 @@ tramp-do-copy-or-rename-file-out-of-band
;; Houston, we have a problem! Likely, the listener is
;; still running, so let's clear everything (but the
;; cached password).
- (tramp-cleanup-connection v 'keep-debug 'keep-password))))
-
- ;; Handle KEEP-DATE argument.
- (when (and keep-date (not copy-keep-date))
- (tramp-compat-set-file-times
- newname
- (file-attribute-modification-time (file-attributes filename))
- (unless ok-if-already-exists 'nofollow)))
-
- ;; Set the mode.
- (unless (and keep-date copy-keep-date)
- (ignore-errors
- (set-file-modes newname (tramp-default-file-modes filename)))))
+ (tramp-cleanup-connection v 'keep-debug 'keep-password)))))
;; If the operation was `rename', delete the original file.
(unless (eq op 'copy)
^ permalink raw reply related [flat|nested] 10+ messages in thread
* RE: [EXT] Re: Emacs 29 and Tramp and Remote Dired confusion
2023-07-07 17:30 ` [EXT] " Michael Albinus
@ 2023-07-07 17:57 ` Bill Benedetto
2023-07-08 13:50 ` Michael Albinus
0 siblings, 1 reply; 10+ messages in thread
From: Bill Benedetto @ 2023-07-07 17:57 UTC (permalink / raw)
To: Michael Albinus; +Cc: help-gnu-emacs@gnu.org
This patch does indeed fix the problem!
Thanks, Michael!
-Bill
-----Original Message-----
From: Michael Albinus <michael.albinus@gmx.de>
Sent: Friday, July 7, 2023 1:30 PM
To: Bill Benedetto <bbenedetto@goodyear.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: [EXT] Re: Emacs 29 and Tramp and Remote Dired confusion
Bill Benedetto <bbenedetto@goodyear.com> writes:
> Hello, Michael.
Hi Bill,
> But if I copy within the same remote dired to a new name within that same remote dired, the timestamp changes.
> (Like to make a backup copy of the original file.)
I can reproduce this. And indeed, there is an error in Tramp, a stale cache. Could you pls test the appended patch?
I'll give it more testing over the weekend, before I push it to the
emacs-29 branch.
> Thanks!
>
> -Bill
Best regards, Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [EXT] Re: Emacs 29 and Tramp and Remote Dired confusion
2023-07-07 17:57 ` Bill Benedetto
@ 2023-07-08 13:50 ` Michael Albinus
2023-07-10 11:23 ` Bill Benedetto
0 siblings, 1 reply; 10+ messages in thread
From: Michael Albinus @ 2023-07-08 13:50 UTC (permalink / raw)
To: Bill Benedetto; +Cc: help-gnu-emacs@gnu.org
[-- Attachment #1: Type: text/plain, Size: 449 bytes --]
Bill Benedetto <bbenedetto@goodyear.com> writes:
Hi Bill,
> This patch does indeed fix the problem!
Thanks for the feedback.
However, running the regression tests, the patch becomes more
complex. So I've decided to push to the emacs-29 branch just a
minimalistic patch, which fixes your use case. See appended.
The full patch will go to the Emacs master branch only, which becomes
Emacs 30.
> -Bill
Best regards, Michael.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 565 bytes --]
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 48ba3d09e3e..502040902e1 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2338,6 +2338,11 @@ tramp-do-copy-or-rename-file-directly
;; Save exit.
(ignore-errors (delete-file tmpfile)))))))))
+ ;; When newname did exist, we have wrong cached values.
+ (when t2
+ (with-parsed-tramp-file-name newname v2
+ (tramp-flush-file-properties v2 v2-localname)))
+
;; Set the time and mode. Mask possible errors.
(ignore-errors
(when keep-date
^ permalink raw reply related [flat|nested] 10+ messages in thread
* RE: [EXT] Re: Emacs 29 and Tramp and Remote Dired confusion
2023-07-08 13:50 ` Michael Albinus
@ 2023-07-10 11:23 ` Bill Benedetto
0 siblings, 0 replies; 10+ messages in thread
From: Bill Benedetto @ 2023-07-10 11:23 UTC (permalink / raw)
To: Michael Albinus; +Cc: help-gnu-emacs@gnu.org
This minimalistic patch ALSO fixes my problem.
Thank-you, Michael!
-Bill
-----Original Message-----
From: Michael Albinus <michael.albinus@gmx.de>
Sent: Saturday, July 8, 2023 9:50 AM
To: Bill Benedetto <bbenedetto@goodyear.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: [EXT] Re: Emacs 29 and Tramp and Remote Dired confusion
Bill Benedetto <bbenedetto@goodyear.com> writes:
Hi Bill,
> This patch does indeed fix the problem!
Thanks for the feedback.
However, running the regression tests, the patch becomes more complex. So I've decided to push to the emacs-29 branch just a minimalistic patch, which fixes your use case. See appended.
The full patch will go to the Emacs master branch only, which becomes Emacs 30.
> -Bill
Best regards, Michael.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-07-10 11:23 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-07 12:14 Emacs 29 and Tramp and Remote Dired confusion Bill Benedetto
2023-07-07 12:39 ` Michael Albinus
2023-07-07 12:58 ` [EXT] " Bill Benedetto
2023-07-07 13:10 ` Eli Zaretskii
2023-07-07 14:42 ` Bill Benedetto
2023-07-07 17:30 ` [EXT] " Michael Albinus
2023-07-07 17:57 ` Bill Benedetto
2023-07-08 13:50 ` Michael Albinus
2023-07-10 11:23 ` Bill Benedetto
2023-07-07 13:05 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).