Subject: Re: bug#55832: 28.1; Emacs crashes when using tramp from helm in emacs-29

From: Thierry Volpiatto <[email-masked]>
Date: Sun, 12 Jun 2022 18:16:23 +0000

Michael Albinus <[email-masked]> writes:

> Thierry Volpiatto <[email-masked]> writes:
>
> Hi Thierry,
>
>>> (setq tramp-verbose 10 tramp-debug-to-file t)
>>
>> Ah nice, with those setting instead of crashing emacs hang and I can
>> recuperate with C-g, here the tramp log:
>>
>> https://gist.github.com/thierryvolpiatto/96b5d3bacc92deac1fad275eede69354
>
> Thanks. The trace looks surprising, again and again
>
> 21:38:47.713417 tramp-get-remote-id (5) # Finding POSIX `id' command
>
> I'll try to analyze tomorrow what could have triggered this behavior. If
> not successful, I'll ask you for instrumentation of Tramp.

I have a function wrote long time ago to delete tramp connections which
is not working (or most of the time not working) because it uses
tramp-list-connections which is itself broken (unexpectedly it worked
only once today don't know why).

The test (tramp-connection-property-p key "process-buffer") is wrong IMO
according to the data fetched from tramp-cache-data, here a function based
on tramp-list-connections to illustrate the data fetched here from a
sudo connection:

    (defun tv/list-tramp-connections ()
      (cl-loop with tramp-verbose = 0
               for key being the hash-keys in tramp-cache-data
               using (hash-value val)
               when (and (tramp-file-name-p key)
    		     (null (tramp-file-name-localname key))
                         ;; (tramp-connection-property-p key "process-buffer"))
                         )
               collect (list key (cl-loop for k being the hash-keys in val
                                          using (hash-value v)
                                          collect (list k v))))

The function for a sudo connection returns:

(((tramp-file-name "sudo"
                   #("root" 0 4
                     (tramp-default t))
                   nil
                   #("IPad-S340" 0 9
                     (tramp-default t))
                   nil nil nil)
  (("process-buffer" nil)
   ("null-device" "/dev/null")
   ("uid-string" "UNKNOWN")
   ("gid-string" "UNKNOWN")
   ("uid-integer" -1)
   ("gid-integer" -1)
   ("first-password-request" nil)
   ("uname" "Linux 5.15.0-33-generic")
   ("locale" "LC_ALL=en_US.utf8")
   ("test" "test")
   ("remote-path"
    ("/bin" "/usr/bin" "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin"))
   ("pipe-buf" 4096)
   ("remote-shell" "/bin/sh")
   ("~root" "/root")
   ("file-exists" "test -e")
   ("stat" "env QUOTING_STYLE=locale \\stat")
   ("case-insensitive" nil)
   ("readlink" "\\readlink"))))

As you can see "process-buffer" is listed in the cdr but not the car of
result so tramp-list-connections always returns nil because
(tramp-connection-property-p key "process-buffer") always returns nil.

Seems the cdr is the same as what found in ~/.emacs.d/tramp.

Maybe it can help you to understand what's going wrong.

Thanks.

-- 
Thierry