diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2023-02-26 15:40:30 +0100 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2023-02-26 15:40:30 +0100 |
commit | 6c4abbab7999f55792a323e4bb1eb55ef5a7b990 (patch) | |
tree | 7ab03d6aeefe71a753ce408f9466df2f637e0989 /test/lisp/net/tramp-tests.el | |
parent | 8797e514ab68c12ed05d3af88e6baba64bf08f4d (diff) | |
download | emacs-6c4abbab7999f55792a323e4bb1eb55ef5a7b990.tar.gz |
Tramp: Do not unlock when connection is broken
* lisp/net/tramp.el (tramp-handle-unlock-file): Do not unlock when
connection is broken. (Bug#61663)
* test/lisp/net/tramp-tests.el (tramp-test39-make-lock-file-name):
Extend test.
Diffstat (limited to 'test/lisp/net/tramp-tests.el')
-rw-r--r-- | test/lisp/net/tramp-tests.el | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index f19847b0103..69004bdbdf3 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -6535,11 +6535,33 @@ INPUT, if non-nil, is a string sent to the process." (save-buffer) (should-not (buffer-modified-p))) (should-not (with-no-warnings (file-locked-p tmp-name1))) + + ;; `kill-buffer' removes the lock. (with-no-warnings (lock-file tmp-name1)) (should (eq (with-no-warnings (file-locked-p tmp-name1)) t)) + (with-temp-buffer + (set-visited-file-name tmp-name1) + (insert "foo") + (should (buffer-modified-p)) + (cl-letf (((symbol-function #'read-from-minibuffer) + (lambda (&rest _args) "yes"))) + (kill-buffer))) + (should-not (with-no-warnings (file-locked-p tmp-name1))) + ;; `kill-buffer' should not remove the lock when the + ;; connection is broken. See Bug#61663. + (with-no-warnings (lock-file tmp-name1)) + (should (eq (with-no-warnings (file-locked-p tmp-name1)) t)) + (with-temp-buffer + (set-visited-file-name tmp-name1) + (insert "foo") + (should (buffer-modified-p)) + (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) + (cl-letf (((symbol-function #'read-from-minibuffer) + (lambda (&rest _args) "yes"))) + (kill-buffer))) ;; A new connection changes process id, and also the - ;; lockname contents. + ;; lockname contents. But the lock file still exists. (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) (should (stringp (with-no-warnings (file-locked-p tmp-name1)))) |