mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Fix some `unwind-protect' forms
* lisp/net/tramp-smb.el (tramp-smb-handle-file-acl) (tramp-smb-handle-set-file-acl): Remove superfluous `unwind-protect'. * test/lisp/auth-source-tests.el (auth-source-test-secrets-create-secret): Fix `unwind-protect' handler. * test/lisp/net/tramp-tests.el (tramp-test38-find-backup-file-name): Add dummy cleanup form.
This commit is contained in:
parent
9a8d96da5c
commit
4a1df61946
3 changed files with 69 additions and 67 deletions
|
|
@ -800,32 +800,31 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
|
|||
(append args (list (tramp-unquote-shell-quote-argument localname)
|
||||
(concat "2>" (tramp-get-remote-null-device v)))))
|
||||
|
||||
(unwind-protect
|
||||
(with-tramp-saved-connection-properties
|
||||
v '("process-name" "process-buffer")
|
||||
(with-temp-buffer
|
||||
;; Set the transfer process properties.
|
||||
(tramp-set-connection-property
|
||||
v "process-name" (buffer-name (current-buffer)))
|
||||
(tramp-set-connection-property
|
||||
v "process-buffer" (current-buffer))
|
||||
(with-tramp-saved-connection-properties
|
||||
v '("process-name" "process-buffer")
|
||||
(with-temp-buffer
|
||||
;; Set the transfer process properties.
|
||||
(tramp-set-connection-property
|
||||
v "process-name" (buffer-name (current-buffer)))
|
||||
(tramp-set-connection-property
|
||||
v "process-buffer" (current-buffer))
|
||||
|
||||
;; Use an asynchronous process. By this, password
|
||||
;; can be handled.
|
||||
(let ((p (apply
|
||||
#'start-process
|
||||
(tramp-get-connection-name v)
|
||||
(tramp-get-connection-buffer v)
|
||||
tramp-smb-acl-program args)))
|
||||
;; Use an asynchronous process. By this, password
|
||||
;; can be handled.
|
||||
(let ((p (apply
|
||||
#'start-process
|
||||
(tramp-get-connection-name v)
|
||||
(tramp-get-connection-buffer v)
|
||||
tramp-smb-acl-program args)))
|
||||
|
||||
(tramp-message
|
||||
v 6 "%s" (string-join (process-command p) " "))
|
||||
(process-put p 'tramp-vector v)
|
||||
(process-put p 'adjust-window-size-function #'ignore)
|
||||
(set-process-query-on-exit-flag p nil)
|
||||
(tramp-process-actions p v nil tramp-smb-actions-get-acl)
|
||||
(when (> (point-max) (point-min))
|
||||
(substring-no-properties (buffer-string)))))))))))))
|
||||
(tramp-message
|
||||
v 6 "%s" (string-join (process-command p) " "))
|
||||
(process-put p 'tramp-vector v)
|
||||
(process-put p 'adjust-window-size-function #'ignore)
|
||||
(set-process-query-on-exit-flag p nil)
|
||||
(tramp-process-actions p v nil tramp-smb-actions-get-acl)
|
||||
(when (> (point-max) (point-min))
|
||||
(substring-no-properties (buffer-string))))))))))))
|
||||
|
||||
(defun tramp-smb-handle-file-attributes (filename &optional id-format)
|
||||
"Like `file-attributes' for Tramp files."
|
||||
|
|
@ -1401,44 +1400,43 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
|
|||
"&&" "echo" "tramp_exit_status" "0"
|
||||
"||" "echo" "tramp_exit_status" "1")))
|
||||
|
||||
(unwind-protect
|
||||
(with-tramp-saved-connection-properties
|
||||
v '("process-name" "process-buffer")
|
||||
(with-temp-buffer
|
||||
;; Set the transfer process properties.
|
||||
(tramp-set-connection-property
|
||||
v "process-name" (buffer-name (current-buffer)))
|
||||
(tramp-set-connection-property
|
||||
v "process-buffer" (current-buffer))
|
||||
(with-tramp-saved-connection-properties
|
||||
v '("process-name" "process-buffer")
|
||||
(with-temp-buffer
|
||||
;; Set the transfer process properties.
|
||||
(tramp-set-connection-property
|
||||
v "process-name" (buffer-name (current-buffer)))
|
||||
(tramp-set-connection-property
|
||||
v "process-buffer" (current-buffer))
|
||||
|
||||
;; Use an asynchronous process. By this, password
|
||||
;; can be handled.
|
||||
(let ((p (apply
|
||||
#'start-process
|
||||
(tramp-get-connection-name v)
|
||||
(tramp-get-connection-buffer v)
|
||||
tramp-smb-acl-program args)))
|
||||
;; Use an asynchronous process. By this, password
|
||||
;; can be handled.
|
||||
(let ((p (apply
|
||||
#'start-process
|
||||
(tramp-get-connection-name v)
|
||||
(tramp-get-connection-buffer v)
|
||||
tramp-smb-acl-program args)))
|
||||
|
||||
(tramp-message
|
||||
v 6 "%s" (string-join (process-command p) " "))
|
||||
(process-put p 'tramp-vector v)
|
||||
(process-put p 'adjust-window-size-function #'ignore)
|
||||
(set-process-query-on-exit-flag p nil)
|
||||
(tramp-process-actions p v nil tramp-smb-actions-set-acl)
|
||||
;; This is meant for traces, and returning from
|
||||
;; the function. No error is propagated outside,
|
||||
;; due to the `ignore-errors' closure.
|
||||
(unless
|
||||
(tramp-search-regexp (rx "tramp_exit_status " (+ digit)))
|
||||
(tramp-error
|
||||
v 'file-error
|
||||
"Couldn't find exit status of `%s'"
|
||||
tramp-smb-acl-program))
|
||||
(skip-chars-forward "^ ")
|
||||
(when (zerop (read (current-buffer)))
|
||||
;; Success.
|
||||
(tramp-set-file-property v localname "file-acl" acl-string)
|
||||
t))))))))))
|
||||
(tramp-message
|
||||
v 6 "%s" (string-join (process-command p) " "))
|
||||
(process-put p 'tramp-vector v)
|
||||
(process-put p 'adjust-window-size-function #'ignore)
|
||||
(set-process-query-on-exit-flag p nil)
|
||||
(tramp-process-actions p v nil tramp-smb-actions-set-acl)
|
||||
;; This is meant for traces, and returning from
|
||||
;; the function. No error is propagated outside,
|
||||
;; due to the `ignore-errors' closure.
|
||||
(unless
|
||||
(tramp-search-regexp (rx "tramp_exit_status " (+ digit)))
|
||||
(tramp-error
|
||||
v 'file-error
|
||||
"Couldn't find exit status of `%s'"
|
||||
tramp-smb-acl-program))
|
||||
(skip-chars-forward "^ ")
|
||||
(when (zerop (read (current-buffer)))
|
||||
;; Success.
|
||||
(tramp-set-file-property v localname "file-acl" acl-string)
|
||||
t)))))))))
|
||||
|
||||
(defun tramp-smb-handle-set-file-modes (filename mode &optional flag)
|
||||
"Like `set-file-modes' for Tramp files."
|
||||
|
|
|
|||
|
|
@ -341,13 +341,14 @@
|
|||
(should
|
||||
(string-equal (plist-get auth-info :user) (user-login-name)))
|
||||
(should (string-equal (plist-get auth-info :host) host))
|
||||
(should (string-equal auth-passwd passwd)))))
|
||||
(should (string-equal auth-passwd passwd))))
|
||||
|
||||
;; Cleanup.
|
||||
;; Should use `auth-source-delete' when implemented for :secrets backend.
|
||||
(secrets-delete-item
|
||||
"session"
|
||||
(format "%s@%s" (plist-get auth-info :user) (plist-get auth-info :host))))))
|
||||
;; Cleanup.
|
||||
;; Should use `auth-source-delete' when implemented for :secrets backend.
|
||||
(secrets-delete-item
|
||||
"session"
|
||||
(format
|
||||
"%s@%s" (plist-get auth-info :user) (plist-get auth-info :host)))))))
|
||||
|
||||
(ert-deftest auth-source-test-netrc-create-secret ()
|
||||
(ert-with-temp-file netrc-file
|
||||
|
|
|
|||
|
|
@ -6414,7 +6414,10 @@ INPUT, if non-nil, is a string sent to the process."
|
|||
(if quoted #'file-name-quote #'identity)
|
||||
(expand-file-name
|
||||
(format "%s~" (file-name-nondirectory tmp-name1))
|
||||
ert-remote-temporary-file-directory)))))))
|
||||
ert-remote-temporary-file-directory))))))
|
||||
|
||||
;; Cleanup.
|
||||
(ignore-errors))
|
||||
|
||||
(unwind-protect
|
||||
;; Map `backup-directory-alist'.
|
||||
|
|
|
|||
Loading…
Reference in a new issue