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

From: Michael Albinus <[email-masked]>
Date: Tue, 14 Jun 2022 13:39:16 +0200

Thierry Volpiatto <[email-masked]> writes:

Hi Thierry,

> 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,

I don't understand this. tramp-connection-property-p just tests whether
a connection property is defined. It does not check the value of this property.

> 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))))

Sorry, but I'm not fluent with the cl-loop syntax.

> 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.

Sorry, I cannot follow what you try to explain. Could you please show me
an example, both the value of tramp-cache-data, and the result
tramp-list-connections is returning?

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

At least it is unrelated to the problem of this bug report.

> Thanks.

Best regards, Michael.