mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2026-09-10 15:56:35 -04:00
Sync with Tramp 2.8.3-pre (don't merge)
* doc/misc/tramp.texi (Auto-save File Lock and Backup): Adapt example. * doc/misc/trampver.texi: * lisp/net/trampver.el: Change version to "2.8.3-pre". * lisp/net/tramp-cmds.el (tramp-file-name-with-sudo): Expand the result for consistency. (Bug#81622) * lisp/net/tramp.el (with-tramp-progress-reporter): Let-bind `inhibit-message'. (tramp-file-name-for-operation): Fix the case, that the first argument is a process name. (tramp-handle-find-backup-file-name): Use connection-local value of `make-backup-files'. * test/lisp/net/tramp-tests.el (tramp-test38-find-backup-file-name): Extend test.
This commit is contained in:
parent
c0b872dd67
commit
57ad5ab8f7
|
|
@ -3380,13 +3380,23 @@ of the secretfile is now owned by the user logged in from
|
|||
When @code{backup-directory-alist} is @code{nil} (the default), such
|
||||
problems do not occur.
|
||||
|
||||
To ``turn off'' the backup feature for remote files and stop
|
||||
@value{tramp} from saving to the backup directory, use this:
|
||||
@vindex make-backup-files
|
||||
In case you do not want to use backup files for remote files, use
|
||||
connection-local variable @code{make-backup-files}
|
||||
@ifinfo
|
||||
(@pxref{Connection Variables, , , emacs})
|
||||
@end ifinfo
|
||||
like this:
|
||||
|
||||
@lisp
|
||||
@group
|
||||
(add-to-list 'backup-directory-alist
|
||||
(cons tramp-file-name-regexp nil))
|
||||
(connection-local-set-profile-variables
|
||||
'no-remote-backup-files '((make-backup-files . nil)))
|
||||
@end group
|
||||
|
||||
@group
|
||||
(connection-local-set-profiles
|
||||
'(:application tramp) 'no-remote-backup-files)
|
||||
@end group
|
||||
@end lisp
|
||||
|
||||
|
|
@ -3396,13 +3406,13 @@ Disabling backups can be targeted to just the @option{su} and
|
|||
|
||||
@lisp
|
||||
@group
|
||||
(setq backup-enable-predicate
|
||||
(lambda (name)
|
||||
(and (normal-backup-enable-predicate name)
|
||||
(not
|
||||
(let ((method (file-remote-p name 'method)))
|
||||
(when (stringp method)
|
||||
(member method '("su" "sudo"))))))))
|
||||
(connection-local-set-profiles
|
||||
'(:application tramp :protocol "su") 'no-remote-backup-files)
|
||||
@end group
|
||||
|
||||
@group
|
||||
(connection-local-set-profiles
|
||||
'(:application tramp :protocol "sudo") 'no-remote-backup-files)
|
||||
@end group
|
||||
@end lisp
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
@c In the Tramp GIT, the version number and the bug report address
|
||||
@c are auto-frobbed from configure.ac.
|
||||
@set trampver 2.8.2.31.1
|
||||
@set trampver 2.8.3-pre
|
||||
@set trampurl https://www.gnu.org/software/tramp/
|
||||
@set tramp-bug-report-address tramp-devel@@gnu.org
|
||||
@set emacsver 28.1
|
||||
|
|
|
|||
|
|
@ -678,33 +678,35 @@ Run BODY."
|
|||
"Convert FILENAME into a multi-hop file name with \"sudo\".
|
||||
An alternative method could be chosen with `tramp-file-name-with-method'."
|
||||
(setq filename (expand-file-name filename))
|
||||
(let ((default-method (tramp-get-file-name-with-method)))
|
||||
(if (tramp-tramp-file-p filename)
|
||||
(with-parsed-tramp-file-name filename nil
|
||||
(cond
|
||||
;; Remote file with proper method.
|
||||
((string-equal method default-method)
|
||||
filename)
|
||||
;; Remote file on the local host.
|
||||
((and
|
||||
(stringp tramp-local-host-regexp) (stringp host)
|
||||
(string-match-p tramp-local-host-regexp host))
|
||||
(tramp-make-tramp-file-name
|
||||
(make-tramp-file-name
|
||||
:method default-method :localname localname)))
|
||||
;; Remote file with multi-hop capable method.
|
||||
((tramp-multi-hop-p v)
|
||||
(tramp-make-tramp-file-name
|
||||
(make-tramp-file-name
|
||||
:method (tramp-find-method default-method nil host)
|
||||
:user (tramp-find-user default-method nil host)
|
||||
:host (tramp-find-host default-method nil host)
|
||||
:localname localname :hop (tramp-make-tramp-hop-name v))))
|
||||
;; Other remote file.
|
||||
(t (tramp-user-error v "Multi-hop with `%s' not applicable" method))))
|
||||
;; Local file.
|
||||
(tramp-make-tramp-file-name
|
||||
(make-tramp-file-name :method default-method :localname filename)))))
|
||||
(expand-file-name
|
||||
(let ((default-method (tramp-get-file-name-with-method)))
|
||||
(if (tramp-tramp-file-p filename)
|
||||
(with-parsed-tramp-file-name filename nil
|
||||
(cond
|
||||
;; Remote file with proper method.
|
||||
((string-equal method default-method)
|
||||
filename)
|
||||
;; Remote file on the local host.
|
||||
((and
|
||||
(stringp tramp-local-host-regexp) (stringp host)
|
||||
(string-match-p tramp-local-host-regexp host))
|
||||
(tramp-make-tramp-file-name
|
||||
(make-tramp-file-name
|
||||
:method default-method :localname localname)))
|
||||
;; Remote file with multi-hop capable method.
|
||||
((tramp-multi-hop-p v)
|
||||
(tramp-make-tramp-file-name
|
||||
(make-tramp-file-name
|
||||
:method (tramp-find-method default-method nil host)
|
||||
:user (tramp-find-user default-method nil host)
|
||||
:host (tramp-find-host default-method nil host)
|
||||
:localname localname :hop (tramp-make-tramp-hop-name v))))
|
||||
;; Other remote file.
|
||||
(t
|
||||
(tramp-user-error v "Multi-hop with `%s' not applicable" method))))
|
||||
;; Local file.
|
||||
(tramp-make-tramp-file-name
|
||||
(make-tramp-file-name :method default-method :localname filename))))))
|
||||
|
||||
;; FIXME: We would like to rename this for Emacs 31.1 to a name that
|
||||
;; does not encode the default method. It is intended as a generic
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
;;; Commentary:
|
||||
|
||||
;; Tramp's main Emacs version for development is Emacs 30. This
|
||||
;; Tramp's main Emacs version for development is Emacs 31. This
|
||||
;; package provides compatibility functions for Emacs 28, Emacs 29 and
|
||||
;; Emacs 30.
|
||||
|
||||
|
|
|
|||
|
|
@ -2259,10 +2259,13 @@ without a visible progress reporter."
|
|||
(or tramp-inhibit-progress-reporter tm)))
|
||||
,@body)
|
||||
(setq cookie "done"))
|
||||
;; Stop progress reporter.
|
||||
;; Stop progress reporter. We suppress the message in the
|
||||
;; message buffer and echo area; proper handling is performed
|
||||
;; by `tramp-message'.
|
||||
(when (and tm pr)
|
||||
(cancel-timer tm)
|
||||
(let (message-log-max)
|
||||
(let ((inhibit-message t)
|
||||
message-log-max)
|
||||
(progress-reporter-done pr)))
|
||||
(tramp-message ,vec ,level "%s...%s" ,message cookie)))))
|
||||
|
||||
|
|
@ -2575,7 +2578,9 @@ Must be handled by the callers."
|
|||
((bufferp (nth 0 args)) (get-buffer (nth 0 args)))
|
||||
((stringp (nth 0 args))
|
||||
;; Process or buffer name.
|
||||
(or (get-process (nth 0 args)) (get-buffer (nth 0 args)))))))
|
||||
(or (and-let* ((proc (get-process (nth 0 args))))
|
||||
(process-buffer proc))
|
||||
(get-buffer (nth 0 args)))))))
|
||||
(tramp-get-default-directory buf))
|
||||
""))
|
||||
|
||||
|
|
@ -4792,40 +4797,42 @@ existing) are returned."
|
|||
|
||||
(defun tramp-handle-find-backup-file-name (filename)
|
||||
"Like `find-backup-file-name' for Tramp files."
|
||||
(with-parsed-tramp-file-name filename nil
|
||||
(let ((backup-directory-alist
|
||||
(if tramp-backup-directory-alist
|
||||
(mapcar
|
||||
(lambda (x)
|
||||
(cons
|
||||
(car x)
|
||||
(if (and (stringp (cdr x))
|
||||
(file-name-absolute-p (cdr x))
|
||||
(not (tramp-tramp-file-p (cdr x))))
|
||||
(tramp-make-tramp-file-name v (cdr x))
|
||||
(cdr x))))
|
||||
tramp-backup-directory-alist)
|
||||
backup-directory-alist))
|
||||
result)
|
||||
(prog1 ;; Run plain `find-backup-file-name'.
|
||||
(setq result
|
||||
(tramp-run-real-handler
|
||||
#'find-backup-file-name (list filename)))
|
||||
;; Protect against security hole.
|
||||
(when (and (not tramp-allow-unsafe-temporary-files)
|
||||
(not backup-inhibited)
|
||||
(file-in-directory-p (car result) temporary-file-directory)
|
||||
(= (or (file-attribute-user-id
|
||||
(file-attributes filename 'integer))
|
||||
tramp-unknown-id-integer)
|
||||
tramp-root-id-integer)
|
||||
(not (with-tramp-connection-property
|
||||
(tramp-get-process v) "unsafe-temporary-file"
|
||||
(yes-or-no-p
|
||||
(concat
|
||||
"Backup file on local temporary directory, "
|
||||
"do you want to continue?")))))
|
||||
(tramp-error v 'file-error "Unsafe backup file name"))))))
|
||||
(when-let* ((default-directory (file-name-directory filename))
|
||||
((tramp-compat-connection-local-value make-backup-files)))
|
||||
(with-parsed-tramp-file-name filename nil
|
||||
(let ((backup-directory-alist
|
||||
(if tramp-backup-directory-alist
|
||||
(mapcar
|
||||
(lambda (x)
|
||||
(cons
|
||||
(car x)
|
||||
(if (and (stringp (cdr x))
|
||||
(file-name-absolute-p (cdr x))
|
||||
(not (tramp-tramp-file-p (cdr x))))
|
||||
(tramp-make-tramp-file-name v (cdr x))
|
||||
(cdr x))))
|
||||
tramp-backup-directory-alist)
|
||||
backup-directory-alist))
|
||||
result)
|
||||
(prog1 ;; Run plain `find-backup-file-name'.
|
||||
(setq result
|
||||
(tramp-run-real-handler
|
||||
#'find-backup-file-name (list filename)))
|
||||
;; Protect against security hole.
|
||||
(when (and (not tramp-allow-unsafe-temporary-files)
|
||||
(not backup-inhibited)
|
||||
(file-in-directory-p (car result) temporary-file-directory)
|
||||
(= (or (file-attribute-user-id
|
||||
(file-attributes filename 'integer))
|
||||
tramp-unknown-id-integer)
|
||||
tramp-root-id-integer)
|
||||
(not (with-tramp-connection-property
|
||||
(tramp-get-process v) "unsafe-temporary-file"
|
||||
(yes-or-no-p
|
||||
(concat
|
||||
"Backup file on local temporary directory, "
|
||||
"do you want to continue?")))))
|
||||
(tramp-error v 'file-error "Unsafe backup file name")))))))
|
||||
|
||||
(defun tramp-handle-insert-directory
|
||||
(filename switches &optional wildcard full-directory-p)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
|
||||
;; Keywords: comm, processes
|
||||
;; Package: tramp
|
||||
;; Version: 2.8.2.31.1
|
||||
;; Version: 2.8.3-pre
|
||||
;; Package-Requires: ((emacs "28.1"))
|
||||
;; Package-Type: multi
|
||||
;; URL: https://www.gnu.org/software/tramp/
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
;; ./configure" to change them.
|
||||
|
||||
;;;###tramp-autoload
|
||||
(defconst tramp-version "2.8.2.31.1"
|
||||
(defconst tramp-version "2.8.3-pre"
|
||||
"This version of Tramp.")
|
||||
|
||||
;;;###tramp-autoload
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
;; Check for Emacs version.
|
||||
(let ((x (if (not (string-version-lessp emacs-version "28.1"))
|
||||
"ok"
|
||||
(format "Tramp 2.8.2.31.1 is not fit for %s"
|
||||
(format "Tramp 2.8.3-pre is not fit for %s"
|
||||
(replace-regexp-in-string "\n" "" (emacs-version))))))
|
||||
(unless (string-equal "ok" x) (error "%s" x)))
|
||||
|
||||
|
|
|
|||
|
|
@ -7361,7 +7361,25 @@ INPUT, if non-nil, is a string sent to the process."
|
|||
|
||||
;; Cleanup.
|
||||
(ignore-errors (delete-file tmp-name1))
|
||||
(tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password)))))
|
||||
(tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password))
|
||||
|
||||
;; Check connection-local `make-backup-files'.
|
||||
(let ((clpa connection-local-profile-alist)
|
||||
(clca connection-local-criteria-alist))
|
||||
(connection-local-set-profile-variables
|
||||
'no-remote-backup-files '((make-backup-files . nil)))
|
||||
(connection-local-set-profiles
|
||||
`(:application tramp
|
||||
:protocol ,(file-remote-p default-directory 'method)
|
||||
:user ,(file-remote-p default-directory 'user)
|
||||
:machine ,(file-remote-p default-directory 'host))
|
||||
'no-remote-backup-files)
|
||||
|
||||
(should-not (find-backup-file-name tmp-name1))
|
||||
|
||||
(custom-set-variables
|
||||
`(connection-local-profile-alist ',clpa now)
|
||||
`(connection-local-criteria-alist ',clca now))))))
|
||||
|
||||
(ert-deftest tramp-test39-make-lock-file-name ()
|
||||
"Check `make-lock-file-name', `lock-file', `unlock-file' and `file-locked-p'."
|
||||
|
|
|
|||
Loading…
Reference in a new issue