Subject: bug#70900: 30.0.50; tramp complains "File error: Cannot remove lock file for /ssh:..." on every save when remote-file-name-inhibit-locks is non-nil

From: Michael Albinus <[email-masked]>
Date: Mon, 13 May 2024 07:56:29 +0200

Dmitry Gutov <[email-masked]> writes:

Hi Dmitry,

> 1. (setq remote-file-name-inhibit-locks t)
> 2. Open some file remotely, lightly edit and save it.
> 3. See this message in the Messages buffer.

The description of remote-file-name-inhibit-locks says "Whether to
create file locks for remote files.". And this is what Tramp
does. Nothing said about checking/removing of lock files.

If we want to suppress these actions as well, we shall agree about, and
change the doc. Eli?

> BTW, I'm surprised this variable isn't mentioned in Tramp's FAQ (the
> performance section in particular).

???

In the Tramp manual, node "Frequently Asked Questions", item "How to
speed up TRAMP?", there is

--8<---------------cut here---------------start------------->8---
        − Disable file locks.  Set ‘remote-file-name-inhibit-locks’ to
          ‘t’ if you know that different Emacs sessions are not
          modifying the same remote file.
--8<---------------cut here---------------end--------------->8---

> It would also make sense to switch it on by default - it has a
> noticeable effect on performance.

No. File locks are an essential part of Emacs. Disabling them has the
potential to damage something (see above), so it shall be decided by the user.

Best regards, Michael.