all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Yuri D'Elia <wavexx@thregr.org>
Cc: Eli Zaretskii <eliz@gnu.org>, 62614@debbugs.gnu.org
Subject: bug#62614: Tramp attempts to remove lock file with 'remote-file-name-inhibit-locks t
Date: Mon, 03 Apr 2023 18:32:25 +0200	[thread overview]
Message-ID: <878rf90vvq.fsf@gmx.de> (raw)
In-Reply-To: <87iledypuz.fsf@wavexx.thregr.org> (Yuri D'Elia's message of "Mon, 03 Apr 2023 16:54:12 +0200")

[-- Attachment #1: Type: text/plain, Size: 843 bytes --]

Yuri D'Elia <wavexx@thregr.org> writes:

Hi Yuri & Eli,

> On Mon, Apr 03 2023, Michael Albinus wrote:
>>> IMHO if lock creation is inhibited, we could still attempt to remove the
>>> lock to keep the old behavior, but then the warning shouldn't be
>>> generated as you don't expect the lock to exist in the normal case.
>>
>> That might be an option. But it wouldn't fix your use case, where you
>> try to avoid the file locking machinery for remote files at all.
>
> No, but it would fix an unexpected warning for both tramp and local
> files, which I think is beneficial.
>
> On Mon, Apr 03 2023, Eli Zaretskii wrote:
>> How about trying to remove the lock file, but if creation of lock
>> files is disabled, suppressing the warning?
>
> As above.

See appended patch. Shall it go to the emacs-29 or master branch?

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1967 bytes --]

diff --git a/lisp/files.el b/lisp/files.el
index d325729bf4d..216d31c737b 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -555,7 +555,7 @@ lock-file-name-transforms
   :version "28.1")

 (defcustom remote-file-name-inhibit-locks nil
-  "Whether to use file locks for remote files."
+  "Whether to create file locks for remote files."
   :group 'files
   :version "28.1"
   :type 'boolean)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index df2f0850b83..4180a32b6d9 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4585,7 +4585,8 @@ tramp-handle-unlock-file
     (condition-case err
         (delete-file lockname)
       ;; `userlock--handle-unlock-error' exists since Emacs 28.1.
-      (error (tramp-compat-funcall 'userlock--handle-unlock-error err)))))
+      (error (and (not (bound-and-true-p remote-file-name-inhibit-locks))
+                  (tramp-compat-funcall 'userlock--handle-unlock-error err))))))

 (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix)
   "Like `load' for Tramp files."
diff --git a/lisp/userlock.el b/lisp/userlock.el
index 61f061d3e54..562bc0a0a9f 100644
--- a/lisp/userlock.el
+++ b/lisp/userlock.el
@@ -206,11 +206,12 @@ ask-user-about-supersession-help
 ;;;###autoload
 (defun userlock--handle-unlock-error (error)
   "Report an ERROR that occurred while unlocking a file."
-  (display-warning
-   '(unlock-file)
-   ;; There is no need to explain that this is an unlock error because
-   ;; ERROR is a `file-error' condition, which explains this.
-   (message "%s, ignored" (error-message-string error))
-   :warning))
+  (when create-lockfiles
+    (display-warning
+     '(unlock-file)
+     ;; There is no need to explain that this is an unlock error because
+     ;; ERROR is a `file-error' condition, which explains this.
+     (message "%s, ignored" (error-message-string error))
+     :warning)))

 ;;; userlock.el ends here

  reply	other threads:[~2023-04-03 16:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-02 13:28 bug#62614: Tramp attempts to remove lock file with 'remote-file-name-inhibit-locks t Yuri D'Elia
2023-04-03  8:35 ` Michael Albinus
2023-04-03  9:19   ` Yuri D'Elia
2023-04-03  9:54     ` Michael Albinus
2023-04-03 10:01       ` Yuri D'Elia
2023-04-03 10:17         ` Yuri D'Elia
2023-04-03 10:30           ` Michael Albinus
2023-04-03 14:54             ` Yuri D'Elia
2023-04-03 16:32               ` Michael Albinus [this message]
2023-04-03 16:45                 ` Eli Zaretskii
2023-04-03 18:50                   ` Yuri D'Elia
2023-04-04  7:55                     ` Michael Albinus
2023-04-03 14:14       ` Eli Zaretskii
2023-04-03 14:10     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rf90vvq.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=62614@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=wavexx@thregr.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.