Subject: 30.1; Tramp Project error message loop - File is missing

From: Alexis Bakatine <[email-masked]>
Date: Fri, 23 May 2025 16:06:23 +0000

When using either one of these settings, or both at the same time:

(setopt project-vc-extra-root-markers '(".project"))
(setopt project-mode-line t)

Tramp produces error messages in the minibuffer after connecting
to the remote server:

File is missing: /sudo:root@x:/root/
File is missing: /sudo:root@x:/

It only happens when using Tramp with:
/ssh:x|sudo::

If I'm using the command below, the problem doesn't occur (note that "x" is simply a
host server config name in my ~/.ssh/config file):
/ssh:x:

What's worse is that it loops over and over trying to search for some
file that it cannot find remotely, and after a few minutes connected
Emacs becomes unresponsive.

Here is an excerpt of the debug backtrace:
*debug tramp/sudo root@x*
05:37:50.799367 tramp-file-name-handler (10) #
  backtrace()
  tramp-file-name-handler(file-directory-p "/sudo:root@x:/")
  file-directory-p("/sudo:root@x:/")
  tramp-handle-directory-files("/sudo:root@x:/" nil "\\`\\(\\`\\.git\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil)
  tramp-sh-file-name-handler(directory-files "/sudo:root@x:/" nil "\\`\\(\\`\\.git\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil)
  apply(tramp-sh-file-name-handler directory-files ("/sudo:root@x:/" nil "\\`\\(\\`\\.git\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil))
  tramp-file-name-handler(directory-files "/sudo:root@x:/" nil "\\`\\(\\`\\.git\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil)
  directory-files("/sudo:root@x:/" nil "\\`\\(\\`\\.git\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t)
  #f(compiled-function (d) #<bytecode 0x1acb9e5dc5281a7c>)("/sudo:root@x:/")
  locate-dominating-file("/sudo:root@x:/root/" #f(compiled-function (d) #<bytecode 0x1acb9e5dc5281a7c>))
  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(nil)

I tested this on Emacs 30.1 on Linux, macOS and Windows, with the same
results.

ps: sorry for the poor formatting.