Subject: Re: bug#31355: 26.1; [PATCH] Fix remote-host/tramp directory tracking for shells in `term' buffers

From: Michael Albinus <[email-masked]>
Date: Thu, 03 May 2018 16:04:58 +0200

Phil Sainty <[email-masked]> writes:

Hi Phil,

> With tramp methods now being mandatory, the term.el directory tracking
> was generating invalid tramp paths on remote hosts.
>
> I've rolled a patch for this (along with some very minor improvements
> to the related commentary) in which I'm hard-coding the "ssh" method.
> I'm not sure whether that's the ideal fix, but I suspect it's likely
> to do the trick for most people, whereas the current code won't work
> at all.

Thanks for this. I haven't tested, just a short comment:

> @@ -2753,8 +2756,8 @@ term-handle-ansi-terminal-messages
>  					(string= term-ansi-at-user (user-real-login-name)))
>  		   (expand-file-name term-ansi-at-dir)
>  		 (if (string= term-ansi-at-user (user-real-login-name))
> -		     (concat "/" term-ansi-at-host ":" term-ansi-at-dir)
> -		   (concat "/" term-ansi-at-user "@" term-ansi-at-host ":"
> +                     (concat "/ssh:" term-ansi-at-host ":" term-ansi-at-dir)
> +                   (concat "/ssh:" term-ansi-at-user "@" term-ansi-at-host ":"

I believe it is always save to use term-ansi-at-user. There's no need to
check, whether it is equal to (user-real-login-name).

Furthermore, I wouldn't hard-code "ssh". People might have other
preferences, and on some systems it doesn't work. Think about Emacs
running on MS WIndows, where "plink" is used instead of "ssh". Just take
"-" as method, this is a notation to apply user's default (Tramp) method.

> -Phil

Best regards, Michael.