Subject: 29.0.50; Tramp and recentf yet again
From: Stephen Berman <[email-masked]>
To: [email-masked]
Date: Mon, 22 Aug 2022 10:59:44 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

With my current build from master, when my ~/emacs.d/recentf file
contains an entry that uses ssh to connect to another machine and this
machine is offline when I start Emacs, then Tramp repeatedly tries to
connect to that machine.  To reproduce:

0. Let ~/emacs.d/recentf consist of the following (the entry in
   recentf-list refers to a machine that is currently offline):

;;; Automatically generated by ‘recentf’ on Mon Aug 22 09:50:45 2022.

(setq recentf-list
      '(
        "/ssh:steve@hpaul:~/"
        ))

(setq recentf-filter-changer-current 'nil)


;; Local Variables:
;; coding: utf-8-emacs
;; End:

1. Let ~/.emacs consist of the following:

(recentf-mode 1)

2. emacs
3. The echo area displays "Opening connection nil for steve@hpaul using
   ssh..."
4. After a little while "failed" gets appended to the message, and then
   the echo area displays "Timeout reached, see buffer ‘*tramp/ssh
   steve@hpaul*’ for details"
5. Tramp tries again, repeating the message in step 3, then times out
   again, repeating the message in step, and so on indefinitely.  I can
   break this cycle only by typing C-g and holding down the keys (just
   repeatedly typing C-g doesn't work).  When Tramp no longer tries to
   connect, *Messages* displays this:
   Tramp: Opening connection nil for steve@hpaul using ssh...failed
   Cleaning up the recentf list...
   error: "Lisp nesting exceeds ‘max-lisp-eval-depth’"
   Quit [7 times]

Invoking tramp-cleanup-this-connection or tramp-cleanup-all-connections
does not prevent the attempts to connect on restarting Emacs, only
deleting the entries from recentf-list works.

I frequently use Tramp to ssh to other machines, so I assume my recentf
file normally contains such entries as above.  Or perhaps I have always
killed all buffers displaying files on such machines before shutting
down Emacs, and then the entries are removed from the recentf file, and
this time I had not killed those buffers?  I don't know, but it seems
unlikely.  Anyway, Tramp has not attempted to connect to these machines
on starting Emacs until my current build (I have had issues with Tramp
and recentf in the past, see bug#26258 and bug#27108, but these were
fixed).  I don't remember exactly when my most recent previous build
was, but I think it was within the last 1-3 weeks at most.

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.6)
 of 2022-08-19 built on strobelfs2
Repository revision: dd97bff219dd3039c576710850e04fa4fa32f004
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Linux From Scratch r11.0-165

Configured using:
 'configure --with-xinput2 --with-xwidgets 'CFLAGS=-Og -g3'
 PKG_CONFIG_PATH=/opt/qt5/lib/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM
XINPUT2 XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix