1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-29 07:58:28 +00:00

Tramp requires Emacs 24.4

* doc/misc/tramp.texi (Frequently Asked Questions):
Use `with-eval-after-load'. in example.

* doc/misc/trampver.texi: Set variable emacsver.

* lisp/net/tramp.el (tramp-send-string, tramp-call-process)
(tramp-call-process-region, tramp-process-lines):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-truename)
(tramp-adb-sh-fix-ls-output, tramp-adb-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-get-directory-attributes)
(tramp-gvfs-handle-file-notify-add-watch)
* lisp/net/tramp-sh.el (tramp-sh-handle-file-truename)
(tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-file-notify-add-watch, tramp-find-executable)
(tramp-set-remote-path)
(tramp-open-connection-setup-interactive-shell)
(tramp-maybe-open-connection, tramp-send-command):
* lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory)
(tramp-smb-handle-file-acl, tramp-smb-handle-process-file)
(tramp-smb-handle-set-file-acl)
(tramp-smb-handle-start-file-process)
(tramp-smb-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-acl):
(tramp-sudoedit-send-command): Use `string-join' and `string-empty-p'.

* lisp/net/tramp-adb.el:
* lisp/net/tramp-archive.el:
* lisp/net/tramp-integration.el:
* lisp/net/tramp-ftp.el: Use `with-eval-after-load'.

* lisp/net/tramp-cmds.el (tramp-cleanup-connection)
(tramp-cleanup-all-connections): Cancel timer.

* lisp/net/tramp-compat.el (subr-x): Require.
(default-toplevel-value): Don't make it a defalias.

* lisp/net/tramp-gvfs.el: Use `dbus-event-error-functions'.  Do
not special handle `split-string'.

* lisp/net/tramp.el: Require Emacs 24.4.
(tramp-password-prompt-regexp): Use `password-word-equivalents'.
(tramp-user-error): Use `user-error'.
(tramp-replace-environment-variables): Use `substitute-env-vars'.
(tramp-wait-for-regexp): Rearrange `with-current-buffer' call.
(tramp-get-local-gid): Use `group-gid'.

* lisp/net/trampver.el: Check for Emacs 24.4.

* test/lisp/net/tramp-tests.el (tramp-test02-file-name-dissect)
(tramp-test02-file-name-dissect-simplified)
(tramp-test02-file-name-dissect-separate)
(tramp-test03-file-name-host-rules)
(tramp-test03-file-name-method-rules): Don't check for `user-error'.
This commit is contained in:
Michael Albinus 2019-06-28 16:32:12 +02:00
parent c534a4a336
commit aae5bf4438
15 changed files with 150 additions and 210 deletions

View File

