1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Add user option remote-file-name-access-timeout

* doc/lispref/files.texi (Testing Accessibility):
Add user option remote-file-name-access-timeout.

* doc/misc/tramp.texi (Frequently Asked Questions):
Explain remote-file-name-access-timeout.

* etc/NEWS: Mention 'remote-file-name-access-timeout'.

* lisp/files.el (remote-file-name-access-timeout): New defcustom.
(remote-file-name-inhibit-auto-save-visited)
(remote-file-name-inhibit-locks, remote-file-name-inhibit-cache)
(remote-file-name-inhibit-delete-by-moving-to-trash):
* lisp/simple.el (remote-file-name-inhibit-auto-save): Add group `tramp'.

* lisp/net/tramp.el (with-tramp-timeout, with-tramp-suspended-timers):
New defmacros.
(tramp-dont-suspend-timers): New defvar.
(tramp-handle-access-file): Implement handling of
`remote-file-name-access-timeout'.  (Bug#64401)
(tramp-action-show-and-confirm-message, tramp-process-actions)
(with-tramp-locked-connection, tramp-wait-for-regexp)
(tramp-read-passwd, tramp-read-passwd-without-cache): Use the macros.

* test/lisp/net/tramp-tests.el (remote-file-name-access-timeout):
Declare.
(tramp-test18-file-attributes): Extend test.
This commit is contained in:
Michael Albinus 2023-07-03 18:24:11 +02:00
parent 0b060faf2e
commit c565a6c62c
7 changed files with 165 additions and 77 deletions

View file

@ -81,6 +81,7 @@
(defvar dired-copy-dereference)
;; Declared in Emacs 30.
(defvar remote-file-name-access-timeout)
(defvar remote-file-name-inhibit-delete-by-moving-to-trash)
;; `ert-resource-file' was introduced in Emacs 28.1.
@ -3654,6 +3655,18 @@ This tests also `access-file', `file-readable-p',
attr)
(unwind-protect
(progn
(write-region "foo" nil tmp-name1)
;; `access-file' returns nil in case of success.
(should-not (access-file tmp-name1 "error"))
;; `access-file' could use a timeout.
(let ((remote-file-name-access-timeout 1))
(cl-letf (((symbol-function #'file-exists-p)
(lambda (_filename) (sleep-for 5))))
(should-error
(access-file tmp-name1 "error")
:type 'file-error)))
(delete-file tmp-name1)
;; A sticky bit could damage the `file-ownership-preserved-p' test.
(when
(and test-file-ownership-preserved-p