all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#31941: 26.1; Moving directory on remote host via tramp scp always performs copy
@ 2018-06-22 19:33 Stephen Nutt
  2018-06-24  8:31 ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Nutt @ 2018-06-22 19:33 UTC (permalink / raw)
  To: 31941

In Emacs 26, when moving a directory within a remote host over Tramp
using the scp method (e.g. with dired-do-rename or mv in eshell), a copy
and delete are always performed, even when a much simpler mv would
suffice. The behavior is the same when running emacs with -q or with
emacs built from master. This is a regression from the behavior in 25.3.

I think I've isolated the change to the commit b500e0 where the
following was added at the beginning of `tramp-do-copy-or-rename-file'
in tramp-sh.el to explicitly call `copy-directory'.

  (if (file-directory-p filename)
      (progn
	(copy-directory filename newname keep-date t)
	(when (eq op 'rename) (delete-directory filename 'recursive)))

I think the conditional should also check if op is a rename and if the
remote of filename and newname are the same, in which case the normal
behavior of the function should proceed which should result in a mv
command.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#31941: 26.1; Moving directory on remote host via tramp scp always performs copy
  2018-06-22 19:33 bug#31941: 26.1; Moving directory on remote host via tramp scp always performs copy Stephen Nutt
@ 2018-06-24  8:31 ` Michael Albinus
  2018-06-24 12:06   ` Stephen Nutt
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2018-06-24  8:31 UTC (permalink / raw)
  To: Stephen Nutt; +Cc: 31941

[-- Attachment #1: Type: text/plain, Size: 1293 bytes --]

Stephen Nutt <stnutt@gmail.com> writes:

Hi Stephen,

> In Emacs 26, when moving a directory within a remote host over Tramp
> using the scp method (e.g. with dired-do-rename or mv in eshell), a copy
> and delete are always performed, even when a much simpler mv would
> suffice. The behavior is the same when running emacs with -q or with
> emacs built from master. This is a regression from the behavior in 25.3.
>
> I think I've isolated the change to the commit b500e0 where the
> following was added at the beginning of `tramp-do-copy-or-rename-file'
> in tramp-sh.el to explicitly call `copy-directory'.
>
>   (if (file-directory-p filename)
>       (progn
> 	(copy-directory filename newname keep-date t)
> 	(when (eq op 'rename) (delete-directory filename 'recursive)))
>
> I think the conditional should also check if op is a rename and if the
> remote of filename and newname are the same, in which case the normal
> behavior of the function should proceed which should result in a mv
> command.

Thanks for the bug report. I've fixed this in the emacs-26 branch of the
repository, will appear with Emacs 26.2.

The patch will be also part of Tramp 2.3.4, which is scheduled for
release next week.

The patch is appended, pls check whether it works for you.

Best regards, Michael.


[-- Attachment #2: Type: text/plain, Size: 1065 bytes --]

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 02fb8648d8..3e99ab567f 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2038,7 +2038,9 @@ tramp-do-copy-or-rename-file
   (unless (memq op '(copy rename))
     (error "Unknown operation `%s', must be `copy' or `rename'" op))
 
-  (if (file-directory-p filename)
+  (if (and
+       (file-directory-p filename)
+       (not (tramp-equal-remote filename newname)))
       (progn
 	(copy-directory filename newname keep-date t)
 	(when (eq op 'rename) (delete-directory filename 'recursive)))
@@ -2187,8 +2189,8 @@ tramp-do-copy-or-rename-file-directly
 		     (file-attributes filename)))
 	(file-modes (tramp-default-file-modes filename)))
     (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")
+      (let* ((cmd (cond ((and (eq op 'copy) preserve-uid-gid) "cp -f -r -p")
+			((eq op 'copy) "cp -f -r")
 			((eq op 'rename) "mv -f")
 			(t (tramp-error
 			    v 'file-error

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#31941: 26.1; Moving directory on remote host via tramp scp always performs copy
  2018-06-24  8:31 ` Michael Albinus
@ 2018-06-24 12:06   ` Stephen Nutt
  2018-06-25  6:43     ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Nutt @ 2018-06-24 12:06 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 31941

Michael Albinus <michael.albinus@gmx.de> writes:

> Thanks for the bug report. I've fixed this in the emacs-26 branch of the
> repository, will appear with Emacs 26.2.
>
> The patch will be also part of Tramp 2.3.4, which is scheduled for
> release next week.
>
> The patch is appended, pls check whether it works for you.
>
> Best regards, Michael.

The patch fixes it. Thanks.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#31941: 26.1; Moving directory on remote host via tramp scp always performs copy
  2018-06-24 12:06   ` Stephen Nutt
@ 2018-06-25  6:43     ` Michael Albinus
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2018-06-25  6:43 UTC (permalink / raw)
  To: Stephen Nutt; +Cc: 31941-done

Version: 26.2

Stephen Nutt <stnutt@gmail.com> writes:

>> The patch is appended, pls check whether it works for you.
>
> The patch fixes it. Thanks.

Thanks for the feedback, I'm closing the bug.

Best regards, Michael.








^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-25  6:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-22 19:33 bug#31941: 26.1; Moving directory on remote host via tramp scp always performs copy Stephen Nutt
2018-06-24  8:31 ` Michael Albinus
2018-06-24 12:06   ` Stephen Nutt
2018-06-25  6:43     ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.