Subject: bug#19636: [TRAMP] global minor mode hangs connection when accessing files in :lighter

From: Michael Albinus <[email-masked]>
Date: Sun, 25 Jan 2015 20:40:42 +0100

Philippe Vaucher <[email-masked]> writes:

>> (setq buggy-tramp-mode-lighter
>>       '(:eval (format " Projectile[%s]"
>>                       (if (file-remote-p default-directory)
>>                           default-directory
>>                         (file-truename default-directory)))))
>
> That's an interesting workaround, can I assume that
> `default-directory` over a TRAMP connection is always absolute? what
> about symlinks?

You can always assume, that `default-directory' is absolute, being it
local or remote. Symlinks are not expanded, 'tho.

However, there is always the buffer local variable
`buffer-file-truename'. Maybe you could use it somehow, when setting the
lighter? Something like

(if buffer-file-truename (file-name-directory buffer-file-truename) default-directory)

Short analysis of the debug buffer:

> 18:06:05.604340 tramp-maybe-open-connection (3) # Opening connection for [email-masked] using scpx...
> 18:06:05.604996 tramp-maybe-open-connection (6) # /bin/sh -i
> 18:06:05.607758 tramp-wait-for-regexp (6) # 
> #$ 

Here Tramp opens a second connection in order to call git.

> 18:06:05.610783 tramp-sh-handle-file-truename (4) # Finding true name for `/scpx:[email-masked]:/tmp/'
> 18:06:05.610902 tramp-send-command (6) # echo are you awake
> 18:06:15.613967 tramp-wait-for-regexp (6) # 
> are you awake
> #$ 
> 18:06:15.614566 tramp-wait-for-regexp (1) # File error: [[Regexp `\(^\|\)[^#$
> ]*///06fdc8c8f4a1778883b636f13ae5468c#\$?$' not found in 10 secs]]

And here Tramp tries to use the primary connection for getting the
truename of the default directory. Tramp is not able to accept those
requests while preparing the second connection for
start-file-process. Maybe I need to add something in order to make it
more robust. This is not such easy, it might take time.

> Philippe

Best regards, Michael.