@ -4204,10 +4204,8 @@ directory to the cache:
@lisp
@group
@c `with-eval-after-load' has been introduced with Emacs 24.4. Shall
@c be used when appropriate.
(eval-after-load "filecache"
'(file-cache-add-directory
(with-eval-after-load 'filecache
(file-cache-add-directory
"@trampfn{ssh,news@@news.my.domain,/opt/news/etc/}"))
@end group
@end lisp

View File

@ -5,10 +5,12 @@
@c Copyright (C) 2003-2019 Free Software Foundation, Inc.
@c See file doclicense.texi for copying conditions.
@c In the Tramp GIT, the version number is auto-frobbed from tramp.el,
@c and the bug report address is auto-frobbed from configure.ac.
@c In the Tramp GIT, the version numbers are auto-frobbed from
@c tramp.el, and the bug report address is auto-frobbed from
@c configure.ac.
@set trampver 2.4.2-pre
@set tramp-bug-report-address tramp-devel@@gnu.org
@set emacsver 24.4
@c Other flags from configuration.
@set instprefix /usr/local

View File

@ -257,17 +257,15 @@ pass to the OPERATION."
(setq thisstep (pop steps))
(tramp-message
v 5 "Check %s"
(mapconcat #'identity
(append '("") (reverse result) (list thisstep))
"/"))
(string-join
(append '("") (reverse result) (list thisstep)) "/"))
(setq symlink-target
(tramp-compat-file-attribute-type
(file-attributes
(tramp-make-tramp-file-name
v (mapconcat #'identity
(append
'("") (reverse result) (list thisstep))
"/")))))
v
(string-join
(append '("") (reverse result) (list thisstep)) "/")))))
(cond ((string= "." thisstep)
(tramp-message v 5 "Ignoring step `.'"))
((string= ".." thisstep)
@ -302,9 +300,9 @@ pass to the OPERATION."
;; Combine list to form string.
(setq result
(if result
(mapconcat #'identity (cons "" result) "/")
(string-join (cons "" result) "/")
"/"))
(when (and is-dir (or (string= "" result)
(when (and is-dir (or (string-empty-p result)
(not (string= (substring result -1) "/"))))
(setq result (concat result "/"))))
@ -479,7 +477,7 @@ Emacs dired can't find files."
#'tramp-adb-ls-output-time-less-p
#'tramp-adb-ls-output-name-less-p))))
(delete-region (point-min) (point-max))
(insert " " (mapconcat #'identity sorted-lines "\n ")))
(insert " " (string-join sorted-lines "\n ")))
;; Add final newline.
(goto-char (point-max))
(unless (bolp) (insert "\n"))))
@ -1232,7 +1230,7 @@ connection if a previous connection has died for some reason."
(prompt (md5 (concat (prin1-to-string process-environment)
(current-time-string)))))
(tramp-message
vec 6 "%s" (mapconcat #'identity (process-command p) " "))
vec 6 "%s" (string-join (process-command p) " "))
;; Wait for initial prompt. On some devices, it needs an
;; initial RET, in order to get it.
(sleep-for 0.1)
@ -1300,16 +1298,16 @@ connection if a previous connection has died for some reason."
;; `connection-local-set-profile-variables' and
;; `connection-local-set-profiles' exists since Emacs 26.1.
(eval-after-load "shell"
'(progn
(tramp-compat-funcall
'connection-local-set-profile-variables
'tramp-adb-connection-local-default-profile
tramp-adb-connection-local-default-profile)
(tramp-compat-funcall
'connection-local-set-profiles
`(:application tramp :protocol ,tramp-adb-method)
'tramp-adb-connection-local-default-profile)))
(with-eval-after-load 'shell
(progn
(tramp-compat-funcall
'connection-local-set-profile-variables
'tramp-adb-connection-local-default-profile
tramp-adb-connection-local-default-profile)
(tramp-compat-funcall
'connection-local-set-profiles
`(:application tramp :protocol ,tramp-adb-method)
'tramp-adb-connection-local-default-profile)))
(add-hook 'tramp-unload-hook
(lambda ()

View File

@ -372,14 +372,14 @@ pass to the OPERATION."
;; `tramp-archive-file-name-handler' must be placed before `url-file-handler'.
(when url-handler-mode (tramp-register-file-name-handlers))
(eval-after-load 'url-handler
'(progn
(add-hook 'url-handler-mode-hook #'tramp-register-file-name-handlers)
(add-hook
'tramp-archive-unload-hook
(lambda ()
(remove-hook
'url-handler-mode-hook #'tramp-register-file-name-handlers)))))
(with-eval-after-load 'url-handler
(progn
(add-hook 'url-handler-mode-hook #'tramp-register-file-name-handlers)
(add-hook
'tramp-archive-unload-hook
(lambda ()
(remove-hook
'url-handler-mode-hook #'tramp-register-file-name-handlers)))))
;; File name conversions.

View File

@ -116,6 +116,12 @@ When called interactively, a Tramp connection has to be selected."
(delete-process (tramp-get-connection-process vec)))
(tramp-flush-connection-properties vec)
;; Cancel timer.
(dolist (timer timer-list)
(when (and (eq (timer--function timer) 'tramp-timeout-session)
(tramp-file-name-equal-p vec (car (timer--args timer))))
(cancel-timer timer)))
;; Remove buffers.
(dolist
(buf (list (get-buffer (tramp-buffer-name vec))
@ -163,9 +169,12 @@ This includes password cache, file cache, connection cache, buffers."
(delete (car proxies) tramp-default-proxies-alist)
proxies tramp-default-proxies-alist)
(setq proxies (cdr proxies)))))
(when (and tramp-default-proxies-alist tramp-save-ad-hoc-proxies)
(customize-save-variable
'tramp-default-proxies-alist tramp-default-proxies-alist))
(when (and tramp-default-proxies-alist tramp-save-ad-hoc-proxies)
(customize-save-variable
'tramp-default-proxies-alist tramp-default-proxies-alist))
;; Cancel timers.
(cancel-function-timers 'tramp-timeout-session)
;; Remove buffers.
(dolist (name (tramp-list-tramp-buffers))

View File

@ -39,6 +39,7 @@
(require 'ls-lisp) ;; Due to `tramp-handle-insert-directory'.
(require 'parse-time)
(require 'shell)
(require 'subr-x)
(declare-function tramp-handle-temporary-file-directory "tramp")
@ -81,7 +82,7 @@ Add the extension of F, if existing."
((fboundp 'w32-window-exists-p)
(tramp-compat-funcall 'w32-window-exists-p process-name process-name))
;; GNU Emacs 23.
;; GNU Emacs 23+.
((and (fboundp 'list-system-processes) (fboundp 'process-attributes))
(let (result)
(dolist (pid (tramp-compat-funcall 'list-system-processes) result)
@ -97,10 +98,6 @@ Add the extension of F, if existing."
process-name))))
(setq result t)))))))))
;; `default-toplevel-value' has been declared in Emacs 24.4.
(unless (fboundp 'default-toplevel-value)
(defalias 'default-toplevel-value #'symbol-value))
;; `file-attribute-*' are introduced in Emacs 25.1.
(defalias 'tramp-compat-file-attribute-type
@ -306,9 +303,4 @@ A nil value for either argument stands for the current time."
(provide 'tramp-compat)
;;; TODO:
;; * When we get rid of Emacs 24, replace "(mapconcat #'identity" by
;; "(string-join".
;;; tramp-compat.el ends here

View File

@ -53,8 +53,8 @@ present for backward compatibility."
(setq file-name-handler-alist
(delete a1 (delete a2 file-name-handler-alist)))))
(eval-after-load "ange-ftp"
'(tramp-disable-ange-ftp))
(with-eval-after-load 'ange-ftp
(tramp-disable-ange-ftp))
;;;###tramp-autoload
(defun tramp-ftp-enable-ange-ftp ()

View File

@ -724,12 +724,7 @@ is no information where to trace the message.")
(tramp-message tramp-gvfs-dbus-event-vector 6 "%S" event)
(tramp-error tramp-gvfs-dbus-event-vector 'file-error "%s" (cadr err))))
;; `dbus-event-error-hooks' has been renamed to
;; `dbus-event-error-functions' in Emacs 24.3.
(add-hook
(if (boundp 'dbus-event-error-functions)
'dbus-event-error-functions 'dbus-event-error-hooks)
#'tramp-gvfs-dbus-event-error)
(add-hook 'dbus-event-error-functions #'tramp-gvfs-dbus-event-error)
;; File name primitives.
@ -942,7 +937,7 @@ file names."
;; Send command.
(tramp-gvfs-send-command
v "gvfs-ls" "-h" "-n" "-a"
(mapconcat #'identity tramp-gvfs-file-attributes ",")
(string-join tramp-gvfs-file-attributes ",")
(tramp-gvfs-url-file-name directory))
;; Parse output.
(with-current-buffer (tramp-get-connection-buffer v)
@ -1183,7 +1178,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
(tramp-error
v 'file-notify-error "Monitoring not supported for `%s'" file-name)
(tramp-message
v 6 "Run `%s', %S" (mapconcat #'identity (process-command p) " ") p)
v 6 "Run `%s', %S" (string-join (process-command p) " ") p)
(process-put p 'vector v)
(process-put p 'events events)
(process-put p 'watch-name localname)
@ -1997,15 +1992,12 @@ VEC is used only for traces."
(list user host)))
(zeroconf-list-services service)))
;; We use the TRIM argument of `split-string', which exist since Emacs
;; 24.4. I mask this for older Emacs versions, there is no harm.
(defun tramp-gvfs-parse-device-names (service)
"Return a list of (user host) tuples allowed to access.
This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi."
(let ((result
(ignore-errors
(tramp-compat-funcall
'split-string
(split-string
(shell-command-to-string (format "avahi-browse -trkp %s" service))
"[\n\r]+" 'omit "^\\+;.*$"))))
(delete-dups
@ -2013,8 +2005,7 @@ This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi."
(lambda (x)
(let* ((list (split-string x ";"))
(host (nth 6 list))
(text (tramp-compat-funcall
'split-string (nth 9 list) "\" \"" 'omit "\""))
(text (split-string (nth 9 list) "\" \"" 'omit "\""))
user)
;; A user is marked in a TXT field like "u=guest".
(while text

View File

@ -123,18 +123,18 @@ been set up by `rfn-eshadow-setup-minibuffer'."
(mapconcat
#'identity (butlast (tramp-compat-exec-path)) path-separator)))
(eval-after-load "esh-util"
'(progn
(add-hook 'eshell-mode-hook
#'tramp-eshell-directory-change)
(add-hook 'eshell-directory-change-hook
#'tramp-eshell-directory-change)
(add-hook 'tramp-integration-unload-hook
(lambda ()
(remove-hook 'eshell-mode-hook
#'tramp-eshell-directory-change)
(remove-hook 'eshell-directory-change-hook
#'tramp-eshell-directory-change)))))
(with-eval-after-load 'esh-util
(progn
(add-hook 'eshell-mode-hook
#'tramp-eshell-directory-change)
(add-hook 'eshell-directory-change-hook
#'tramp-eshell-directory-change)
(add-hook 'tramp-integration-unload-hook
(lambda ()
(remove-hook 'eshell-mode-hook
#'tramp-eshell-directory-change)
(remove-hook 'eshell-directory-change-hook
#'tramp-eshell-directory-change)))))
;;; Integration of recentf.el:
@ -158,18 +158,18 @@ NAME must be equal to `tramp-current-connection'."
(let ((recentf-exclude '(file-remote-p)))
(recentf-cleanup))))
(eval-after-load "recentf"
'(progn
(add-hook 'tramp-cleanup-connection-hook
#'tramp-recentf-cleanup)
(add-hook 'tramp-cleanup-all-connections-hook
#'tramp-recentf-cleanup-all)
(add-hook 'tramp-integration-unload-hook
(lambda ()
(remove-hook 'tramp-cleanup-connection-hook
#'tramp-recentf-cleanup)
(remove-hook 'tramp-cleanup-all-connections-hook
#'tramp-recentf-cleanup-all)))))
(with-eval-after-load 'recentf
(progn
(add-hook 'tramp-cleanup-connection-hook
#'tramp-recentf-cleanup)
(add-hook 'tramp-cleanup-all-connections-hook
#'tramp-recentf-cleanup-all)
(add-hook 'tramp-integration-unload-hook
(lambda ()
(remove-hook 'tramp-cleanup-connection-hook
#'tramp-recentf-cleanup)
(remove-hook 'tramp-cleanup-all-connections-hook
#'tramp-recentf-cleanup-all)))))
;;; Default connection-local variables for Tramp:
@ -180,16 +180,16 @@ NAME must be equal to `tramp-current-connection'."
;; `connection-local-set-profile-variables' and
;; `connection-local-set-profiles' exists since Emacs 26.1.
(eval-after-load "shell"
'(progn
(tramp-compat-funcall
'connection-local-set-profile-variables
'tramp-connection-local-default-profile
tramp-connection-local-default-profile)
(tramp-compat-funcall
'connection-local-set-profiles
`(:application tramp)
'tramp-connection-local-default-profile)))
(with-eval-after-load 'shell
(progn
(tramp-compat-funcall
'connection-local-set-profile-variables
'tramp-connection-local-default-profile
tramp-connection-local-default-profile)
(tramp-compat-funcall
'connection-local-set-profiles
`(:application tramp)
'tramp-connection-local-default-profile)))
(add-hook 'tramp-unload-hook
(lambda () (unload-feature 'tramp-integration 'force)))

View File

@ -1135,19 +1135,15 @@ component is used as the target of the symlink."
(setq thisstep (pop steps))
(tramp-message
v 5 "Check %s"
(mapconcat #'identity
(append '("") (reverse result) (list thisstep))
"/"))
(string-join
(append '("") (reverse result) (list thisstep)) "/"))
(setq symlink-target
(tramp-compat-file-attribute-type
(file-attributes
(tramp-make-tramp-file-name
v
(mapconcat #'identity
(append '("")
(reverse result)
(list thisstep))
"/")
(string-join
(append '("") (reverse result) (list thisstep)) "/")
'nohop))))
(cond ((string= "." thisstep)
(tramp-message v 5 "Ignoring step `.'"))
@ -1173,12 +1169,8 @@ component is used as the target of the symlink."
"Maximum number (%d) of symlinks exceeded" numchase-limit))
(setq result (reverse result))
;; Combine list to form string.
(setq result
(if result
(mapconcat #'identity (cons "" result) "/")
"/"))
(when (string= "" result)
(setq result "/")))))
(setq result (if result (string-join (cons "" result) "/") "/"))
(when (string-empty-p result) (setq result "/")))))
;; Detect cycle.
(when (and (file-symlink-p filename)
@ -1993,7 +1985,6 @@ file names."
(t2 (tramp-tramp-file-p newname))
(length (tramp-compat-file-attribute-size
(file-attributes (file-truename filename))))
;; `file-extended-attributes' exists since Emacs 24.4.
(attributes (and preserve-extended-attributes
(apply #'file-extended-attributes (list filename)))))
@ -2065,7 +2056,6 @@ file names."
;; Handle `preserve-extended-attributes'. We ignore possible
;; errors, because ACL strings could be incompatible.
;; `set-file-extended-attributes' exists since Emacs 24.4.
(when attributes
(ignore-errors
(apply #'set-file-extended-attributes (list newname attributes))))
@ -2364,7 +2354,7 @@ The method used must be an out-of-band method."
(mapcar
(lambda (x)
(setq x (mapcar (lambda (y) (format-spec y spec)) x))
(unless (member "" x) (mapconcat #'identity x " ")))
(unless (member "" x) (string-join x " ")))
(tramp-get-method-parameter v 'tramp-copy-env)))
remote-copy-program
@ -3636,8 +3626,8 @@ Fall back to normal file name handler if no Tramp handler exists."
(tramp-error
v 'file-notify-error
"`%s' failed to start on remote host"
(mapconcat #'identity sequence " "))
(tramp-message v 6 "Run `%s', %S" (mapconcat #'identity sequence " ") p)
(string-join sequence " "))
(tramp-message v 6 "Run `%s', %S" (string-join sequence " ") p)
(process-put p 'vector v)
;; Needed for process filter.
(process-put p 'events events)
@ -3928,7 +3918,7 @@ This function expects to be in the right *tramp* buffer."
"%s\n%s"))
progname progname progname
tramp-end-of-heredoc
(mapconcat #'identity dirlist "\n")
(string-join dirlist "\n")
tramp-end-of-heredoc))
(goto-char (point-max))
(when (search-backward "tramp_executable " nil t)
@ -3946,8 +3936,8 @@ I.e., for each directory in `tramp-remote-path', it is tested
whether it exists and if so, it is added to the environment
variable PATH."
(let ((command
(format "PATH=%s; export PATH"
(mapconcat #'identity (tramp-get-remote-path vec) ":")))
(format
"PATH=%s; export PATH" (string-join (tramp-get-remote-path vec) ":")))
(pipe-buf
(or (with-tramp-connection-property vec "pipe-buf"
(tramp-send-command-and-read
@ -4290,7 +4280,7 @@ process to set up. VEC specifies the connection."
(append `(,(tramp-get-remote-locale vec))
(copy-sequence tramp-remote-process-environment))))
(setq item (split-string item "=" 'omit))
(setcdr item (mapconcat #'identity (cdr item) "="))
(setcdr item (string-join (cdr item) "="))
(if (and (stringp (cdr item)) (not (string-equal (cdr item) "")))
(push (format "%s %s" (car item) (cdr item)) vars)
(push (car item) unset)))
@ -4300,12 +4290,12 @@ process to set up. VEC specifies the connection."
(format
"while read var val; do export $var=\"$val\"; done <<'%s'\n%s\n%s"
tramp-end-of-heredoc
(mapconcat #'identity vars "\n")
(string-join vars "\n")
tramp-end-of-heredoc)
t))
(when unset
(tramp-send-command
vec (format "unset %s" (mapconcat #'identity unset " ")) t)))))
vec (format "unset %s" (string-join unset " ")) t)))))
;; Old text from documentation of tramp-methods:
;; Using a uuencode/uudecode inline method is discouraged, please use one
@ -4873,8 +4863,7 @@ connection if a previous connection has died for some reason."
(set-process-query-on-exit-flag p nil)
(setq tramp-current-connection (cons vec (current-time)))
(tramp-message
vec 6 "%s" (mapconcat #'identity (process-command p) " "))
(tramp-message vec 6 "%s" (string-join (process-command p) " "))
;; Check whether process is alive.
(tramp-barf-if-no-shell-prompt
@ -4951,7 +4940,7 @@ connection if a previous connection has died for some reason."
(mapcar
(lambda (x)
(setq x (mapcar (lambda (y) (format-spec y spec)) x))
(unless (member "" x) (mapconcat #'identity x " ")))
(unless (member "" x) (string-join x " ")))
login-env))
(while login-env
(setq command
@ -4980,7 +4969,7 @@ connection if a previous connection has died for some reason."
(mapconcat
(lambda (x)
(setq x (mapcar (lambda (y) (format-spec y spec)) x))
(unless (member "" x) (mapconcat #'identity x " ")))
(unless (member "" x) (string-join x " ")))
login-args " ")
;; Local shell could be a Windows COMSPEC. It
;; doesn't know the ";" syntax, but we must exit
@ -5041,7 +5030,7 @@ function waits for output unless NOOUTPUT is set."
;; `tramp-echo-mark', so the remote shell sees two consecutive
;; trailing line endings and sends two prompts after executing
;; the command, which confuses `tramp-wait-for-output'.
(when (and (not (string= command ""))
(when (and (not (string-empty-p command))
(string-equal (substring command -1) "\n"))
(setq command (substring command 0 -1)))
;; No need to restore a trailing newline here since `tramp-send-string'

View File

@ -513,7 +513,7 @@ pass to the OPERATION."
tramp-smb-program args)))
(tramp-message
v 6 "%s" (mapconcat #'identity (process-command p) " "))
v 6 "%s" (string-join (process-command p) " "))
(process-put p 'vector v)
(process-put p 'adjust-window-size-function #'ignore)
(set-process-query-on-exit-flag p nil)
@ -774,7 +774,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
tramp-smb-acl-program args)))
(tramp-message
v 6 "%s" (mapconcat #'identity (process-command p) " "))
v 6 "%s" (string-join (process-command p) " "))
(process-put p 'vector v)
(process-put p 'adjust-window-size-function #'ignore)
(set-process-query-on-exit-flag p nil)
@ -1258,7 +1258,7 @@ component is used as the target of the symlink."
(setq outbuf (current-buffer))))
;; Construct command.
(setq command (mapconcat #'identity (cons program args) " ")
(setq command (string-join (cons program args) " ")
command (if input
(format
"get-content %s | & %s"
@ -1425,8 +1425,7 @@ component is used as the target of the symlink."
(tramp-get-connection-buffer v)
tramp-smb-acl-program args)))
(tramp-message
v 6 "%s" (mapconcat #'identity (process-command p) " "))
(tramp-message v 6 "%s" (string-join (process-command p) " "))
(process-put p 'vector v)
(process-put p 'adjust-window-size-function #'ignore)
(set-process-query-on-exit-flag p nil)
@ -1470,7 +1469,7 @@ component is used as the target of the symlink."
(get-buffer-create buffer)
;; BUFFER can be nil. We use a temporary buffer.
(generate-new-buffer tramp-temp-buffer-name)))
(command (mapconcat #'identity (cons program args) " "))
(command (string-join (cons program args) " "))
(bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
(name1 name)
(i 0))
@ -1965,8 +1964,7 @@ If ARGUMENT is non-nil, use it as argument for
tramp-smb-winexe-program tramp-smb-program)
args))))
(tramp-message
vec 6 "%s" (mapconcat #'identity (process-command p) " "))
(tramp-message vec 6 "%s" (string-join (process-command p) " "))
(process-put p 'vector vec)
(process-put p 'adjust-window-size-function #'ignore)
(set-process-query-on-exit-flag p nil)
@ -2039,8 +2037,8 @@ Removes smb prompt. Returns nil if an error message has appeared."
;; Read pending output.
(while (not (re-search-forward tramp-smb-prompt nil t))
(while (tramp-accept-process-output p 0)
(goto-char (point-min))))
(while (tramp-accept-process-output p 0))
(goto-char (point-min)))
(tramp-message vec 6 "\n%s" (buffer-string))
;; Remove prompt.

View File

@ -232,7 +232,6 @@ absolute file names."
(file-times (tramp-compat-file-attribute-modification-time
(file-attributes filename)))
(file-modes (tramp-default-file-modes filename))
;; `file-extended-attributes' exists since Emacs 24.4.
(attributes (and preserve-extended-attributes
(apply #'file-extended-attributes (list filename))))
(sudoedit-operation
@ -284,7 +283,6 @@ absolute file names."
;; Handle `preserve-extended-attributes'. We ignore possible
;; errors, because ACL strings could be incompatible.
;; `set-file-extended-attributes' exists since Emacs 24.4.
(when attributes
(ignore-errors
(apply #'set-file-extended-attributes (list newname attributes))))
@ -660,8 +658,7 @@ component is used as the target of the symlink."
(with-parsed-tramp-file-name (expand-file-name filename) nil
(when (and (stringp acl-string) (tramp-sudoedit-remote-acl-p v))
;; Massage `acl-string'.
(setq acl-string
(mapconcat #'identity (split-string acl-string "\n" 'omit) ","))
(setq acl-string (string-join (split-string acl-string "\n" 'omit) ","))
(prog1
(tramp-sudoedit-send-command
v "setfacl" "-m"
@ -830,7 +827,7 @@ in case of error, t otherwise."
(tramp-verbose (if (= tramp-verbose 3) 2 tramp-verbose))
;; We do not want to save the password.
auth-source-save-behavior)
(tramp-message vec 6 "%s" (mapconcat #'identity (process-command p) " "))
(tramp-message vec 6 "%s" (string-join (process-command p) " "))
;; Avoid process status message in output buffer.
(set-process-sentinel p #'ignore)
(process-put p 'vector vec)

View File

@ -8,7 +8,7 @@
;; Keywords: comm, processes
;; Package: tramp
;; Version: 2.4.2-pre
;; Package-Requires: ((emacs "24.1"))
;; Package-Requires: ((emacs "24.4"))
;; URL: https://savannah.gnu.org/projects/tramp
;; This file is part of GNU Emacs.
@ -572,10 +572,7 @@ This regexp must match both `tramp-initial-end-of-output' and
:type 'regexp)
(defcustom tramp-password-prompt-regexp
(format "^.*\\(%s\\).*:\^@? *"
;; `password-word-equivalents' has been introduced with Emacs 24.4.
(regexp-opt (or (bound-and-true-p password-word-equivalents)
'("password" "passphrase"))))
(format "^.*\\(%s\\).*:\^@? *" (regexp-opt password-word-equivalents))
"Regexp matching password-like prompts.
The regexp should match at end of buffer.
@ -1862,10 +1859,7 @@ an input event arrives. The other arguments are passed to `tramp-error'."
(defun tramp-user-error (vec-or-proc fmt-string &rest arguments)
"Signal a user error (or \"pilot error\")."
(unwind-protect
(apply
#'tramp-error vec-or-proc
;; `user-error' has appeared in Emacs 24.3.
(if (fboundp 'user-error) 'user-error 'error) fmt-string arguments)
(apply #'tramp-error vec-or-proc 'user-error fmt-string arguments)
;; Save exit.
(when (and tramp-message-show-message
(not (zerop tramp-verbose))
@ -2103,21 +2097,7 @@ value of `default-file-modes', without execute permissions."
(defun tramp-replace-environment-variables (filename)
"Replace environment variables in FILENAME.
Return the string with the replaced variables."
(or (ignore-errors
;; Optional arg has been introduced with Emacs 24.4.
(tramp-compat-funcall 'substitute-env-vars filename 'only-defined))
;; We need an own implementation.
(save-match-data
(let ((idx (string-match "\\$\\(\\w+\\)" filename)))
;; `$' is coded as `$$'.
(when (and idx
(or (zerop idx) (not (eq ?$ (aref filename (1- idx)))))
(getenv (match-string 1 filename)))
(setq filename
(replace-match
(substitute-in-file-name (match-string 0 filename))
t nil filename)))
filename))))
(substitute-env-vars filename 'only-defined))
(defun tramp-find-file-name-coding-system-alist (filename tmpname)
"Like `find-operation-coding-system' for Tramp filenames.
@ -4149,31 +4129,34 @@ Erase echoed commands if exists."
Expects the output of PROC to be sent to the current buffer. Returns
the string that matched, or nil. Waits indefinitely if TIMEOUT is
nil."
(with-current-buffer (process-buffer proc)
(let ((found (tramp-check-for-regexp proc regexp)))
(cond (timeout
(with-timeout (timeout)
(while (not found)
(tramp-accept-process-output proc)
(unless (process-live-p proc)
(tramp-error-with-buffer
nil proc 'file-error "Process has died"))
(setq found (tramp-check-for-regexp proc regexp)))))
(t
(let ((found (tramp-check-for-regexp proc regexp)))
(cond (timeout
(with-timeout (timeout)
(while (not found)
(tramp-accept-process-output proc)
(unless (process-live-p proc)
(tramp-error-with-buffer
nil proc 'file-error "Process has died"))
(setq found (tramp-check-for-regexp proc regexp)))))
(tramp-message proc 6 "\n%s" (buffer-string))
(unless found
(if timeout
(tramp-error
proc 'file-error "[[Regexp `%s' not found in %d secs]]"
regexp timeout)
(tramp-error proc 'file-error "[[Regexp `%s' not found]]" regexp)))
found)))
(t
(while (not found)
(tramp-accept-process-output proc)
(unless (process-live-p proc)
(tramp-error-with-buffer
nil proc 'file-error "Process has died"))
(setq found (tramp-check-for-regexp proc regexp)))))
;; The process could have timed out, for example due to session
;; timeout of sudo. The process buffer does not exist any longer then.
(ignore-errors
(with-current-buffer (process-buffer proc)
(tramp-message proc 6 "\n%s" (buffer-string))))
(unless found
(if timeout
(tramp-error
proc 'file-error "[[Regexp `%s' not found in %d secs]]"
regexp timeout)
(tramp-error proc 'file-error "[[Regexp `%s' not found]]" regexp)))
found))
;; It seems that Tru64 Unix does not like it if long strings are sent
;; to it in one go. (This happens when sending the Perl
@ -4200,7 +4183,7 @@ the remote host use line-endings as defined in the variable
(setq string
(mapconcat
#'identity (split-string string "\n") tramp-rsh-end-of-line))
(unless (or (string= string "")
(unless (or (string-empty-p string)
(string-equal (substring string -1) tramp-rsh-end-of-line))
(setq string (concat string tramp-rsh-end-of-line)))
;; Send the string.
@ -4408,12 +4391,10 @@ ID-FORMAT valid values are `string' and `integer'."
;; We use key nil for local connection properties.
(with-tramp-connection-property nil (format "gid-%s" id-format)
(cond
;; `group-gid' has been introduced with Emacs 24.4.
((and (fboundp 'group-gid) (equal id-format 'integer))
(tramp-compat-funcall 'group-gid))
((equal id-format 'integer) (group-gid))
;; `group-name' has been introduced with Emacs 27.1.
((and (fboundp 'group-name) (equal id-format 'string))
(tramp-compat-funcall 'group-name (tramp-compat-funcall 'group-gid)))
(tramp-compat-funcall 'group-name (group-gid)))
((tramp-compat-file-attribute-group-id
(file-attributes "~/" id-format))))))
@ -4647,7 +4628,7 @@ are written with verbosity of 6."
output error result)
(tramp-message
vec 6 "`%s %s' %s %s"
program (mapconcat #'identity args " ") infile destination)
program (string-join args " ") infile destination)
(condition-case err
(with-temp-buffer
(setq result
@ -4680,7 +4661,7 @@ are written with verbosity of 6."
result)
(tramp-message
vec 6 "`%s %s' %s %s %s %s"
program (mapconcat #'identity args " ") start end delete buffer)
program (string-join args " ") start end delete buffer)
(condition-case err
(progn
(setq result
@ -4709,7 +4690,7 @@ verbosity of 6."
(vec (or vec (car tramp-current-connection)))
result)
(if args
(tramp-message vec 6 "%s %s" program (mapconcat #'identity args " "))
(tramp-message vec 6 "%s %s" program (string-join args " "))
(tramp-message vec 6 "%s" program))
(setq result
(condition-case err

View File

@ -63,7 +63,7 @@
"The repository revision of the Tramp sources.")
;; Check for Emacs version.
(let ((x (if (not (string-lessp emacs-version "24.1"))
(let ((x (if (not (string-lessp emacs-version "24.4"))
"ok"
(format "Tramp 2.4.2-pre is not fit for %s"
(replace-regexp-in-string "\n" "" (emacs-version))))))

View File

@ -19,8 +19,6 @@
;;; Commentary:
;; The tests require a recent ert.el from Emacs 24.4.
;; Some of the tests require access to a remote host files. Since
;; this could be problematic, a mock-up connection method "mock" is
;; used. Emulating a remote connection, it simply calls "sh -i".
@ -410,9 +408,6 @@ properly. BODY shall not contain a timeout."
(ert-deftest tramp-test02-file-name-dissect ()
"Check remote file name components."
;; `user-error' has appeared in Emacs 24.3.
(skip-unless (fboundp 'user-error))
(let ((tramp-default-method "default-method")
(tramp-default-user "default-user")
(tramp-default-host "default-host")
@ -863,9 +858,6 @@ properly. BODY shall not contain a timeout."
(ert-deftest tramp-test02-file-name-dissect-simplified ()
"Check simplified file name components."
:tags '(:expensive-test)
;; `user-error' has appeared in Emacs 24.3.
(skip-unless (fboundp 'user-error))
(let ((tramp-default-method "default-method")
(tramp-default-user "default-user")
(tramp-default-host "default-host")
@ -1197,9 +1189,6 @@ properly. BODY shall not contain a timeout."
(ert-deftest tramp-test02-file-name-dissect-separate ()
"Check separate file name components."
:tags '(:expensive-test)
;; `user-error' has appeared in Emacs 24.3.
(skip-unless (fboundp 'user-error))
(let ((tramp-default-method "default-method")
(tramp-default-user "default-user")
(tramp-default-host "default-host")
@ -1889,8 +1878,6 @@ properly. BODY shall not contain a timeout."
"Check host name rules for host-less methods."
(skip-unless (tramp--test-enabled))
(skip-unless (tramp--test-sh-p))
;; `user-error' has appeared in Emacs 24.3.
(skip-unless (fboundp 'user-error))
;; Host names must match rules in case the command template of a
;; method doesn't use them.
@ -1914,8 +1901,6 @@ properly. BODY shall not contain a timeout."
(ert-deftest tramp-test03-file-name-method-rules ()
"Check file name rules for some methods."
(skip-unless (tramp--test-enabled))
;; `user-error' has appeared in Emacs 24.3.
(skip-unless (fboundp 'user-error))
;; Multi hops are allowed for inline methods only.
(should-error