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

From: Michael Albinus <[email-masked]>
Date: Tue, 14 Jun 2022 19:42:50 +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.
>
> Where? in key or value?

Key.

> tramp-list-connections is often returning nil whatever the value of
> tramp-cache-data is but I have no recipe to reproduce this reliabily, if
> I can make a recipe when I have time I will report it, for now perhaps
> you can forget it.

Hmm. Start "emacs -Q -l tramp". Then in *scratch*

;; There's an empty cache.
tramp-cache-data
=> #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ())

;; Open a connection.
(file-attributes "/sudo::")
=> (t 9 0 0 (25256 27751 0 0) (25256 48385 0 0) (25256 48385 0 0) 4096 "dr-xr-x---" nil 2621441 (-1 . 1))

;; The cache contains an entry for this connection, and this entry
;; contains the property "process-buffer" with value nil.
(pp tramp-cache-data)
=> #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data
	      ((tramp-file-name "sudo"
				#("root" 0 4
				  (tramp-default t))
				nil
				#("gandalf" 0 7
				  (tramp-default t))
				nil nil nil)
	       #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data
			     ("null-device" "/dev/null" "process-buffer" nil "uname" "Linux 5.17.12-300.fc36.x86_64" "locale" "LC_ALL=en_US.utf8" "test" "test" "remote-path"
			      ("/usr/bin" "/bin" "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin")
			      "pipe-buf" 4096 "remote-shell" "/bin/sh"
			      #("~root" 1 5
				(tramp-default t))
			      "/root" "stat" "env QUOTING_STYLE=locale \\stat" "id" "/usr/bin/id" "gid-integer" 0))
   ...

;; Here we see that "process-buffer" is declared.
(tramp-connection-property-p (tramp-dissect-file-name "/sudo::") "process-buffer")
=> t

(tramp-list-connections)
=> ((tramp-file-name sudo root nil gandalf nil nil nil))

;; Now wait ca 5 min, until you see the message
;; "Tramp: Timeout session /sudo:root@gandalf:".
(tramp-connection-property-p (tramp-dissect-file-name "/sudo::") "process-buffer")
=> nil

(tramp-list-connections)
=> nil

> Thanks.

Best regards, Michael.