Subject: Re: bug#78572: 30.1; Tramp Project error message loop - File is missing

From: Alexis Bakatine <[email-masked]>
Date: Mon, 26 May 2025 07:41:51 +0000

Hello Michael,

> Emacs is the prerelase of Emacs 30.2, called "30.1.90". Perhaps this
> makes a difference? I remember seeing bug reports wrt to project and
> tramp, but I don't know the details. If you can compile this yourself,
> it would help for checking.

I just built Emacs from master yesterday, this is the version I'm running:

GNU Emacs 31.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) of 2025-05-25

This was built and running on Ubuntu 24.04 LTS.

If instead you want me to try it specifically on the prerelease "30.1.90"
feel free to let me know, but if I'm not mistaken both have the same fixes
of Tramp and Project you mentioned.

Now to reproduce the error:

1. I ran the exact same command you gave me below

--8<---------------cut here---------------start------------->8---
# emacs -Q -l project --eval '(setopt project-vc-extra-root-markers (quote (".project")))' --eval '(setopt project-mode-line t)' --eval '(setq tramp-verbose 10 tramp-debug-to-file t)' '/ssh:x|sudo::'
--8<---------------cut here---------------end--------------->8---

2. Connection happens successfully.
3. <RET> to open a random remote file (in this case it was .bash_history)
4. File open successfully.
5. Now, just do literally nothing, and wait for the Tramp session to
   automatically timeout after a couple minutes.

After the timeout, this is when the problems occur, with file missing
error messages, and a debug backtrace buffer producing lots messages.

> So could you please call from the sehll (replace "x" by the real hostname)

I also replaced "x" with "/ssh:[email-masked]#34888|sudo::", I got
the exact same problem behavior, so that's not a hostname issue.

> When Emacs has finished (or crashed), there will be a file *debug tramp
> sudo root <at> x* in either the ~/.cache/emacs/ /tmp/ directory. Pls send it.

I cannot send the entire file because it grew up to 2.8M (38038 lines)
only a few seconds after step 5. But here is the (I think) most relevant
part and this is what gets printed in that file over and over:

08:30:43.563223 tramp-handle-directory-files (10) # 
  backtrace()
  tramp-handle-directory-files("/sudo:root@x:/" nil "\\`\\(\\`\\.svn\\'\\)\\|\\(\\`\\.bzr\\'\\)\\|\\(\\`\\.git\\'\\)\\|\\(\\`\\.hg\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil)
  tramp-sh-file-name-handler(directory-files "/sudo:root@x:/" nil "\\`\\(\\`\\.svn\\'\\)\\|\\(\\`\\.bzr\\'\\)\\|\\(\\`\\.git\\'\\)\\|\\(\\`\\.hg\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil)
  apply(tramp-sh-file-name-handler directory-files ("/sudo:root@x:/" nil "\\`\\(\\`\\.svn\\'\\)\\|\\(\\`\\.bzr\\'\\)\\|\\(\\`\\.git\\'\\)\\|\\(\\`\\.hg\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil))
  tramp-file-name-handler(directory-files "/sudo:root@x:/" nil "\\`\\(\\`\\.svn\\'\\)\\|\\(\\`\\.bzr\\'\\)\\|\\(\\`\\.git\\'\\)\\|\\(\\`\\.hg\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil)
  directory-files("/sudo:root@x:/" nil "\\`\\(\\`\\.svn\\'\\)\\|\\(\\`\\.bzr\\'\\)\\|\\(\\`\\.git\\'\\)\\|\\(\\`\\.hg\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t)
  #f(compiled-function (d) #<bytecode -0x1cbf71e3df3c5995>)("/sudo:root@x:/")
  locate-dominating-file("/sudo:root@x:/root/" #f(compiled-function (d) #<bytecode -0x1cbf71e3df3c5995>))
  project-try-vc--search("/sudo:root@x:/root/")
  project-try-vc("/sudo:root@x:/root/")
  run-hook-with-args-until-success(project-try-vc "/sudo:root@x:/root/")
  project--find-in-directory("/sudo:root@x:/root/")
  project-current()
  project-mode-line-format()
  eval((project-mode-line-format) t)
  redisplay_internal\ \(C\ function\)()
08:30:43.563509 tramp-handle-directory-files (1) # File is missing: /sudo:root@x:/