1

Tramp consistently hangs, for me, when opening or writing a remote file. None of the ‘why is Tramp hanging...?’ resources I've found seem to address my situation.

What's odd is that this used to work fine – something has changed to break this, on the client side I think, and I can't work out what.

The problem appears to happen only for version-controlled remote files (in my case Mercurial). See below.


I open a remote file /scp:helium:foo.c, and get Tramp debug messages like (this is with tramp-verbose set to 10):

Tramp: Opening connection for helium using scp...
Tramp: Sending command ‘exec ssh   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none helium’
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘helium’
Tramp: Opening connection for helium using scp...done
Tramp: Inserting ‘/scp:helium:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c’...
Tramp: Encoding remote file ‘/scp:helium:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c’ with ‘(gzip <%s | openssl enc -base64)’...done
Tramp: Decoding local file ‘/var/folders/f5/vh0d0ls94_j5s4bv49sz90s40000gn/T/tramp.4wIIyB.c’ with ‘(lambda (beg end) (base64-decode-region beg end) (let ((coding-system-for-write (quote binary)) (coding-system-for-read (quote binary))) (apply (quote tramp-call-process-region) (quote (tramp-file-name scp nil nil helium nil /home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c nil)) (point-min) (point-max) (car (split-string gzip -d)) t t nil (cdr (split-string gzip -d)))))’...done
Tramp: Inserting ‘/scp:helium:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c’...done

Then it hangs. I C-g, and then get:

Tramp: Checking ‘vc-registered’ for /scp:helium:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c...done
Tramp: Inserting ‘/scp:helium:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c’...done
Quit

I make a change to the file, and save it:

Saving file /scp:helium:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c...
Tramp: Opening connection for helium using scp...
Tramp: Sending command ‘exec ssh   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none helium’
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘helium’
Tramp: Opening connection for helium using scp...done
Tramp: Encoding local file ‘/var/folders/f5/vh0d0ls94_j5s4bv49sz90s40000gn/T/tramp.Rn8nOp.c’ using ‘(lambda (beg end) (let ((coding-system-for-write (quote binary)) (coding-system-for-read (quote binary))) (apply (quote tramp-call-process-region) (quote (tramp-file-name scp nil nil helium nil /home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c nil)) beg end (car (split-string gzip)) t t nil (cdr (split-string gzip)))) (base64-encode-region (point-min) (point-max)))’...done

It hangs again. Again C-g, then:

Wrote /scp:helium:/home/norman/checkouts/itm/sso/misc/ldap-info-wrapper.c
Quit

It appears that it has indeed written the file before it hangs, so I don't lose any data by cancelling the operation.

This happens on two different remote machines (a CentOS and a FreeBSD one).

The shell prompt in each case should be PS1='$ ', after the recommended/obvious rc test of $TERM. I've set the $SHELL environment variable to /bin/bash in the Emacs process (why not...?). I've confirmed that I do indeed get a $ prompt, with no other junk (apart from the motd contents, which don't count as ‘junk’), when I ssh to that machine with a dumb terminal; and the debugging messages Found remote shell prompt do seem to corroborate this.

I've configured connection sharing as occasionally recommended, but I do understand that Tramp carefully ignores that (and I'm mentioning it only to indicate that I've done my homework!).

I seem to have exhausted the suggested problems in the TrampMode section of the Emacs wiki and the Tramp manual FAQ.

The lines Checking ‘vc-registered’ seem significant, since the problem appears to happen only for remote files which are under version control (Mercurial, in my case); I can read and write remote:~/foo.txt without problem. However those lines aren't being reported, in the *Messages* buffer, as failing, and the hangs aren't adjacent to those lines in the buffer, in either case. I can see some discussion of what may be this problem from 2014, but that thread appears to suggest that the fix is already committed (five years ago!). I tried (setq vc-handled-backends nil) in the hope that this might turn off any Tramp cleverness in this area, but without effect. The Tramp manual doesn't suggest that there is any particular cleverness in this area, in any case.

(edit) Further investigation shows that this does seem to be specific to version-controlled files. If I copy the version-controlled file to another one, wibble.c, then I can open, edit, and write it exactly as I'd expect. The messages there are:

Saving file /scp:helium:/home/norman/checkouts/itm/sso/misc/wibble.c...
Tramp: Opening connection for helium using scp...
Tramp: Sending command ‘exec ssh   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none helium’
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘helium’
Tramp: Opening connection for helium using scp...done
Tramp: Encoding local file ‘/var/folders/f5/vh0d0ls94_j5s4bv49sz90s40000gn/T/tramp.ZGFIYd.c’ using ‘(lambda (beg end) (let ((coding-system-for-write (quote binary)) (coding-system-for-read (quote binary))) (apply (quote tramp-call-process-region) (quote (tramp-file-name scp nil nil helium nil /home/norman/checkouts/itm/sso/misc/wibble.c nil)) beg end (car (split-string env GZIP= gzip)) t t nil (cdr (split-string env GZIP= gzip)))) (base64-encode-region (point-min) (point-max)))’...done
Tramp: Decoding remote file ‘/scp:helium:/home/norman/checkouts/itm/sso/misc/wibble.c’ using ‘(openssl enc -d -base64 | env GZIP= gzip -d >%s)’...done
Wrote /scp:helium:/home/norman/checkouts/itm/sso/misc/wibble.c

Those messages don't appear to be any different from before (this is still with tramp-verbose set to 10).

The same happens with starting Emacs with emacs -Q.

I'm running Tramp 2.4.1. The client Emacs is 26.1 (on macOS, and from the Nix distribution, to the extent that that might matter).

...and I'm very puzzled indeed.

  • Do you see the same problem if you start Emacs with emacs -Q (no init file)? If not, bisect your init file to find the culprit. If yes, please consider filing a bug report with a step-by-step recipe: M-x report-emacs-bug. – Drew May 31 at 17:47
  • 1
    @Drew Good suggestion – thanks: I should have thought of that. But exactly the same happens if I start with -Q. I've edited the question to note that it does seem to be associated with version-controlled files. If no insight appears over the weekend, I'll have a go at a bug report on Monday (but it's now long past beer/home-time) – Norman Gray May 31 at 18:09
  • ;-) Sounds good. – Drew May 31 at 19:26
  • 1
    There has been an error with Tramp and vc-registered, but I don't know whether this is related. See the thread starting at <lists.gnu.org/archive/html/emacs-devel/2019-05/msg00010.html>. This problem is solved meanwhile in the repositories, if you have a chance to test Tramp from git ... Otherwise, I recommend to continue as proposed by Drew, write a bug report. – Michael Albinus Jun 1 at 8:13

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.