aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2019-06-28 16:32:12 +0200
committerMichael Albinus2019-06-28 16:32:12 +0200
commitaae5bf4438712c9fe761c5e4b5a871192852cd97 (patch)
treeec3db42160422f29bed125227e3d9556bf949337
parentc534a4a3368cb396ccb53677f3153b526724d867 (diff)
downloademacs-aae5bf4438712c9fe761c5e4b5a871192852cd97.tar.gz
emacs-aae5bf4438712c9fe761c5e4b5a871192852cd97.zip
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'.
-rw-r--r--doc/misc/tramp.texi6
-rw-r--r--doc/misc/trampver.texi6
-rw-r--r--lisp/net/tramp-adb.el40
-rw-r--r--lisp/net/tramp-archive.el16
-rw-r--r--lisp/net/tramp-cmds.el15
-rw-r--r--lisp/net/tramp-compat.el12
-rw-r--r--lisp/net/tramp-ftp.el4
-rw-r--r--lisp/net/tramp-gvfs.el19
-rw-r--r--lisp/net/tramp-integration.el68
-rw-r--r--lisp/net/tramp-sh.el49
-rw-r--r--lisp/net/tramp-smb.el18
-rw-r--r--lisp/net/tramp-sudoedit.el7
-rw-r--r--lisp/net/tramp.el83
-rw-r--r--lisp/net/trampver.el2
-rw-r--r--test/lisp/net/tramp-tests.el15
15 files changed, 150 insertions, 210 deletions
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index dc01f119e7a..df8ae6f7f40 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -4204,10 +4204,8 @@ directory to the cache:
4204 4204
4205@lisp 4205@lisp
4206@group 4206@group
4207@c `with-eval-after-load' has been introduced with Emacs 24.4. Shall 4207(with-eval-after-load 'filecache
4208@c be used when appropriate. 4208 (file-cache-add-directory
4209(eval-after-load "filecache"
4210 '(file-cache-add-directory
4211 "@trampfn{ssh,news@@news.my.domain,/opt/news/etc/}")) 4209 "@trampfn{ssh,news@@news.my.domain,/opt/news/etc/}"))
4212@end group 4210@end group
4213@end lisp 4211@end lisp
diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi
index 5b1408a4974..03f9e01ce21 100644
--- a/doc/misc/trampver.texi
+++ b/doc/misc/trampver.texi
@@ -5,10 +5,12 @@
5@c Copyright (C) 2003-2019 Free Software Foundation, Inc. 5@c Copyright (C) 2003-2019 Free Software Foundation, Inc.
6@c See file doclicense.texi for copying conditions. 6@c See file doclicense.texi for copying conditions.
7 7
8@c In the Tramp GIT, the version number is auto-frobbed from tramp.el, 8@c In the Tramp GIT, the version numbers are auto-frobbed from
9@c and the bug report address is auto-frobbed from configure.ac. 9@c tramp.el, and the bug report address is auto-frobbed from
10@c configure.ac.
10@set trampver 2.4.2-pre 11@set trampver 2.4.2-pre
11@set tramp-bug-report-address tramp-devel@@gnu.org 12@set tramp-bug-report-address tramp-devel@@gnu.org
13@set emacsver 24.4
12 14
13@c Other flags from configuration. 15@c Other flags from configuration.
14@set instprefix /usr/local 16@set instprefix /usr/local
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 008a5cedd8b..c8b9e7ae09c 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -257,17 +257,15 @@ pass to the OPERATION."
257 (setq thisstep (pop steps)) 257 (setq thisstep (pop steps))
258 (tramp-message 258 (tramp-message
259 v 5 "Check %s" 259 v 5 "Check %s"
260 (mapconcat #'identity 260 (string-join
261 (append '("") (reverse result) (list thisstep)) 261 (append '("") (reverse result) (list thisstep)) "/"))
262 "/"))
263 (setq symlink-target 262 (setq symlink-target
264 (tramp-compat-file-attribute-type 263 (tramp-compat-file-attribute-type
265 (file-attributes 264 (file-attributes
266 (tramp-make-tramp-file-name 265 (tramp-make-tramp-file-name
267 v (mapconcat #'identity 266 v
268 (append 267 (string-join
269 '("") (reverse result) (list thisstep)) 268 (append '("") (reverse result) (list thisstep)) "/")))))
270 "/")))))
271 (cond ((string= "." thisstep) 269 (cond ((string= "." thisstep)
272 (tramp-message v 5 "Ignoring step `.'")) 270 (tramp-message v 5 "Ignoring step `.'"))
273 ((string= ".." thisstep) 271 ((string= ".." thisstep)
@@ -302,9 +300,9 @@ pass to the OPERATION."
302 ;; Combine list to form string. 300 ;; Combine list to form string.
303 (setq result 301 (setq result
304 (if result 302 (if result
305 (mapconcat #'identity (cons "" result) "/") 303 (string-join (cons "" result) "/")
306 "/")) 304 "/"))
307 (when (and is-dir (or (string= "" result) 305 (when (and is-dir (or (string-empty-p result)
308 (not (string= (substring result -1) "/")))) 306 (not (string= (substring result -1) "/"))))
309 (setq result (concat result "/")))) 307 (setq result (concat result "/"))))
310 308
@@ -479,7 +477,7 @@ Emacs dired can't find files."
479 #'tramp-adb-ls-output-time-less-p 477 #'tramp-adb-ls-output-time-less-p
480 #'tramp-adb-ls-output-name-less-p)))) 478 #'tramp-adb-ls-output-name-less-p))))
481 (delete-region (point-min) (point-max)) 479 (delete-region (point-min) (point-max))
482 (insert " " (mapconcat #'identity sorted-lines "\n "))) 480 (insert " " (string-join sorted-lines "\n ")))
483 ;; Add final newline. 481 ;; Add final newline.
484 (goto-char (point-max)) 482 (goto-char (point-max))
485 (unless (bolp) (insert "\n")))) 483 (unless (bolp) (insert "\n"))))
@@ -1232,7 +1230,7 @@ connection if a previous connection has died for some reason."
1232 (prompt (md5 (concat (prin1-to-string process-environment) 1230 (prompt (md5 (concat (prin1-to-string process-environment)
1233 (current-time-string))))) 1231 (current-time-string)))))
1234 (tramp-message 1232 (tramp-message
1235 vec 6 "%s" (mapconcat #'identity (process-command p) " ")) 1233 vec 6 "%s" (string-join (process-command p) " "))
1236 ;; Wait for initial prompt. On some devices, it needs an 1234 ;; Wait for initial prompt. On some devices, it needs an
1237 ;; initial RET, in order to get it. 1235 ;; initial RET, in order to get it.
1238 (sleep-for 0.1) 1236 (sleep-for 0.1)
@@ -1300,16 +1298,16 @@ connection if a previous connection has died for some reason."
1300 1298
1301;; `connection-local-set-profile-variables' and 1299;; `connection-local-set-profile-variables' and
1302;; `connection-local-set-profiles' exists since Emacs 26.1. 1300;; `connection-local-set-profiles' exists since Emacs 26.1.
1303(eval-after-load "shell" 1301(with-eval-after-load 'shell
1304 '(progn 1302 (progn
1305 (tramp-compat-funcall 1303 (tramp-compat-funcall
1306 'connection-local-set-profile-variables 1304 'connection-local-set-profile-variables
1307 'tramp-adb-connection-local-default-profile 1305 'tramp-adb-connection-local-default-profile
1308 tramp-adb-connection-local-default-profile) 1306 tramp-adb-connection-local-default-profile)
1309 (tramp-compat-funcall 1307 (tramp-compat-funcall
1310 'connection-local-set-profiles 1308 'connection-local-set-profiles
1311 `(:application tramp :protocol ,tramp-adb-method) 1309 `(:application tramp :protocol ,tramp-adb-method)
1312 'tramp-adb-connection-local-default-profile))) 1310 'tramp-adb-connection-local-default-profile)))
1313 1311
1314(add-hook 'tramp-unload-hook 1312(add-hook 'tramp-unload-hook
1315 (lambda () 1313 (lambda ()
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index 7e17fde7306..b329d4a1b11 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -372,14 +372,14 @@ pass to the OPERATION."
372;; `tramp-archive-file-name-handler' must be placed before `url-file-handler'. 372;; `tramp-archive-file-name-handler' must be placed before `url-file-handler'.
373(when url-handler-mode (tramp-register-file-name-handlers)) 373(when url-handler-mode (tramp-register-file-name-handlers))
374 374
375(eval-after-load 'url-handler 375(with-eval-after-load 'url-handler
376 '(progn 376 (progn
377 (add-hook 'url-handler-mode-hook #'tramp-register-file-name-handlers) 377 (add-hook 'url-handler-mode-hook #'tramp-register-file-name-handlers)
378 (add-hook 378 (add-hook
379 'tramp-archive-unload-hook 379 'tramp-archive-unload-hook
380 (lambda () 380 (lambda ()
381 (remove-hook 381 (remove-hook
382 'url-handler-mode-hook #'tramp-register-file-name-handlers))))) 382 'url-handler-mode-hook #'tramp-register-file-name-handlers)))))
383 383
384 384
385;; File name conversions. 385;; File name conversions.
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index f1e1d8271ff..007b98f94fe 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -116,6 +116,12 @@ When called interactively, a Tramp connection has to be selected."
116 (delete-process (tramp-get-connection-process vec))) 116 (delete-process (tramp-get-connection-process vec)))
117 (tramp-flush-connection-properties vec) 117 (tramp-flush-connection-properties vec)
118 118
119 ;; Cancel timer.
120 (dolist (timer timer-list)
121 (when (and (eq (timer--function timer) 'tramp-timeout-session)
122 (tramp-file-name-equal-p vec (car (timer--args timer))))
123 (cancel-timer timer)))
124
119 ;; Remove buffers. 125 ;; Remove buffers.
120 (dolist 126 (dolist
121 (buf (list (get-buffer (tramp-buffer-name vec)) 127 (buf (list (get-buffer (tramp-buffer-name vec))
@@ -163,9 +169,12 @@ This includes password cache, file cache, connection cache, buffers."
163 (delete (car proxies) tramp-default-proxies-alist) 169 (delete (car proxies) tramp-default-proxies-alist)
164 proxies tramp-default-proxies-alist) 170 proxies tramp-default-proxies-alist)
165 (setq proxies (cdr proxies))))) 171 (setq proxies (cdr proxies)))))
166 (when (and tramp-default-proxies-alist tramp-save-ad-hoc-proxies) 172 (when (and tramp-default-proxies-alist tramp-save-ad-hoc-proxies)
167 (customize-save-variable 173 (customize-save-variable
168 'tramp-default-proxies-alist tramp-default-proxies-alist)) 174 'tramp-default-proxies-alist tramp-default-proxies-alist))
175
176 ;; Cancel timers.
177 (cancel-function-timers 'tramp-timeout-session)
169 178
170 ;; Remove buffers. 179 ;; Remove buffers.
171 (dolist (name (tramp-list-tramp-buffers)) 180 (dolist (name (tramp-list-tramp-buffers))
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 15b737d281b..4f01f8d372f 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -39,6 +39,7 @@
39(require 'ls-lisp) ;; Due to `tramp-handle-insert-directory'. 39(require 'ls-lisp) ;; Due to `tramp-handle-insert-directory'.
40(require 'parse-time) 40(require 'parse-time)
41(require 'shell) 41(require 'shell)
42(require 'subr-x)
42 43
43(declare-function tramp-handle-temporary-file-directory "tramp") 44(declare-function tramp-handle-temporary-file-directory "tramp")
44 45
@@ -81,7 +82,7 @@ Add the extension of F, if existing."
81 ((fboundp 'w32-window-exists-p) 82 ((fboundp 'w32-window-exists-p)
82 (tramp-compat-funcall 'w32-window-exists-p process-name process-name)) 83 (tramp-compat-funcall 'w32-window-exists-p process-name process-name))
83 84
84 ;; GNU Emacs 23. 85 ;; GNU Emacs 23+.
85 ((and (fboundp 'list-system-processes) (fboundp 'process-attributes)) 86 ((and (fboundp 'list-system-processes) (fboundp 'process-attributes))
86 (let (result) 87 (let (result)
87 (dolist (pid (tramp-compat-funcall 'list-system-processes) result) 88 (dolist (pid (tramp-compat-funcall 'list-system-processes) result)
@@ -97,10 +98,6 @@ Add the extension of F, if existing."
97 process-name)))) 98 process-name))))
98 (setq result t))))))))) 99 (setq result t)))))))))
99 100
100;; `default-toplevel-value' has been declared in Emacs 24.4.
101(unless (fboundp 'default-toplevel-value)
102 (defalias 'default-toplevel-value #'symbol-value))
103
104;; `file-attribute-*' are introduced in Emacs 25.1. 101;; `file-attribute-*' are introduced in Emacs 25.1.
105 102
106(defalias 'tramp-compat-file-attribute-type 103(defalias 'tramp-compat-file-attribute-type
@@ -306,9 +303,4 @@ A nil value for either argument stands for the current time."
306 303
307(provide 'tramp-compat) 304(provide 'tramp-compat)
308 305
309;;; TODO:
310
311;; * When we get rid of Emacs 24, replace "(mapconcat #'identity" by
312;; "(string-join".
313
314;;; tramp-compat.el ends here 306;;; tramp-compat.el ends here
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el
index d1aae22a484..2a4fccf57e7 100644
--- a/lisp/net/tramp-ftp.el
+++ b/lisp/net/tramp-ftp.el
@@ -53,8 +53,8 @@ present for backward compatibility."
53 (setq file-name-handler-alist 53 (setq file-name-handler-alist
54 (delete a1 (delete a2 file-name-handler-alist))))) 54 (delete a1 (delete a2 file-name-handler-alist)))))
55 55
56(eval-after-load "ange-ftp" 56(with-eval-after-load 'ange-ftp
57 '(tramp-disable-ange-ftp)) 57 (tramp-disable-ange-ftp))
58 58
59;;;###tramp-autoload 59;;;###tramp-autoload
60(defun tramp-ftp-enable-ange-ftp () 60(defun tramp-ftp-enable-ange-ftp ()
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index cee7a1209bd..e3da20aa88f 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -724,12 +724,7 @@ is no information where to trace the message.")
724 (tramp-message tramp-gvfs-dbus-event-vector 6 "%S" event) 724 (tramp-message tramp-gvfs-dbus-event-vector 6 "%S" event)
725 (tramp-error tramp-gvfs-dbus-event-vector 'file-error "%s" (cadr err)))) 725 (tramp-error tramp-gvfs-dbus-event-vector 'file-error "%s" (cadr err))))
726 726
727;; `dbus-event-error-hooks' has been renamed to 727(add-hook 'dbus-event-error-functions #'tramp-gvfs-dbus-event-error)
728;; `dbus-event-error-functions' in Emacs 24.3.
729(add-hook
730 (if (boundp 'dbus-event-error-functions)
731 'dbus-event-error-functions 'dbus-event-error-hooks)
732 #'tramp-gvfs-dbus-event-error)
733 728
734 729
735;; File name primitives. 730;; File name primitives.
@@ -942,7 +937,7 @@ file names."
942 ;; Send command. 937 ;; Send command.
943 (tramp-gvfs-send-command 938 (tramp-gvfs-send-command
944 v "gvfs-ls" "-h" "-n" "-a" 939 v "gvfs-ls" "-h" "-n" "-a"
945 (mapconcat #'identity tramp-gvfs-file-attributes ",") 940 (string-join tramp-gvfs-file-attributes ",")
946 (tramp-gvfs-url-file-name directory)) 941 (tramp-gvfs-url-file-name directory))
947 ;; Parse output. 942 ;; Parse output.
948 (with-current-buffer (tramp-get-connection-buffer v) 943 (with-current-buffer (tramp-get-connection-buffer v)
@@ -1183,7 +1178,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
1183 (tramp-error 1178 (tramp-error
1184 v 'file-notify-error "Monitoring not supported for `%s'" file-name) 1179 v 'file-notify-error "Monitoring not supported for `%s'" file-name)
1185 (tramp-message 1180 (tramp-message
1186 v 6 "Run `%s', %S" (mapconcat #'identity (process-command p) " ") p) 1181 v 6 "Run `%s', %S" (string-join (process-command p) " ") p)
1187 (process-put p 'vector v) 1182 (process-put p 'vector v)
1188 (process-put p 'events events) 1183 (process-put p 'events events)
1189 (process-put p 'watch-name localname) 1184 (process-put p 'watch-name localname)
@@ -1997,15 +1992,12 @@ VEC is used only for traces."
1997 (list user host))) 1992 (list user host)))
1998 (zeroconf-list-services service))) 1993 (zeroconf-list-services service)))
1999 1994
2000;; We use the TRIM argument of `split-string', which exist since Emacs
2001;; 24.4. I mask this for older Emacs versions, there is no harm.
2002(defun tramp-gvfs-parse-device-names (service) 1995(defun tramp-gvfs-parse-device-names (service)
2003 "Return a list of (user host) tuples allowed to access. 1996 "Return a list of (user host) tuples allowed to access.
2004This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi." 1997This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi."
2005 (let ((result 1998 (let ((result
2006 (ignore-errors 1999 (ignore-errors
2007 (tramp-compat-funcall 2000 (split-string
2008 'split-string
2009 (shell-command-to-string (format "avahi-browse -trkp %s" service)) 2001 (shell-command-to-string (format "avahi-browse -trkp %s" service))
2010 "[\n\r]+" 'omit "^\\+;.*$")))) 2002 "[\n\r]+" 'omit "^\\+;.*$"))))
2011 (delete-dups 2003 (delete-dups
@@ -2013,8 +2005,7 @@ This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi."
2013 (lambda (x) 2005 (lambda (x)
2014 (let* ((list (split-string x ";")) 2006 (let* ((list (split-string x ";"))
2015 (host (nth 6 list)) 2007 (host (nth 6 list))
2016 (text (tramp-compat-funcall 2008 (text (split-string (nth 9 list) "\" \"" 'omit "\""))
2017 'split-string (nth 9 list) "\" \"" 'omit "\""))
2018 user) 2009 user)
2019 ;; A user is marked in a TXT field like "u=guest". 2010 ;; A user is marked in a TXT field like "u=guest".
2020 (while text 2011 (while text
diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el
index 35d2eb38e60..5960871ca7a 100644
--- a/lisp/net/tramp-integration.el
+++ b/lisp/net/tramp-integration.el
@@ -123,18 +123,18 @@ been set up by `rfn-eshadow-setup-minibuffer'."
123 (mapconcat 123 (mapconcat
124 #'identity (butlast (tramp-compat-exec-path)) path-separator))) 124 #'identity (butlast (tramp-compat-exec-path)) path-separator)))
125 125
126(eval-after-load "esh-util" 126(with-eval-after-load 'esh-util
127 '(progn 127 (progn
128 (add-hook 'eshell-mode-hook 128 (add-hook 'eshell-mode-hook
129 #'tramp-eshell-directory-change) 129 #'tramp-eshell-directory-change)
130 (add-hook 'eshell-directory-change-hook 130 (add-hook 'eshell-directory-change-hook
131 #'tramp-eshell-directory-change) 131 #'tramp-eshell-directory-change)
132 (add-hook 'tramp-integration-unload-hook 132 (add-hook 'tramp-integration-unload-hook
133 (lambda () 133 (lambda ()
134 (remove-hook 'eshell-mode-hook 134 (remove-hook 'eshell-mode-hook
135 #'tramp-eshell-directory-change) 135 #'tramp-eshell-directory-change)
136 (remove-hook 'eshell-directory-change-hook 136 (remove-hook 'eshell-directory-change-hook
137 #'tramp-eshell-directory-change))))) 137 #'tramp-eshell-directory-change)))))
138 138
139;;; Integration of recentf.el: 139;;; Integration of recentf.el:
140 140
@@ -158,18 +158,18 @@ NAME must be equal to `tramp-current-connection'."
158 (let ((recentf-exclude '(file-remote-p))) 158 (let ((recentf-exclude '(file-remote-p)))
159 (recentf-cleanup)))) 159 (recentf-cleanup))))
160 160
161(eval-after-load "recentf" 161(with-eval-after-load 'recentf
162 '(progn 162 (progn
163 (add-hook 'tramp-cleanup-connection-hook 163 (add-hook 'tramp-cleanup-connection-hook
164 #'tramp-recentf-cleanup) 164 #'tramp-recentf-cleanup)
165 (add-hook 'tramp-cleanup-all-connections-hook 165 (add-hook 'tramp-cleanup-all-connections-hook
166 #'tramp-recentf-cleanup-all) 166 #'tramp-recentf-cleanup-all)
167 (add-hook 'tramp-integration-unload-hook 167 (add-hook 'tramp-integration-unload-hook
168 (lambda () 168 (lambda ()
169 (remove-hook 'tramp-cleanup-connection-hook 169 (remove-hook 'tramp-cleanup-connection-hook
170 #'tramp-recentf-cleanup) 170 #'tramp-recentf-cleanup)
171 (remove-hook 'tramp-cleanup-all-connections-hook 171 (remove-hook 'tramp-cleanup-all-connections-hook
172 #'tramp-recentf-cleanup-all))))) 172 #'tramp-recentf-cleanup-all)))))
173 173
174;;; Default connection-local variables for Tramp: 174;;; Default connection-local variables for Tramp:
175 175
@@ -180,16 +180,16 @@ NAME must be equal to `tramp-current-connection'."
180 180
181;; `connection-local-set-profile-variables' and 181;; `connection-local-set-profile-variables' and
182;; `connection-local-set-profiles' exists since Emacs 26.1. 182;; `connection-local-set-profiles' exists since Emacs 26.1.
183(eval-after-load "shell" 183(with-eval-after-load 'shell
184 '(progn 184 (progn
185 (tramp-compat-funcall 185 (tramp-compat-funcall
186 'connection-local-set-profile-variables 186 'connection-local-set-profile-variables
187 'tramp-connection-local-default-profile 187 'tramp-connection-local-default-profile
188 tramp-connection-local-default-profile) 188 tramp-connection-local-default-profile)
189 (tramp-compat-funcall 189 (tramp-compat-funcall
190 'connection-local-set-profiles 190 'connection-local-set-profiles
191 `(:application tramp) 191 `(:application tramp)
192 'tramp-connection-local-default-profile))) 192 'tramp-connection-local-default-profile)))
193 193
194(add-hook 'tramp-unload-hook 194(add-hook 'tramp-unload-hook
195 (lambda () (unload-feature 'tramp-integration 'force))) 195 (lambda () (unload-feature 'tramp-integration 'force)))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index a42ae9363ca..cee61f15d20 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1135,19 +1135,15 @@ component is used as the target of the symlink."
1135 (setq thisstep (pop steps)) 1135 (setq thisstep (pop steps))
1136 (tramp-message 1136 (tramp-message
1137 v 5 "Check %s" 1137 v 5 "Check %s"
1138 (mapconcat #'identity 1138 (string-join
1139 (append '("") (reverse result) (list thisstep)) 1139 (append '("") (reverse result) (list thisstep)) "/"))
1140 "/"))
1141 (setq symlink-target 1140 (setq symlink-target
1142 (tramp-compat-file-attribute-type 1141 (tramp-compat-file-attribute-type
1143 (file-attributes 1142 (file-attributes
1144 (tramp-make-tramp-file-name 1143 (tramp-make-tramp-file-name
1145 v 1144 v
1146 (mapconcat #'identity 1145 (string-join
1147 (append '("") 1146 (append '("") (reverse result) (list thisstep)) "/")
1148 (reverse result)
1149 (list thisstep))
1150 "/")
1151 'nohop)))) 1147 'nohop))))
1152 (cond ((string= "." thisstep) 1148 (cond ((string= "." thisstep)
1153 (tramp-message v 5 "Ignoring step `.'")) 1149 (tramp-message v 5 "Ignoring step `.'"))
@@ -1173,12 +1169,8 @@ component is used as the target of the symlink."
1173 "Maximum number (%d) of symlinks exceeded" numchase-limit)) 1169 "Maximum number (%d) of symlinks exceeded" numchase-limit))
1174 (setq result (reverse result)) 1170 (setq result (reverse result))
1175 ;; Combine list to form string. 1171 ;; Combine list to form string.
1176 (setq result 1172 (setq result (if result (string-join (cons "" result) "/") "/"))
1177 (if result 1173 (when (string-empty-p result) (setq result "/")))))
1178 (mapconcat #'identity (cons "" result) "/")
1179 "/"))
1180 (when (string= "" result)
1181 (setq result "/")))))
1182 1174
1183 ;; Detect cycle. 1175 ;; Detect cycle.
1184 (when (and (file-symlink-p filename) 1176 (when (and (file-symlink-p filename)
@@ -1993,7 +1985,6 @@ file names."
1993 (t2 (tramp-tramp-file-p newname)) 1985 (t2 (tramp-tramp-file-p newname))
1994 (length (tramp-compat-file-attribute-size 1986 (length (tramp-compat-file-attribute-size
1995 (file-attributes (file-truename filename)))) 1987 (file-attributes (file-truename filename))))
1996 ;; `file-extended-attributes' exists since Emacs 24.4.
1997 (attributes (and preserve-extended-attributes 1988 (attributes (and preserve-extended-attributes
1998 (apply #'file-extended-attributes (list filename))))) 1989 (apply #'file-extended-attributes (list filename)))))
1999 1990
@@ -2065,7 +2056,6 @@ file names."
2065 2056
2066 ;; Handle `preserve-extended-attributes'. We ignore possible 2057 ;; Handle `preserve-extended-attributes'. We ignore possible
2067 ;; errors, because ACL strings could be incompatible. 2058 ;; errors, because ACL strings could be incompatible.
2068 ;; `set-file-extended-attributes' exists since Emacs 24.4.
2069 (when attributes 2059 (when attributes
2070 (ignore-errors 2060 (ignore-errors
2071 (apply #'set-file-extended-attributes (list newname attributes)))) 2061 (apply #'set-file-extended-attributes (list newname attributes))))
@@ -2364,7 +2354,7 @@ The method used must be an out-of-band method."
2364 (mapcar 2354 (mapcar
2365 (lambda (x) 2355 (lambda (x)
2366 (setq x (mapcar (lambda (y) (format-spec y spec)) x)) 2356 (setq x (mapcar (lambda (y) (format-spec y spec)) x))
2367 (unless (member "" x) (mapconcat #'identity x " "))) 2357 (unless (member "" x) (string-join x " ")))
2368 (tramp-get-method-parameter v 'tramp-copy-env))) 2358 (tramp-get-method-parameter v 'tramp-copy-env)))
2369 2359
2370 remote-copy-program 2360 remote-copy-program
@@ -3636,8 +3626,8 @@ Fall back to normal file name handler if no Tramp handler exists."
3636 (tramp-error 3626 (tramp-error
3637 v 'file-notify-error 3627 v 'file-notify-error
3638 "`%s' failed to start on remote host" 3628 "`%s' failed to start on remote host"
3639 (mapconcat #'identity sequence " ")) 3629 (string-join sequence " "))
3640 (tramp-message v 6 "Run `%s', %S" (mapconcat #'identity sequence " ") p) 3630 (tramp-message v 6 "Run `%s', %S" (string-join sequence " ") p)
3641 (process-put p 'vector v) 3631 (process-put p 'vector v)
3642 ;; Needed for process filter. 3632 ;; Needed for process filter.
3643 (process-put p 'events events) 3633 (process-put p 'events events)
@@ -3928,7 +3918,7 @@ This function expects to be in the right *tramp* buffer."
3928 "%s\n%s")) 3918 "%s\n%s"))
3929 progname progname progname 3919 progname progname progname
3930 tramp-end-of-heredoc 3920 tramp-end-of-heredoc
3931 (mapconcat #'identity dirlist "\n") 3921 (string-join dirlist "\n")
3932 tramp-end-of-heredoc)) 3922 tramp-end-of-heredoc))
3933 (goto-char (point-max)) 3923 (goto-char (point-max))
3934 (when (search-backward "tramp_executable " nil t) 3924 (when (search-backward "tramp_executable " nil t)
@@ -3946,8 +3936,8 @@ I.e., for each directory in `tramp-remote-path', it is tested
3946whether it exists and if so, it is added to the environment 3936whether it exists and if so, it is added to the environment
3947variable PATH." 3937variable PATH."
3948 (let ((command 3938 (let ((command
3949 (format "PATH=%s; export PATH" 3939 (format
3950 (mapconcat #'identity (tramp-get-remote-path vec) ":"))) 3940 "PATH=%s; export PATH" (string-join (tramp-get-remote-path vec) ":")))
3951 (pipe-buf 3941 (pipe-buf
3952 (or (with-tramp-connection-property vec "pipe-buf" 3942 (or (with-tramp-connection-property vec "pipe-buf"
3953 (tramp-send-command-and-read 3943 (tramp-send-command-and-read
@@ -4290,7 +4280,7 @@ process to set up. VEC specifies the connection."
4290 (append `(,(tramp-get-remote-locale vec)) 4280 (append `(,(tramp-get-remote-locale vec))
4291 (copy-sequence tramp-remote-process-environment)))) 4281 (copy-sequence tramp-remote-process-environment))))
4292 (setq item (split-string item "=" 'omit)) 4282 (setq item (split-string item "=" 'omit))
4293 (setcdr item (mapconcat #'identity (cdr item) "=")) 4283 (setcdr item (string-join (cdr item) "="))
4294 (if (and (stringp (cdr item)) (not (string-equal (cdr item) ""))) 4284 (if (and (stringp (cdr item)) (not (string-equal (cdr item) "")))
4295 (push (format "%s %s" (car item) (cdr item)) vars) 4285 (push (format "%s %s" (car item) (cdr item)) vars)
4296 (push (car item) unset))) 4286 (push (car item) unset)))
@@ -4300,12 +4290,12 @@ process to set up. VEC specifies the connection."
4300 (format 4290 (format
4301 "while read var val; do export $var=\"$val\"; done <<'%s'\n%s\n%s" 4291 "while read var val; do export $var=\"$val\"; done <<'%s'\n%s\n%s"
4302 tramp-end-of-heredoc 4292 tramp-end-of-heredoc
4303 (mapconcat #'identity vars "\n") 4293 (string-join vars "\n")
4304 tramp-end-of-heredoc) 4294 tramp-end-of-heredoc)
4305 t)) 4295 t))
4306 (when unset 4296 (when unset
4307 (tramp-send-command 4297 (tramp-send-command
4308 vec (format "unset %s" (mapconcat #'identity unset " ")) t))))) 4298 vec (format "unset %s" (string-join unset " ")) t)))))
4309 4299
4310;; Old text from documentation of tramp-methods: 4300;; Old text from documentation of tramp-methods:
4311;; Using a uuencode/uudecode inline method is discouraged, please use one 4301;; 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."
4873 (set-process-query-on-exit-flag p nil) 4863 (set-process-query-on-exit-flag p nil)
4874 (setq tramp-current-connection (cons vec (current-time))) 4864 (setq tramp-current-connection (cons vec (current-time)))
4875 4865
4876 (tramp-message 4866 (tramp-message vec 6 "%s" (string-join (process-command p) " "))
4877 vec 6 "%s" (mapconcat #'identity (process-command p) " "))
4878 4867
4879 ;; Check whether process is alive. 4868 ;; Check whether process is alive.
4880 (tramp-barf-if-no-shell-prompt 4869 (tramp-barf-if-no-shell-prompt
@@ -4951,7 +4940,7 @@ connection if a previous connection has died for some reason."
4951 (mapcar 4940 (mapcar
4952 (lambda (x) 4941 (lambda (x)
4953 (setq x (mapcar (lambda (y) (format-spec y spec)) x)) 4942 (setq x (mapcar (lambda (y) (format-spec y spec)) x))
4954 (unless (member "" x) (mapconcat #'identity x " "))) 4943 (unless (member "" x) (string-join x " ")))
4955 login-env)) 4944 login-env))
4956 (while login-env 4945 (while login-env
4957 (setq command 4946 (setq command
@@ -4980,7 +4969,7 @@ connection if a previous connection has died for some reason."
4980 (mapconcat 4969 (mapconcat
4981 (lambda (x) 4970 (lambda (x)
4982 (setq x (mapcar (lambda (y) (format-spec y spec)) x)) 4971 (setq x (mapcar (lambda (y) (format-spec y spec)) x))
4983 (unless (member "" x) (mapconcat #'identity x " "))) 4972 (unless (member "" x) (string-join x " ")))
4984 login-args " ") 4973 login-args " ")
4985 ;; Local shell could be a Windows COMSPEC. It 4974 ;; Local shell could be a Windows COMSPEC. It
4986 ;; doesn't know the ";" syntax, but we must exit 4975 ;; doesn't know the ";" syntax, but we must exit
@@ -5041,7 +5030,7 @@ function waits for output unless NOOUTPUT is set."
5041 ;; `tramp-echo-mark', so the remote shell sees two consecutive 5030 ;; `tramp-echo-mark', so the remote shell sees two consecutive
5042 ;; trailing line endings and sends two prompts after executing 5031 ;; trailing line endings and sends two prompts after executing
5043 ;; the command, which confuses `tramp-wait-for-output'. 5032 ;; the command, which confuses `tramp-wait-for-output'.
5044 (when (and (not (string= command "")) 5033 (when (and (not (string-empty-p command))
5045 (string-equal (substring command -1) "\n")) 5034 (string-equal (substring command -1) "\n"))
5046 (setq command (substring command 0 -1))) 5035 (setq command (substring command 0 -1)))
5047 ;; No need to restore a trailing newline here since `tramp-send-string' 5036 ;; No need to restore a trailing newline here since `tramp-send-string'
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 37c40a07f29..695f552b061 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -513,7 +513,7 @@ pass to the OPERATION."
513 tramp-smb-program args))) 513 tramp-smb-program args)))
514 514
515 (tramp-message 515 (tramp-message
516 v 6 "%s" (mapconcat #'identity (process-command p) " ")) 516 v 6 "%s" (string-join (process-command p) " "))
517 (process-put p 'vector v) 517 (process-put p 'vector v)
518 (process-put p 'adjust-window-size-function #'ignore) 518 (process-put p 'adjust-window-size-function #'ignore)
519 (set-process-query-on-exit-flag p nil) 519 (set-process-query-on-exit-flag p nil)
@@ -774,7 +774,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
774 tramp-smb-acl-program args))) 774 tramp-smb-acl-program args)))
775 775
776 (tramp-message 776 (tramp-message
777 v 6 "%s" (mapconcat #'identity (process-command p) " ")) 777 v 6 "%s" (string-join (process-command p) " "))
778 (process-put p 'vector v) 778 (process-put p 'vector v)
779 (process-put p 'adjust-window-size-function #'ignore) 779 (process-put p 'adjust-window-size-function #'ignore)
780 (set-process-query-on-exit-flag p nil) 780 (set-process-query-on-exit-flag p nil)
@@ -1258,7 +1258,7 @@ component is used as the target of the symlink."
1258 (setq outbuf (current-buffer)))) 1258 (setq outbuf (current-buffer))))
1259 1259
1260 ;; Construct command. 1260 ;; Construct command.
1261 (setq command (mapconcat #'identity (cons program args) " ") 1261 (setq command (string-join (cons program args) " ")
1262 command (if input 1262 command (if input
1263 (format 1263 (format
1264 "get-content %s | & %s" 1264 "get-content %s | & %s"
@@ -1425,8 +1425,7 @@ component is used as the target of the symlink."
1425 (tramp-get-connection-buffer v) 1425 (tramp-get-connection-buffer v)
1426 tramp-smb-acl-program args))) 1426 tramp-smb-acl-program args)))
1427 1427
1428 (tramp-message 1428 (tramp-message v 6 "%s" (string-join (process-command p) " "))
1429 v 6 "%s" (mapconcat #'identity (process-command p) " "))
1430 (process-put p 'vector v) 1429 (process-put p 'vector v)
1431 (process-put p 'adjust-window-size-function #'ignore) 1430 (process-put p 'adjust-window-size-function #'ignore)
1432 (set-process-query-on-exit-flag p nil) 1431 (set-process-query-on-exit-flag p nil)
@@ -1470,7 +1469,7 @@ component is used as the target of the symlink."
1470 (get-buffer-create buffer) 1469 (get-buffer-create buffer)
1471 ;; BUFFER can be nil. We use a temporary buffer. 1470 ;; BUFFER can be nil. We use a temporary buffer.
1472 (generate-new-buffer tramp-temp-buffer-name))) 1471 (generate-new-buffer tramp-temp-buffer-name)))
1473 (command (mapconcat #'identity (cons program args) " ")) 1472 (command (string-join (cons program args) " "))
1474 (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) 1473 (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
1475 (name1 name) 1474 (name1 name)
1476 (i 0)) 1475 (i 0))
@@ -1965,8 +1964,7 @@ If ARGUMENT is non-nil, use it as argument for
1965 tramp-smb-winexe-program tramp-smb-program) 1964 tramp-smb-winexe-program tramp-smb-program)
1966 args)))) 1965 args))))
1967 1966
1968 (tramp-message 1967 (tramp-message vec 6 "%s" (string-join (process-command p) " "))
1969 vec 6 "%s" (mapconcat #'identity (process-command p) " "))
1970 (process-put p 'vector vec) 1968 (process-put p 'vector vec)
1971 (process-put p 'adjust-window-size-function #'ignore) 1969 (process-put p 'adjust-window-size-function #'ignore)
1972 (set-process-query-on-exit-flag p nil) 1970 (set-process-query-on-exit-flag p nil)
@@ -2039,8 +2037,8 @@ Removes smb prompt. Returns nil if an error message has appeared."
2039 2037
2040 ;; Read pending output. 2038 ;; Read pending output.
2041 (while (not (re-search-forward tramp-smb-prompt nil t)) 2039 (while (not (re-search-forward tramp-smb-prompt nil t))
2042 (while (tramp-accept-process-output p 0) 2040 (while (tramp-accept-process-output p 0))
2043 (goto-char (point-min)))) 2041 (goto-char (point-min)))
2044 (tramp-message vec 6 "\n%s" (buffer-string)) 2042 (tramp-message vec 6 "\n%s" (buffer-string))
2045 2043
2046 ;; Remove prompt. 2044 ;; Remove prompt.
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index f056e73366e..bbe780099d5 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -232,7 +232,6 @@ absolute file names."
232 (file-times (tramp-compat-file-attribute-modification-time 232 (file-times (tramp-compat-file-attribute-modification-time
233 (file-attributes filename))) 233 (file-attributes filename)))
234 (file-modes (tramp-default-file-modes filename)) 234 (file-modes (tramp-default-file-modes filename))
235 ;; `file-extended-attributes' exists since Emacs 24.4.
236 (attributes (and preserve-extended-attributes 235 (attributes (and preserve-extended-attributes
237 (apply #'file-extended-attributes (list filename)))) 236 (apply #'file-extended-attributes (list filename))))
238 (sudoedit-operation 237 (sudoedit-operation
@@ -284,7 +283,6 @@ absolute file names."
284 283
285 ;; Handle `preserve-extended-attributes'. We ignore possible 284 ;; Handle `preserve-extended-attributes'. We ignore possible
286 ;; errors, because ACL strings could be incompatible. 285 ;; errors, because ACL strings could be incompatible.
287 ;; `set-file-extended-attributes' exists since Emacs 24.4.
288 (when attributes 286 (when attributes
289 (ignore-errors 287 (ignore-errors
290 (apply #'set-file-extended-attributes (list newname attributes)))) 288 (apply #'set-file-extended-attributes (list newname attributes))))
@@ -660,8 +658,7 @@ component is used as the target of the symlink."
660 (with-parsed-tramp-file-name (expand-file-name filename) nil 658 (with-parsed-tramp-file-name (expand-file-name filename) nil
661 (when (and (stringp acl-string) (tramp-sudoedit-remote-acl-p v)) 659 (when (and (stringp acl-string) (tramp-sudoedit-remote-acl-p v))
662 ;; Massage `acl-string'. 660 ;; Massage `acl-string'.
663 (setq acl-string 661 (setq acl-string (string-join (split-string acl-string "\n" 'omit) ","))
664 (mapconcat #'identity (split-string acl-string "\n" 'omit) ","))
665 (prog1 662 (prog1
666 (tramp-sudoedit-send-command 663 (tramp-sudoedit-send-command
667 v "setfacl" "-m" 664 v "setfacl" "-m"
@@ -830,7 +827,7 @@ in case of error, t otherwise."
830 (tramp-verbose (if (= tramp-verbose 3) 2 tramp-verbose)) 827 (tramp-verbose (if (= tramp-verbose 3) 2 tramp-verbose))
831 ;; We do not want to save the password. 828 ;; We do not want to save the password.
832 auth-source-save-behavior) 829 auth-source-save-behavior)
833 (tramp-message vec 6 "%s" (mapconcat #'identity (process-command p) " ")) 830 (tramp-message vec 6 "%s" (string-join (process-command p) " "))
834 ;; Avoid process status message in output buffer. 831 ;; Avoid process status message in output buffer.
835 (set-process-sentinel p #'ignore) 832 (set-process-sentinel p #'ignore)
836 (process-put p 'vector vec) 833 (process-put p 'vector vec)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 3efac8d74f9..90f7491bf51 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -8,7 +8,7 @@
8;; Keywords: comm, processes 8;; Keywords: comm, processes
9;; Package: tramp 9;; Package: tramp
10;; Version: 2.4.2-pre 10;; Version: 2.4.2-pre
11;; Package-Requires: ((emacs "24.1")) 11;; Package-Requires: ((emacs "24.4"))
12;; URL: https://savannah.gnu.org/projects/tramp 12;; URL: https://savannah.gnu.org/projects/tramp
13 13
14;; This file is part of GNU Emacs. 14;; This file is part of GNU Emacs.
@@ -572,10 +572,7 @@ This regexp must match both `tramp-initial-end-of-output' and
572 :type 'regexp) 572 :type 'regexp)
573 573
574(defcustom tramp-password-prompt-regexp 574(defcustom tramp-password-prompt-regexp
575 (format "^.*\\(%s\\).*:\^@? *" 575 (format "^.*\\(%s\\).*:\^@? *" (regexp-opt password-word-equivalents))
576 ;; `password-word-equivalents' has been introduced with Emacs 24.4.
577 (regexp-opt (or (bound-and-true-p password-word-equivalents)
578 '("password" "passphrase"))))
579 "Regexp matching password-like prompts. 576 "Regexp matching password-like prompts.
580The regexp should match at end of buffer. 577The regexp should match at end of buffer.
581 578
@@ -1862,10 +1859,7 @@ an input event arrives. The other arguments are passed to `tramp-error'."
1862(defun tramp-user-error (vec-or-proc fmt-string &rest arguments) 1859(defun tramp-user-error (vec-or-proc fmt-string &rest arguments)
1863 "Signal a user error (or \"pilot error\")." 1860 "Signal a user error (or \"pilot error\")."
1864 (unwind-protect 1861 (unwind-protect
1865 (apply 1862 (apply #'tramp-error vec-or-proc 'user-error fmt-string arguments)
1866 #'tramp-error vec-or-proc
1867 ;; `user-error' has appeared in Emacs 24.3.
1868 (if (fboundp 'user-error) 'user-error 'error) fmt-string arguments)
1869 ;; Save exit. 1863 ;; Save exit.
1870 (when (and tramp-message-show-message 1864 (when (and tramp-message-show-message
1871 (not (zerop tramp-verbose)) 1865 (not (zerop tramp-verbose))
@@ -2103,21 +2097,7 @@ value of `default-file-modes', without execute permissions."
2103(defun tramp-replace-environment-variables (filename) 2097(defun tramp-replace-environment-variables (filename)
2104 "Replace environment variables in FILENAME. 2098 "Replace environment variables in FILENAME.
2105Return the string with the replaced variables." 2099Return the string with the replaced variables."
2106 (or (ignore-errors 2100 (substitute-env-vars filename 'only-defined))
2107 ;; Optional arg has been introduced with Emacs 24.4.
2108 (tramp-compat-funcall 'substitute-env-vars filename 'only-defined))
2109 ;; We need an own implementation.
2110 (save-match-data
2111 (let ((idx (string-match "\\$\\(\\w+\\)" filename)))
2112 ;; `$' is coded as `$$'.
2113 (when (and idx
2114 (or (zerop idx) (not (eq ?$ (aref filename (1- idx)))))
2115 (getenv (match-string 1 filename)))
2116 (setq filename
2117 (replace-match
2118 (substitute-in-file-name (match-string 0 filename))
2119 t nil filename)))
2120 filename))))
2121 2101
2122(defun tramp-find-file-name-coding-system-alist (filename tmpname) 2102(defun tramp-find-file-name-coding-system-alist (filename tmpname)
2123 "Like `find-operation-coding-system' for Tramp filenames. 2103 "Like `find-operation-coding-system' for Tramp filenames.
@@ -4149,31 +4129,34 @@ Erase echoed commands if exists."
4149Expects the output of PROC to be sent to the current buffer. Returns 4129Expects the output of PROC to be sent to the current buffer. Returns
4150the string that matched, or nil. Waits indefinitely if TIMEOUT is 4130the string that matched, or nil. Waits indefinitely if TIMEOUT is
4151nil." 4131nil."
4152 (with-current-buffer (process-buffer proc) 4132 (let ((found (tramp-check-for-regexp proc regexp)))
4153 (let ((found (tramp-check-for-regexp proc regexp))) 4133 (cond (timeout
4154 (cond (timeout 4134 (with-timeout (timeout)
4155 (with-timeout (timeout)
4156 (while (not found)
4157 (tramp-accept-process-output proc)
4158 (unless (process-live-p proc)
4159 (tramp-error-with-buffer
4160 nil proc 'file-error "Process has died"))
4161 (setq found (tramp-check-for-regexp proc regexp)))))
4162 (t
4163 (while (not found) 4135 (while (not found)
4164 (tramp-accept-process-output proc) 4136 (tramp-accept-process-output proc)
4165 (unless (process-live-p proc) 4137 (unless (process-live-p proc)
4166 (tramp-error-with-buffer 4138 (tramp-error-with-buffer
4167 nil proc 'file-error "Process has died")) 4139 nil proc 'file-error "Process has died"))
4168 (setq found (tramp-check-for-regexp proc regexp))))) 4140 (setq found (tramp-check-for-regexp proc regexp)))))
4169 (tramp-message proc 6 "\n%s" (buffer-string)) 4141 (t
4170 (unless found 4142 (while (not found)
4171 (if timeout 4143 (tramp-accept-process-output proc)
4172 (tramp-error 4144 (unless (process-live-p proc)
4173 proc 'file-error "[[Regexp `%s' not found in %d secs]]" 4145 (tramp-error-with-buffer
4174 regexp timeout) 4146 nil proc 'file-error "Process has died"))
4175 (tramp-error proc 'file-error "[[Regexp `%s' not found]]" regexp))) 4147 (setq found (tramp-check-for-regexp proc regexp)))))
4176 found))) 4148 ;; The process could have timed out, for example due to session
4149 ;; timeout of sudo. The process buffer does not exist any longer then.
4150 (ignore-errors
4151 (with-current-buffer (process-buffer proc)
4152 (tramp-message proc 6 "\n%s" (buffer-string))))
4153 (unless found
4154 (if timeout
4155 (tramp-error
4156 proc 'file-error "[[Regexp `%s' not found in %d secs]]"
4157 regexp timeout)
4158 (tramp-error proc 'file-error "[[Regexp `%s' not found]]" regexp)))
4159 found))
4177 4160
4178;; It seems that Tru64 Unix does not like it if long strings are sent 4161;; It seems that Tru64 Unix does not like it if long strings are sent
4179;; to it in one go. (This happens when sending the Perl 4162;; 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
4200 (setq string 4183 (setq string
4201 (mapconcat 4184 (mapconcat
4202 #'identity (split-string string "\n") tramp-rsh-end-of-line)) 4185 #'identity (split-string string "\n") tramp-rsh-end-of-line))
4203 (unless (or (string= string "") 4186 (unless (or (string-empty-p string)
4204 (string-equal (substring string -1) tramp-rsh-end-of-line)) 4187 (string-equal (substring string -1) tramp-rsh-end-of-line))
4205 (setq string (concat string tramp-rsh-end-of-line))) 4188 (setq string (concat string tramp-rsh-end-of-line)))
4206 ;; Send the string. 4189 ;; Send the string.
@@ -4408,12 +4391,10 @@ ID-FORMAT valid values are `string' and `integer'."
4408 ;; We use key nil for local connection properties. 4391 ;; We use key nil for local connection properties.
4409 (with-tramp-connection-property nil (format "gid-%s" id-format) 4392 (with-tramp-connection-property nil (format "gid-%s" id-format)
4410 (cond 4393 (cond
4411 ;; `group-gid' has been introduced with Emacs 24.4. 4394 ((equal id-format 'integer) (group-gid))
4412 ((and (fboundp 'group-gid) (equal id-format 'integer))
4413 (tramp-compat-funcall 'group-gid))
4414 ;; `group-name' has been introduced with Emacs 27.1. 4395 ;; `group-name' has been introduced with Emacs 27.1.
4415 ((and (fboundp 'group-name) (equal id-format 'string)) 4396 ((and (fboundp 'group-name) (equal id-format 'string))
4416 (tramp-compat-funcall 'group-name (tramp-compat-funcall 'group-gid))) 4397 (tramp-compat-funcall 'group-name (group-gid)))
4417 ((tramp-compat-file-attribute-group-id 4398 ((tramp-compat-file-attribute-group-id
4418 (file-attributes "~/" id-format)))))) 4399 (file-attributes "~/" id-format))))))
4419 4400
@@ -4647,7 +4628,7 @@ are written with verbosity of 6."
4647 output error result) 4628 output error result)
4648 (tramp-message 4629 (tramp-message
4649 vec 6 "`%s %s' %s %s" 4630 vec 6 "`%s %s' %s %s"
4650 program (mapconcat #'identity args " ") infile destination) 4631 program (string-join args " ") infile destination)
4651 (condition-case err 4632 (condition-case err
4652 (with-temp-buffer 4633 (with-temp-buffer
4653 (setq result 4634 (setq result
@@ -4680,7 +4661,7 @@ are written with verbosity of 6."
4680 result) 4661 result)
4681 (tramp-message 4662 (tramp-message
4682 vec 6 "`%s %s' %s %s %s %s" 4663 vec 6 "`%s %s' %s %s %s %s"
4683 program (mapconcat #'identity args " ") start end delete buffer) 4664 program (string-join args " ") start end delete buffer)
4684 (condition-case err 4665 (condition-case err
4685 (progn 4666 (progn
4686 (setq result 4667 (setq result
@@ -4709,7 +4690,7 @@ verbosity of 6."
4709 (vec (or vec (car tramp-current-connection))) 4690 (vec (or vec (car tramp-current-connection)))
4710 result) 4691 result)
4711 (if args 4692 (if args
4712 (tramp-message vec 6 "%s %s" program (mapconcat #'identity args " ")) 4693 (tramp-message vec 6 "%s %s" program (string-join args " "))
4713 (tramp-message vec 6 "%s" program)) 4694 (tramp-message vec 6 "%s" program))
4714 (setq result 4695 (setq result
4715 (condition-case err 4696 (condition-case err
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 4e1be417a05..79e2b079858 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -63,7 +63,7 @@
63 "The repository revision of the Tramp sources.") 63 "The repository revision of the Tramp sources.")
64 64
65;; Check for Emacs version. 65;; Check for Emacs version.
66(let ((x (if (not (string-lessp emacs-version "24.1")) 66(let ((x (if (not (string-lessp emacs-version "24.4"))
67 "ok" 67 "ok"
68 (format "Tramp 2.4.2-pre is not fit for %s" 68 (format "Tramp 2.4.2-pre is not fit for %s"
69 (replace-regexp-in-string "\n" "" (emacs-version)))))) 69 (replace-regexp-in-string "\n" "" (emacs-version))))))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 525f62a3c0b..afe6488ea71 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -19,8 +19,6 @@
19 19
20;;; Commentary: 20;;; Commentary:
21 21
22;; The tests require a recent ert.el from Emacs 24.4.
23
24;; Some of the tests require access to a remote host files. Since 22;; Some of the tests require access to a remote host files. Since
25;; this could be problematic, a mock-up connection method "mock" is 23;; this could be problematic, a mock-up connection method "mock" is
26;; used. Emulating a remote connection, it simply calls "sh -i". 24;; used. Emulating a remote connection, it simply calls "sh -i".
@@ -410,9 +408,6 @@ properly. BODY shall not contain a timeout."
410 408
411(ert-deftest tramp-test02-file-name-dissect () 409(ert-deftest tramp-test02-file-name-dissect ()
412 "Check remote file name components." 410 "Check remote file name components."
413 ;; `user-error' has appeared in Emacs 24.3.
414 (skip-unless (fboundp 'user-error))
415
416 (let ((tramp-default-method "default-method") 411 (let ((tramp-default-method "default-method")
417 (tramp-default-user "default-user") 412 (tramp-default-user "default-user")
418 (tramp-default-host "default-host") 413 (tramp-default-host "default-host")
@@ -863,9 +858,6 @@ properly. BODY shall not contain a timeout."
863(ert-deftest tramp-test02-file-name-dissect-simplified () 858(ert-deftest tramp-test02-file-name-dissect-simplified ()
864 "Check simplified file name components." 859 "Check simplified file name components."
865 :tags '(:expensive-test) 860 :tags '(:expensive-test)
866 ;; `user-error' has appeared in Emacs 24.3.
867 (skip-unless (fboundp 'user-error))
868
869 (let ((tramp-default-method "default-method") 861 (let ((tramp-default-method "default-method")
870 (tramp-default-user "default-user") 862 (tramp-default-user "default-user")
871 (tramp-default-host "default-host") 863 (tramp-default-host "default-host")
@@ -1197,9 +1189,6 @@ properly. BODY shall not contain a timeout."
1197(ert-deftest tramp-test02-file-name-dissect-separate () 1189(ert-deftest tramp-test02-file-name-dissect-separate ()
1198 "Check separate file name components." 1190 "Check separate file name components."
1199 :tags '(:expensive-test) 1191 :tags '(:expensive-test)
1200 ;; `user-error' has appeared in Emacs 24.3.
1201 (skip-unless (fboundp 'user-error))
1202
1203 (let ((tramp-default-method "default-method") 1192 (let ((tramp-default-method "default-method")
1204 (tramp-default-user "default-user") 1193 (tramp-default-user "default-user")
1205 (tramp-default-host "default-host") 1194 (tramp-default-host "default-host")
@@ -1889,8 +1878,6 @@ properly. BODY shall not contain a timeout."
1889 "Check host name rules for host-less methods." 1878 "Check host name rules for host-less methods."
1890 (skip-unless (tramp--test-enabled)) 1879 (skip-unless (tramp--test-enabled))
1891 (skip-unless (tramp--test-sh-p)) 1880 (skip-unless (tramp--test-sh-p))
1892 ;; `user-error' has appeared in Emacs 24.3.
1893 (skip-unless (fboundp 'user-error))
1894 1881
1895 ;; Host names must match rules in case the command template of a 1882 ;; Host names must match rules in case the command template of a
1896 ;; method doesn't use them. 1883 ;; method doesn't use them.
@@ -1914,8 +1901,6 @@ properly. BODY shall not contain a timeout."
1914(ert-deftest tramp-test03-file-name-method-rules () 1901(ert-deftest tramp-test03-file-name-method-rules ()
1915 "Check file name rules for some methods." 1902 "Check file name rules for some methods."
1916 (skip-unless (tramp--test-enabled)) 1903 (skip-unless (tramp--test-enabled))
1917 ;; `user-error' has appeared in Emacs 24.3.
1918 (skip-unless (fboundp 'user-error))
1919 1904
1920 ;; Multi hops are allowed for inline methods only. 1905 ;; Multi hops are allowed for inline methods only.
1921 (should-error 1906 (should-error