Subject: bug#78791: 30.1; Tramp reopening file with sudo after disconnect error message

From: Alexis Bakatine <[email-masked]>
Date: Sat, 14 Jun 2025 19:23:17 +0000

Hello, when I'm trying to open a file from a Dired buffer with sudo after a
disconnect with Tramp, it results in an error message.

How to reproduce:

1. emacs -Q '/ssh:foo@bar|sudo::'
2. M-x tramp-cleanup-all-connections
3. 'o' or <RET> to open a file

result in *Messages*:
Host name 'bar' does not match ‘\`\(?:t480s\|\(?:127\.0\.0\.1\|::1\|ip\(?:6-lo\(?:calhost\|opback\)\|v6-lo\(?:calhost\|opback\)\)\|localhost[46]?\)\)\'’

Note that when NOT using sudo as with /ssh:foo@bar:, I can run M-x
tramp-cleanup-all-connections and open a file without problem,
Tramp reconnects automatically.

Tested on Emacs 30.1 and 31.0.50 on Linux.

Best regards,

Alexis