I noticed a huge slowdown when renaming a remote directory via tramp in dired mode, especially pronounced when the remote host had a slow internet connection.

I investigated and saw tramp was first transferring the directory to my local machine in /var/folders/... with scp, then transferring it back with scp under the new name.

I looked into tramp.el and saw this behaviour is by tramp-do-copy-or-rename-file-out-of-band. However the comments indicate if both files are tramp files, and use the same method (scp in my case), it should use a simple mv or cp on the remote host. So not sure why the out-of-band choice is being used. I also tried to access the remote host with the ssh method, but this too did not work as expected; tramp started doing a deep copy file-by-file, instead of using mv.

Are there some options I can use to configure this? (I have captured a log-level 6 trace of this happening)

Example of the rename filepaths (as seen from inside emacs / tramp / dired):

from: /scp:hyper-m.wan:/sw/ucspi
to:   /scp:hyper-m.wan:/sw/ucspi-tcp-0.88

The excerpt from the log is

12:17:47.525836 tramp-do-copy-or-rename-file-out-of-band (6) # scp -p -q -r -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no hyper-m.wan:/sw/ucspi/ /var/folders/nl/41nwsxpn57jffks3qyn6q0r00000gn/T/tramp.pGOoQn/ucspi-tcp-0.88
12:17:49.238779 tramp-action-out-of-band (3) # Process has finished.

12:17:49.248955 tramp-do-copy-or-rename-file-out-of-band (6) # scp -p -q -r -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no /var/folders/nl/41nwsxpn57jffks3qyn6q0r00000gn/T/tramp.pGOoQn/ucspi-tcp-0.88/ hyper-m.wan:/sw/ucspi-tcp-0.88
12:17:51.002051 tramp-action-out-of-band (3) # Process has finished.

Thanks for any pointers.

  • Well, Tramp should have done a direct copy. Not clear why it didn't, I would need further traces for analysis. This is not for sx. Could you pls write a Tramp bug report? Bonus point if you add the debug buffer obtained with tramp-verbose set to 6. – Michael Albinus Jul 8 at 13:39
  • Thanks. I will file the report. I saved the debug buffer with tramp-verbose set to 6. – Nico Jul 9 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.