GNU bug report logs - #78572
30.1; Tramp Project error message loop - File is missing

Previous Next

Package: emacs;

Reported by: Alexis Bakatine <abakatine <at> proton.me>

Date: Sat, 24 May 2025 02:28:02 UTC

Severity: normal

Found in version 30.1

Fixed in version 31.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

To reply to this bug, email your comments to 78572 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Sat, 24 May 2025 02:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alexis Bakatine <abakatine <at> proton.me>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 24 May 2025 02:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alexis Bakatine <abakatine <at> proton.me>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 30.1; Tramp Project error message loop - File is missing
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 <at> x:/root/
File is missing: /sudo:root <at> 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 <at> x*
05:37:50.799367 tramp-file-name-handler (10) #
  backtrace()
  tramp-file-name-handler(file-directory-p "/sudo:root <at> x:/")
  file-directory-p("/sudo:root <at> x:/")
  tramp-handle-directory-files("/sudo:root <at> x:/" nil "\\`\\(\\`\\.git\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil)
  tramp-sh-file-name-handler(directory-files "/sudo:root <at> x:/" nil "\\`\\(\\`\\.git\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil)
  apply(tramp-sh-file-name-handler directory-files ("/sudo:root <at> x:/" nil "\\`\\(\\`\\.git\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil))
  tramp-file-name-handler(directory-files "/sudo:root <at> x:/" nil "\\`\\(\\`\\.git\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil)
  directory-files("/sudo:root <at> x:/" nil "\\`\\(\\`\\.git\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t)
  #f(compiled-function (d) #<bytecode 0x1acb9e5dc5281a7c>)("/sudo:root <at> x:/")
  locate-dominating-file("/sudo:root <at> x:/root/" #f(compiled-function (d) #<bytecode 0x1acb9e5dc5281a7c>))
  project-try-vc--search("/sudo:root <at> x:/root/")
  project-try-vc("/sudo:root <at> x:/root/")
  run-hook-with-args-until-success(project-try-vc "/sudo:root <at> x:/root/")
  project--find-in-directory("/sudo:root <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Sat, 24 May 2025 11:32:03 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Alexis Bakatine via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>
Cc: Alexis Bakatine <abakatine <at> proton.me>, 78572 <at> debbugs.gnu.org
Subject: Re: bug#78572: 30.1; Tramp Project error message loop - File is
 missing
Date: Sat, 24 May 2025 13:31:05 +0200
Alexis Bakatine via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

Hi Alexis,

> 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 <at> x:/root/
> File is missing: /sudo:root <at> 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.

Well, I've tried to reproduce it. Using Emacs 30, I've called

--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)' '/ssh:ubuntu-2404|sudo::'
--8<---------------cut here---------------end--------------->8---

Note that I'm not using project.el. Could you please provide a
step-by-step recipe for reproducing the problem?

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

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Sat, 24 May 2025 11:32:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Sun, 25 May 2025 14:16:01 GMT) Full text and rfc822 format available.

Message #14 received at 78572 <at> debbugs.gnu.org (full text, mbox):

From: Alexis Bakatine <abakatine <at> proton.me>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>,
 "78572 <at> debbugs.gnu.org" <78572 <at> debbugs.gnu.org>
Subject: Re: bug#78572: 30.1;
 Tramp Project error message loop - File is missing
Date: Sun, 25 May 2025 14:15:44 +0000
Hi Michael, thanks for the reply.

>Could you please provide a step-by-step recipe for reproducing the problem?

Surely. In your init.el, only have:

--8<---------------cut here---------------start------------->8---
(require 'project)
(setopt project-vc-extra-root-markers '(".project"))
(setopt project-mode-line t)
--8<---------------cut here---------------start------------->8---

After that, do:
C-x C-f /ssh:x|sudo::

Then wait a couple minutes for the Tramp session to automatically timeout.

Now it becomes difficult to get the exact same bug behavior all the time.
Sometimes it only prints "File is missing: /sudo:root <at> x:/root/" constantly in the *Messages* buffer, and some other time it also prints a full debug backtrace over and over like in my first email.

As well, after the Tramp session expires, when you do <RET> to open a file in the Tramp dired buffer, Emacs crashes instantly, and I'm forced to kill the Emacs process externally.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Sun, 25 May 2025 14:17:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Sun, 25 May 2025 14:50:01 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Alexis Bakatine <abakatine <at> proton.me>
Cc: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>,
 "78572 <at> debbugs.gnu.org" <78572 <at> debbugs.gnu.org>
Subject: Re: bug#78572: 30.1; Tramp Project error message loop - File is
 missing
Date: Sun, 25 May 2025 16:49:13 +0200
Alexis Bakatine <abakatine <at> proton.me> writes:

> Hi Michael, thanks for the reply.

Hi Alexis,

>>Could you please provide a step-by-step recipe for reproducing the problem?
>
> Surely. In your init.el, only have:
>
> (require 'project)
> (setopt project-vc-extra-root-markers '(".project"))
> (setopt project-mode-line t)

As said in my first reply, I have tried exactly the same from the
command line:

--8<---------------cut here---------------start------------->8---
# emacs -Q -l project --eval '(setopt project-vc-extra-root-markers (quote (".project")))' --eval '(setopt project-mode-line t)' '/ssh:ubuntu-2404|sudo::'
--8<---------------cut here---------------end--------------->8---

The only difference is, that I use the host "ubuntu-2404" (a VM in my
local net) instead of "x". It works as expected.

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.

> After that, do:
> C-x C-f /ssh:x|sudo::
>
> Then wait a couple minutes for the Tramp session to automatically timeout.
>
> Now it becomes difficult to get the exact same bug behavior all the time.
> Sometimes it only prints "File is missing: /sudo:root <at> x:/root/" constantly in the *Messages* buffer, and some other time it also prints a full debug backtrace over and over like in my first email.
>
> As well, after the Tramp session expires, when you do <RET> to open a file in the Tramp dired buffer, Emacs crashes instantly, and I'm forced to kill the Emacs process externally.

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

--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---

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.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Sun, 25 May 2025 14:50:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Mon, 26 May 2025 07:43:02 GMT) Full text and rfc822 format available.

Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alexis Bakatine <abakatine <at> proton.me>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>,
 "78572 <at> debbugs.gnu.org" <78572 <at> debbugs.gnu.org>
Subject: Re: bug#78572: 30.1;
 Tramp Project error message loop - File is missing
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:alexis <at> 192.168.1.20#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 <at> x:/" nil "\\`\\(\\`\\.svn\\'\\)\\|\\(\\`\\.bzr\\'\\)\\|\\(\\`\\.git\\'\\)\\|\\(\\`\\.hg\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil)
  tramp-sh-file-name-handler(directory-files "/sudo:root <at> x:/" nil "\\`\\(\\`\\.svn\\'\\)\\|\\(\\`\\.bzr\\'\\)\\|\\(\\`\\.git\\'\\)\\|\\(\\`\\.hg\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil)
  apply(tramp-sh-file-name-handler directory-files ("/sudo:root <at> x:/" nil "\\`\\(\\`\\.svn\\'\\)\\|\\(\\`\\.bzr\\'\\)\\|\\(\\`\\.git\\'\\)\\|\\(\\`\\.hg\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil))
  tramp-file-name-handler(directory-files "/sudo:root <at> x:/" nil "\\`\\(\\`\\.svn\\'\\)\\|\\(\\`\\.bzr\\'\\)\\|\\(\\`\\.git\\'\\)\\|\\(\\`\\.hg\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t nil)
  directory-files("/sudo:root <at> x:/" nil "\\`\\(\\`\\.svn\\'\\)\\|\\(\\`\\.bzr\\'\\)\\|\\(\\`\\.git\\'\\)\\|\\(\\`\\.hg\\'\\)\\|\\(\\`\\.project\\'\\)\\'" t)
  #f(compiled-function (d) #<bytecode -0x1cbf71e3df3c5995>)("/sudo:root <at> x:/")
  locate-dominating-file("/sudo:root <at> x:/root/" #f(compiled-function (d) #<bytecode -0x1cbf71e3df3c5995>))
  project-try-vc--search("/sudo:root <at> x:/root/")
  project-try-vc("/sudo:root <at> x:/root/")
  run-hook-with-args-until-success(project-try-vc "/sudo:root <at> x:/root/")
  project--find-in-directory("/sudo:root <at> 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 <at> x:/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Mon, 26 May 2025 07:43:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Tue, 27 May 2025 19:00:02 GMT) Full text and rfc822 format available.

Message #32 received at 78572 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Alexis Bakatine <abakatine <at> proton.me>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>,
 "78572 <at> debbugs.gnu.org" <78572 <at> debbugs.gnu.org>,
 Spencer Baugh <sbaugh <at> janestreet.com>
Subject: Re: bug#78572: 30.1; Tramp Project error message loop - File is
 missing
Date: Tue, 27 May 2025 20:58:40 +0200
Alexis Bakatine <abakatine <at> proton.me> writes:

> Hello Michael,

Hi Alexis,

> Now to reproduce the error:
>
> 1. I ran the exact same command you gave me below
>
> # 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::'
>
> 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.

Thanks for the recipe. It is helpful.

>> 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:

What you've sent didn't help; the problem is indicated much earlier in
the debug file. This is why I always insist in sending the whole debug
information.

However, you gave an important hint in your recipe: wait, until the sudo
session times out. This wasn't said before (I believe). With this
information, I could reproduce the problem with both Emacs 30 and 31. It
even happens w/o multi-hop file names. Let's check the debug buffer:

--8<---------------cut here---------------start------------->8---
;; Emacs: 30.1.90 Tramp: 2.7.3.30.2 -*- mode: outline; coding: utf-8; -*-
;; Location: /home/albinus/src/emacs-30/lisp/net/tramp.elc Git: emacs-30/d0c90bc9bfe8fedbff7f282086dc38458b1e0f9e
13:04:06.892642 tramp-get-connection-property (7) # ~root undef; cache used: nil
--8<---------------cut here---------------end--------------->8---

This is where it starts.

--8<---------------cut here---------------start------------->8---
13:04:28.261984 tramp-send-command (6) # tramp_perl_file_name_all_completions /root/ 2>/dev/null; echo tramp_exit_status $?
13:04:28.300459 tramp-wait-for-regexp (6) #
(
("./" "/root/." t t t)
("../" "/root/.." t t t)
(".bashrc" "/root/.bashrc" nil t t)
(".cache/" "/root/.cache" t t t)
(".profile" "/root/.profile" nil t t)
(".ssh/" "/root/.ssh" t t t)
("snap/" "/root/snap" t t t)
(".vnc/" "/root/.vnc" t t t)
(".config/" "/root/.config" t t t)
(".viminfo" "/root/.viminfo" nil t t)
(".vim/" "/root/.vim" t t t)
(".local/" "/root/.local" t t t)
("tmp/" "/root/tmp" t t t)
)
tramp_exit_status 0
///701580ff750d89979a541cae0f26aa39#$
--8<---------------cut here---------------end--------------->8---

The last command before the session timeout. Emacs is still busy,
because the project-mode-line-format must be refreshed again and
again. But these information are taken from Tramp's cache; no activity
on the wire.

--8<---------------cut here---------------start------------->8---
13:09:13.361210 tramp-timeout-session (3) # Timeout session /sudo:root <at> ubuntu-2404:
--8<---------------cut here---------------end--------------->8---

sudo's session timeout after ca 5 minutes due to inactivity on the
wire. Usually, this is not problem. Next time a command is sent, the
connection is reestablished. But see the problem:

--8<---------------cut here---------------start------------->8---
13:09:13.371925 tramp-get-file-property (8) # /root file-directory-p undef; inhibit: 10; cache used: nil; cached at: nil
13:09:13.372124 tramp-get-file-property (8) # /root file-truename nil; inhibit: 10; cache used: nil; cached at: nil
13:09:13.372280 tramp-get-connection-property (7) # test undef; cache used: nil
13:09:13.372436 tramp-get-test-command (5) # Finding a suitable ‘test’ command
13:09:13.373726 tramp-get-connection-property (7) # null-device undef; cache used: nil
13:09:13.374313 tramp-set-connection-property (7) # null-device /dev/null
13:09:13.374687 tramp-file-name-handler (5) # Non-essential received in operation (file-directory-p /sudo:root <at> ubuntu-2404:/root)
13:09:13.668243 tramp-file-name-handler (10) #
  backtrace()
  tramp-file-name-handler(file-directory-p "/sudo:root <at> ubuntu-2404:/root")
  file-directory-p("/sudo:root <at> ubuntu-2404:/root/")
  locate-dominating-file("/sudo:root <at> ubuntu-2404:/root/" #f(compiled-function (d) #<bytecode -0x1cbf71e3d2025995>))
  project-try-vc--search("/sudo:root <at> ubuntu-2404:/root/")
  project-try-vc("/sudo:root <at> ubuntu-2404:/root/")
  run-hook-with-args-until-success(project-try-vc "/sudo:root <at> ubuntu-2404:/root/")
  project--find-in-directory("/sudo:root <at> ubuntu-2404:/root/")
  project-current()
  project-mode-line-format()
  eval((project-mode-line-format) t)
  redisplay_internal\ \(C\ function\)()
--8<---------------cut here---------------end--------------->8---

Tramp needs to know, whether "/sudo:root <at> ubuntu-2404:/root" is a
directory. It asks the cache (first line), but this doesn't have the
information (it returns undef). So Tramp must go on wire in order to
compute the information. But his fails as well ("Non-essential received
in operation..."), resulting in an error. Why this? Hmm, in
project-current, non-essential is bound to t, telling Tramp it should
*not* establish a new connection. This is an optimization I believe, see
bug#69584. And here we are.

While project-mode-line-format is called again and again, Tramp will
block. I've played yesterday and today with it; there's no simple
solution. For the time being, you could disable the session timeout for
your sudo target. Add something like this to your init file:

--8<---------------cut here---------------start------------->8---
(add-to-list 'tramp-connection-properties (list (regexp-quote "/sudo:root <at> x:") "session-timeout" nil))
--8<---------------cut here---------------end--------------->8---

Does this work for you?

I'll continue to find a solid solution, which doesn't require this
workaround.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Wed, 28 May 2025 20:48:02 GMT) Full text and rfc822 format available.

Message #35 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alexis Bakatine <abakatine <at> proton.me>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>,
 "78572 <at> debbugs.gnu.org" <78572 <at> debbugs.gnu.org>
Subject: Re: bug#78572: 30.1;
 Tramp Project error message loop - File is missing
Date: Wed, 28 May 2025 20:47:05 +0000
Hello Michael,

> What you've sent didn't help; the problem is indicated much earlier in
> the debug file. This is why I always insist in sending the whole debug
> information.

I apologize, I thought it was just irrelevant noise until what looped over
and over, but it was indeed crucial.

All your explanations make sense now. But I'm still not sure if it's an
issue with Tramp or Project? Trivially speaking, we could also ask Project
to not look for vc related information over Tramp, but maybe some people
rely on this? After all, I'm the first one to report that bug as far as I
know.

> sudo's session timeout after ca 5 minutes due to inactivity on the
> wire.

This led me to investigate something. I told you it happened when
using Tramp with sudo. But now I tested it WITHOUT sudo and I can
reproduce the same errors. Here are the steps:

1. start an Emacs session with the command below (replace "x" with your own
   server)

--8<---------------cut here---------------start------------->8---
# emacs -Q -l project --eval '(setopt project-vc-extra-root-markers (quote (".project")))' --eval '(setopt project-mode-line t)' '/ssh:x:'
--8<---------------cut here---------------end--------------->8---

2. after successfuly connecting do:
   M-x tramp-cleanup-all-connections

As soon as the connection is closed the same errors happen.

> --8<---------------cut here---------------start------------->8---
> (add-to-list 'tramp-connection-properties (list (regexp-quote "/sudo:root <at> x:") "session-timeout" nil))
> --8<---------------cut here---------------end--------------->8---

> Does this work for you?

I did try it in my init.el, and it cancels the automatic disconnect, but as
soon as I M-x tramp-cleanup-all-connections or simply kill the process,
the errors appear.

I can live without having the project name in the mode line, so I removed
(setopt project-mode-line t)
but kept (setopt project-vc-extra-root-markers (quote (".project")))

It seems the problem doesn't happen anymore (tested with 30.1 and master),
yet I'm almost confident even with that setting only it was crashing
Emacs at some point, I will try in my main config to see if it happens
again later.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Wed, 28 May 2025 20:48:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Wed, 28 May 2025 21:12:02 GMT) Full text and rfc822 format available.

Message #41 received at 78572 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Alexis Bakatine <abakatine <at> proton.me>
Cc: Michael Albinus <michael.albinus <at> gmx.de>, 78572 <at> debbugs.gnu.org
Subject: Re: bug#78572: 30.1;
 Tramp Project error message loop - File is missing
Date: Wed, 28 May 2025 17:10:48 -0400
[Message part 1 (text/plain, inline)]
On Wed, May 28, 2025 at 5:05 PM Alexis Bakatine via Bug reports for GNU
Emacs, the Swiss army knife of text editors <bug-gnu-emacs <at> gnu.org> wrote:

> Hello Michael,
>
> > What you've sent didn't help; the problem is indicated much earlier in
> > the debug file. This is why I always insist in sending the whole debug
> > information.
>
> I apologize, I thought it was just irrelevant noise until what looped over
> and over, but it was indeed crucial.
>
> All your explanations make sense now. But I'm still not sure if it's an
> issue with Tramp or Project? Trivially speaking, we could also ask Project
> to not look for vc related information over Tramp, but maybe some people
> rely on this? After all, I'm the first one to report that bug as far as I
> know.
>
> > sudo's session timeout after ca 5 minutes due to inactivity on the
> > wire.
>
> This led me to investigate something. I told you it happened when
> using Tramp with sudo. But now I tested it WITHOUT sudo and I can
> reproduce the same errors. Here are the steps:
>
> 1. start an Emacs session with the command below (replace "x" with your own
>    server)
>
> --8<---------------cut here---------------start------------->8---
> # emacs -Q -l project --eval '(setopt project-vc-extra-root-markers (quote
> (".project")))' --eval '(setopt project-mode-line t)' '/ssh:x:'
> --8<---------------cut here---------------end--------------->8---
>
> 2. after successfuly connecting do:
>    M-x tramp-cleanup-all-connections
>
> As soon as the connection is closed the same errors happen.
>
> > --8<---------------cut here---------------start------------->8---
> > (add-to-list 'tramp-connection-properties (list (regexp-quote
> "/sudo:root <at> x:") "session-timeout" nil))
> > --8<---------------cut here---------------end--------------->8---
>
> > Does this work for you?
>
> I did try it in my init.el, and it cancels the automatic disconnect, but as
> soon as I M-x tramp-cleanup-all-connections or simply kill the process,
> the errors appear.
>
> I can live without having the project name in the mode line, so I removed
> (setopt project-mode-line t)
> but kept (setopt project-vc-extra-root-markers (quote (".project")))
>
> It seems the problem doesn't happen anymore (tested with 30.1 and master),
> yet I'm almost confident even with that setting only it was crashing
> Emacs at some point, I will try in my main config to see if it happens
> again later.
>

If this continues to be a concern, you can easily wrap the project mode
line with a remote file guard.  Maybe something like this:

  (setq project-mode-line-format '(:eval (my/project-mode-line-format)))
  (defun my/project-mode-line-format ()
    (unless (file-remote-p default-directory)
      (project-mode-line-format)))

You could make the guard sensitive to a custom variable of your own or to
the directory tree root or whatever makes sense for you.

-Stephane
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Thu, 29 May 2025 07:14:02 GMT) Full text and rfc822 format available.

Message #44 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Alexis Bakatine <abakatine <at> proton.me>
Cc: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>,
 "78572 <at> debbugs.gnu.org" <78572 <at> debbugs.gnu.org>
Subject: Re: bug#78572: 30.1; Tramp Project error message loop - File is
 missing
Date: Thu, 29 May 2025 09:13:07 +0200
Alexis Bakatine <abakatine <at> proton.me> writes:

> Hello Michael,

Hi Alexis,

> All your explanations make sense now. But I'm still not sure if it's an
> issue with Tramp or Project? Trivially speaking, we could also ask Project
> to not look for vc related information over Tramp, but maybe some people
> rely on this? After all, I'm the first one to report that bug as far as I
> know.

Yes, a fix in project.el is also possible. But I have the impression
that it could happen in other integrations as well, so I'd prefer to fix
it in Tramp, if possible.

And you are "the first one to report that bug" because you use a sudo
connection as target for your project. Other Tramp methods don't
activate session timeouts; the error isn't visible immediately.

>> sudo's session timeout after ca 5 minutes due to inactivity on the
>> wire.
>
> This led me to investigate something. I told you it happened when
> using Tramp with sudo. But now I tested it WITHOUT sudo and I can
> reproduce the same errors. Here are the steps:
>
> 1. start an Emacs session with the command below (replace "x" with your own
>    server)
>
> # emacs -Q -l project --eval '(setopt project-vc-extra-root-markers (quote (".project")))' --eval '(setopt project-mode-line t)' '/ssh:x:'
>
> 2. after successfuly connecting do:
>    M-x tramp-cleanup-all-connections
>
> As soon as the connection is closed the same errors happen.

Sure. A session timeout does exactly this: call tramp-cleanup-connection.
See tramp-timeout-session.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Thu, 29 May 2025 07:14:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Thu, 29 May 2025 07:26:02 GMT) Full text and rfc822 format available.

Message #50 received at 78572 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Ship Mints <shipmints <at> gmail.com>
Cc: Alexis Bakatine <abakatine <at> proton.me>, 78572 <at> debbugs.gnu.org
Subject: Re: bug#78572: 30.1; Tramp Project error message loop - File is
 missing
Date: Thu, 29 May 2025 09:25:36 +0200
Ship Mints <shipmints <at> gmail.com> writes:

Hi Stephane,

> If this continues to be a concern, you can easily wrap the project
> mode line with a remote file guard.  Maybe something like this:
>
>   (setq project-mode-line-format '(:eval
> (my/project-mode-line-format)))
>   (defun my/project-mode-line-format ()
>     (unless (file-remote-p default-directory)
>       (project-mode-line-format)))

We have without-remote-files for this. So you could use instead

--8<---------------cut here---------------start------------->8---
(add-function
 :around (symbol-function #'project-mode-line-format) #'without-remote-files)
--8<---------------cut here---------------end--------------->8---

> -Stephane

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Thu, 29 May 2025 08:36:02 GMT) Full text and rfc822 format available.

Message #53 received at 78572 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Ship Mints <shipmints <at> gmail.com>
Cc: Alexis Bakatine <abakatine <at> proton.me>, 78572 <at> debbugs.gnu.org
Subject: Re: bug#78572: 30.1; Tramp Project error message loop - File is
 missing
Date: Thu, 29 May 2025 10:34:58 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

> We have without-remote-files for this. So you could use instead
>
> (add-function
>  :around (symbol-function #'project-mode-line-format) #'without-remote-files)

Oops, that doesn't work. without-remote-files is a macro, not a function.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Fri, 30 May 2025 01:04:02 GMT) Full text and rfc822 format available.

Message #56 received at 78572 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Michael Albinus <michael.albinus <at> gmx.de>,
 Alexis Bakatine <abakatine <at> proton.me>
Cc: Spencer Baugh <sbaugh <at> janestreet.com>,
 "78572 <at> debbugs.gnu.org" <78572 <at> debbugs.gnu.org>
Subject: Re: bug#78572: 30.1; Tramp Project error message loop - File is
 missing
Date: Fri, 30 May 2025 04:03:18 +0300
Hi Michael,

On 27/05/2025 21:58, Michael Albinus wrote:

> --8<---------------cut here---------------start------------->8---
> ;; Emacs: 30.1.90 Tramp: 2.7.3.30.2 -*- mode: outline; coding: utf-8; -*-
> ;; Location: /home/albinus/src/emacs-30/lisp/net/tramp.elc Git: emacs-30/d0c90bc9bfe8fedbff7f282086dc38458b1e0f9e
> 13:04:06.892642 tramp-get-connection-property (7) # ~root undef; cache used: nil
> --8<---------------cut here---------------end--------------->8---
> 
> This is where it starts.
> 
> --8<---------------cut here---------------start------------->8---
> ...
> (".local/" "/root/.local" t t t)
> ("tmp/" "/root/tmp" t t t)
> )
> tramp_exit_status 0
> ///701580ff750d89979a541cae0f26aa39#$
> --8<---------------cut here---------------end--------------->8---
> 
> The last command before the session timeout. Emacs is still busy,
> because the project-mode-line-format must be refreshed again and
> again. But these information are taken from Tramp's cache; no activity
> on the wire.

The fact that it's refreshed often is something that can be improved in 
project.el with better caching. But it seems like the minor of the 
issues here.

> Tramp needs to know, whether "/sudo:root <at> ubuntu-2404:/root" is a
> directory. It asks the cache (first line), but this doesn't have the
> information (it returns undef). So Tramp must go on wire in order to
> compute the information. But his fails as well ("Non-essential received
> in operation..."), resulting in an error. Why this? Hmm, in
> project-current, non-essential is bound to t, telling Tramp it should
> *not* establish a new connection. This is an optimization I believe, see
> bug#69584. And here we are.

Indeed it is. With non-essential not bound, we could have Emacs freezing 
for like 0.5-2 (depending on the remote host) seconds every five minutes 
- not great either. So, not sure what's the ideal approach here. Longer 
caching might improve some things, but any freeze (5, 10 or 30 minutes 
later) seems problematic.

I think we also missed the first part of the original description - the 
"File is missing" errors being echoed. Should that happen? Does that 
occur due to missing permissions and/or because tramp-verbose is set to 10?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Fri, 30 May 2025 13:17:02 GMT) Full text and rfc822 format available.

Message #59 received at 78572 <at> debbugs.gnu.org (full text, mbox):

From: Alexis Bakatine <abakatine <at> proton.me>
To: Dmitry Gutov <dmitry <at> gutov.dev>, Michael Albinus <michael.albinus <at> gmx.de>
Cc: "78572 <at> debbugs.gnu.org" <78572 <at> debbugs.gnu.org>
Subject: Re: bug#78572: 30.1;
 Tramp Project error message loop - File is missing
Date: Fri, 30 May 2025 13:16:34 +0000
Hello Dmitry,

> I think we also missed the first part of the original description - the
> "File is missing" errors being echoed. Should that happen? Does that
> occur due to missing permissions and/or because tramp-verbose is set to > 10?

This is something that happens with tramp-verbose set to its default value.
Here is the recipe:

1. from your terminal (use a server of your own):

--8<---------------cut here---------------start------------->8---
emacs -Q -l project --eval '(setopt project-mode-line t)' '/ssh:foo <at> bar:'
--8<---------------cut here---------------end--------------->8---

2. after successfully connecting do:
   M-x tramp-cleanup-all-connections

3. right after the connection drops you can check your *Messages* buffer and
notice multiple lines like below:

--8<---------------cut here---------------start------------->8---
File is missing: /ssh:foo <at> bar:~/
File is missing: /ssh:foo <at> bar:
--8<---------------cut here---------------end--------------->8---

They also get echoed again when you switch buffers with C-x b, or just switch
cursor windows after you split the window with C-x 1 and then C-x o, though
I can't make that behavior consistent.







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Sat, 31 May 2025 02:52:02 GMT) Full text and rfc822 format available.

Message #62 received at 78572 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Alexis Bakatine <abakatine <at> proton.me>,
 Michael Albinus <michael.albinus <at> gmx.de>
Cc: "78572 <at> debbugs.gnu.org" <78572 <at> debbugs.gnu.org>
Subject: Re: bug#78572: 30.1; Tramp Project error message loop - File is
 missing
Date: Sat, 31 May 2025 05:50:48 +0300
Hi Alexis,

On 30/05/2025 16:16, Alexis Bakatine wrote:

>> I think we also missed the first part of the original description - the
>> "File is missing" errors being echoed. Should that happen? Does that
>> occur due to missing permissions and/or because tramp-verbose is set to > 10?
> This is something that happens with tramp-verbose set to its default value.
> Here is the recipe:
> 
> 1. from your terminal (use a server of your own):
> 
> --8<---------------cut here---------------start------------->8---
> emacs -Q -l project --eval '(setopt project-mode-line t)' '/ssh:foo <at> bar:'
> --8<---------------cut here---------------end--------------->8---
> 
> 2. after successfully connecting do:
>     M-x tramp-cleanup-all-connections

Thanks. Interesting - I don't see this error at step 1, but after step 2 
- clearing all connections forcibly - I start seeing it a lot, like you 
say after different commands.

So I'm guessing it could be some data inconsistency that occurs after 
the interrupted connection. Maybe it's the problem Michael referred to 
anyway.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Mon, 02 Jun 2025 10:20:02 GMT) Full text and rfc822 format available.

Message #65 received at 78572 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Alexis Bakatine <abakatine <at> proton.me>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, 78572 <at> debbugs.gnu.org,
 Spencer Baugh <sbaugh <at> janestreet.com>
Subject: Re: bug#78572: 30.1; Tramp Project error message loop - File is
 missing
Date: Mon, 02 Jun 2025 12:18:57 +0200
Alexis Bakatine <abakatine <at> proton.me> writes:

> Hello Michael,

Hi Alexis,

> All your explanations make sense now. But I'm still not sure if it's an
> issue with Tramp or Project? Trivially speaking, we could also ask Project
> to not look for vc related information over Tramp, but maybe some people
> rely on this?

Finally, I could fix it in Tramp. No change needed in project.el.

Pushed to master. Could you, pls, check?

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78572; Package emacs. (Wed, 04 Jun 2025 10:29:02 GMT) Full text and rfc822 format available.

Message #68 received at 78572 <at> debbugs.gnu.org (full text, mbox):

From: Alexis Bakatine <abakatine <at> proton.me>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: "78572 <at> debbugs.gnu.org" <78572 <at> debbugs.gnu.org>
Subject: Re: bug#78572: 30.1;
 Tramp Project error message loop - File is missing
Date: Wed, 04 Jun 2025 10:27:49 +0000
Hello Michael,

> Pushed to master. Could you, pls, check?

I confirm I'm not able to reproduce any of the messages, neither the project-vc-related ones nor the "File is missing".

Thank you Michael, have a great day.




Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Wed, 04 Jun 2025 15:25:03 GMT) Full text and rfc822 format available.

Notification sent to Alexis Bakatine <abakatine <at> proton.me>:
bug acknowledged by developer. (Wed, 04 Jun 2025 15:25:03 GMT) Full text and rfc822 format available.

Message #73 received at 78572-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Alexis Bakatine <abakatine <at> proton.me>
Cc: 78572-done <at> debbugs.gnu.org
Subject: Re: bug#78572: 30.1; Tramp Project error message loop - File is
 missing
Date: Wed, 04 Jun 2025 17:24:31 +0200
Version: 31.1

Alexis Bakatine <abakatine <at> proton.me> writes:

> Hello Michael,

Hi Alexis,

>> Pushed to master. Could you, pls, check?
>
> I confirm I'm not able to reproduce any of the messages, neither the project-vc-related ones nor the "File is missing".

Thanks for the feedback. I'm closing the bug.

> Thank you Michael, have a great day.

Best regards, Michael.




This bug report was last modified 12 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.