aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2022-09-04 13:44:30 +0200
committerMichael Albinus2022-09-04 13:44:30 +0200
commitf1635c8efb30cd42b83e31aa29be58aeb2965a9a (patch)
tree639df60e90b7f2b36fd9979fb8610b73efe1b87f
parent4751b51d5e1182975aa002af08a625e4859ec276 (diff)
downloademacs-f1635c8efb30cd42b83e31aa29be58aeb2965a9a.tar.gz
emacs-f1635c8efb30cd42b83e31aa29be58aeb2965a9a.zip
Fix rx forms in Tramp
* lisp/net/tramp.el (tramp-restricted-shell-hosts-alist) (tramp-local-host-regexp, tramp-echoed-echo-mark-regexp) (tramp-login-prompt-regexp, tramp-terminal-prompt-regexp) (tramp-antispoof-regexp) (tramp-build-completion-file-name-regexp) (tramp-debug-outline-regexp) (tramp-use-absolute-autoload-file-names) (tramp-lock-file-info-regexp, tramp-shell-quote-argument): * lisp/net/tramp-adb.el (tramp-do-parse-file-attributes-with-ls) * lisp/net/tramp-cache.el (tramp-flush-file-function): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name): * lisp/net/tramp-integration.el (tramp-rfn-eshadow-update-overlay-regexp) (info-lookup-maybe-add-help): * lisp/net/tramp-sh.el (tramp-default-user-alist, tramp-sunos-unames) (tramp-scp-direct-remote-copying, tramp-get-remote-locale): * lisp/net/tramp-smb.el (tramp-smb-prompt, tramp-smb-wrong-passwd-regexp) (tramp-smb-errors, tramp-smb-get-localname) (tramp-smb-read-file-entry): Simplify rx forms. * lisp/net/tramp.el (tramp-handle-find-backup-file-name) (tramp-handle-lock-file, tramp-handle-make-auto-save-file-name): * lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times) (tramp-adb-maybe-open-connection): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-attributes-with-gvfs-ls-regexp): * lisp/net/tramp-sh.el (tramp-open-shell, tramp-find-shell): Do not use `eval-when-compile'. * lisp/net/tramp-cmds.el (tramp-rename-files, tramp-rename-these-files): Use rx. * lisp/net/tramp-gvfs.el (tramp-gvfs-password-tcrypt): New defonst. (tramp-gvfs-handle-file-attributes): Use `number-to-string'. * test/lisp/net/tramp-archive-tests.el (tramp-archive-test17-insert-directory): * test/lisp/net/tramp-tests.el (tramp-test17-insert-directory) (tramp--test-share-p): Simplify rx forms.
-rw-r--r--lisp/net/tramp-adb.el20
-rw-r--r--lisp/net/tramp-archive.el4
-rw-r--r--lisp/net/tramp-cache.el2
-rw-r--r--lisp/net/tramp-cmds.el4
-rw-r--r--lisp/net/tramp-gvfs.el19
-rw-r--r--lisp/net/tramp-integration.el10
-rw-r--r--lisp/net/tramp-sh.el27
-rw-r--r--lisp/net/tramp-smb.el116
-rw-r--r--lisp/net/tramp.el181
-rw-r--r--test/lisp/net/tramp-archive-tests.el8
-rw-r--r--test/lisp/net/tramp-tests.el10
11 files changed, 195 insertions, 206 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index b38b908edb0..ab38ffa0cf9 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -278,10 +278,10 @@ arguments to pass to the OPERATION."
278 (name (match-string 6)) 278 (name (match-string 6))
279 (symlink-target 279 (symlink-target
280 (and is-symlink 280 (and is-symlink
281 (cadr (split-string name (rx (group (| " -> " "\n")))))))) 281 (cadr (split-string name (rx (| " -> " "\n")))))))
282 (push (list 282 (push (list
283 (if is-symlink 283 (if is-symlink
284 (car (split-string name (rx (group (| " -> " "\n"))))) 284 (car (split-string name (rx (| " -> " "\n"))))
285 name) 285 name)
286 (or is-dir symlink-target) 286 (or is-dir symlink-target)
287 1 ;link-count 287 1 ;link-count
@@ -560,10 +560,9 @@ Emacs dired can't find files."
560 ;; (introduced in POSIX.1-2008) fails. 560 ;; (introduced in POSIX.1-2008) fails.
561 (tramp-adb-send-command-and-check 561 (tramp-adb-send-command-and-check
562 v (format 562 v (format
563 (eval-when-compile 563 (concat "touch -d %s %s %s 2>%s || "
564 (concat "touch -d %s %s %s 2>%s || " 564 "touch -d %s %s %s 2>%s || "
565 "touch -d %s %s %s 2>%s || " 565 "touch -t %s %s %s")
566 "touch -t %s %s %s"))
567 (format-time-string "%Y-%m-%dT%H:%M:%S.%NZ" time t) 566 (format-time-string "%Y-%m-%dT%H:%M:%S.%NZ" time t)
568 nofollow quoted-name (tramp-get-remote-null-device v) 567 nofollow quoted-name (tramp-get-remote-null-device v)
569 (format-time-string "%Y-%m-%dT%H:%M:%S" time t) 568 (format-time-string "%Y-%m-%dT%H:%M:%S" time t)
@@ -1284,11 +1283,10 @@ connection if a previous connection has died for some reason."
1284 (tramp-message vec 5 "Checking system information") 1283 (tramp-message vec 5 "Checking system information")
1285 (tramp-adb-send-command 1284 (tramp-adb-send-command
1286 vec 1285 vec
1287 (eval-when-compile 1286 (concat
1288 (concat 1287 "echo \\\"`getprop ro.product.model` "
1289 "echo \\\"`getprop ro.product.model` " 1288 "`getprop ro.product.version` "
1290 "`getprop ro.product.version` " 1289 "`getprop ro.build.version.release`\\\""))
1291 "`getprop ro.build.version.release`\\\"")))
1292 (let ((old-getprop (tramp-get-connection-property vec "getprop")) 1290 (let ((old-getprop (tramp-get-connection-property vec "getprop"))
1293 (new-getprop 1291 (new-getprop
1294 (tramp-set-connection-property 1292 (tramp-set-connection-property
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index 0d931b42da4..c25d5096719 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -185,14 +185,14 @@ It must be supported by libarchive(3).")
185(progn (defmacro tramp-archive-autoload-file-name-regexp () 185(progn (defmacro tramp-archive-autoload-file-name-regexp ()
186 "Regular expression matching archive file names." 186 "Regular expression matching archive file names."
187 '(rx bos 187 '(rx bos
188 ;; \1 188 ;; This group is used in `tramp-archive-file-name-archive'.
189 (group 189 (group
190 (+ nonl) 190 (+ nonl)
191 ;; Default suffixes ... 191 ;; Default suffixes ...
192 "." (regexp (regexp-opt tramp-archive-suffixes)) 192 "." (regexp (regexp-opt tramp-archive-suffixes))
193 ;; ... with compression. 193 ;; ... with compression.
194 (? "." (regexp (regexp-opt tramp-archive-compression-suffixes)))) 194 (? "." (regexp (regexp-opt tramp-archive-compression-suffixes))))
195 ;; \2 195 ;; This group is used in `tramp-archive-file-name-localname'.
196 (group "/" (* nonl)) 196 (group "/" (* nonl))
197 eos))) 197 eos)))
198 198
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 6a3e60f7037..4c745092a3e 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -278,7 +278,7 @@ Remove also properties of all files in subdirectories."
278This is suppressed for temporary buffers." 278This is suppressed for temporary buffers."
279 (save-match-data 279 (save-match-data
280 (unless (or (null (buffer-name)) 280 (unless (or (null (buffer-name))
281 (string-match-p (rx bos (| " " "*")) (buffer-name))) 281 (string-match-p (rx bos (| space "*")) (buffer-name)))
282 (let ((bfn (if (stringp (buffer-file-name)) 282 (let ((bfn (if (stringp (buffer-file-name))
283 (buffer-file-name) 283 (buffer-file-name)
284 default-directory)) 284 default-directory))
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index a7ac1352665..ad531b427a4 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -355,7 +355,7 @@ The remote connection identified by SOURCE is flushed by
355 (dir (tramp-rename-read-file-name-dir default)) 355 (dir (tramp-rename-read-file-name-dir default))
356 (init (tramp-rename-read-file-name-init default)) 356 (init (tramp-rename-read-file-name-init default))
357 (tramp-ignored-file-name-regexp 357 (tramp-ignored-file-name-regexp
358 (regexp-quote (file-remote-p source)))) 358 (rx (literal (file-remote-p source)))))
359 (read-file-name-default 359 (read-file-name-default
360 "Enter new Tramp connection: " 360 "Enter new Tramp connection: "
361 dir default 'confirm init #'file-directory-p))))) 361 dir default 'confirm init #'file-directory-p)))))
@@ -466,7 +466,7 @@ For details, see `tramp-rename-files'."
466 (dir (tramp-rename-read-file-name-dir default)) 466 (dir (tramp-rename-read-file-name-dir default))
467 (init (tramp-rename-read-file-name-init default)) 467 (init (tramp-rename-read-file-name-init default))
468 (tramp-ignored-file-name-regexp 468 (tramp-ignored-file-name-regexp
469 (regexp-quote (file-remote-p source)))) 469 (rx (literal (file-remote-p source)))))
470 (read-file-name-default 470 (read-file-name-default
471 (format "Change Tramp connection `%s': " source) 471 (format "Change Tramp connection `%s': " source)
472 dir default 'confirm init #'file-directory-p))))) 472 dir default 'confirm init #'file-directory-p)))))
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 9060f37ed57..9c81bccffc9 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -316,6 +316,10 @@ It has been changed in GVFS 1.14.")
316(defconst tramp-gvfs-password-anonymous-supported 16 316(defconst tramp-gvfs-password-anonymous-supported 16
317 "Operation supports anonymous users.") 317 "Operation supports anonymous users.")
318 318
319;; Since: 2.58
320(defconst tramp-gvfs-password-tcrypt 32
321 "Operation takes TCRYPT parameters.")
322
319;; For the time being, we just need org.goa.Account and org.goa.Files 323;; For the time being, we just need org.goa.Account and org.goa.Files
320;; interfaces. We document the other ones, just in case. 324;; interfaces. We document the other ones, just in case.
321 325
@@ -710,11 +714,10 @@ It has been changed in GVFS 1.14.")
710 "unix::device") 714 "unix::device")
711 "GVFS file attributes.")) 715 "GVFS file attributes."))
712 716
713(eval-and-compile 717(defconst tramp-gvfs-file-attributes-with-gvfs-ls-regexp
714 (defconst tramp-gvfs-file-attributes-with-gvfs-ls-regexp 718 (rx blank (group (regexp (regexp-opt tramp-gvfs-file-attributes)))
715 (rx blank (group (regexp (regexp-opt tramp-gvfs-file-attributes))) 719 "=" (group (+? nonl)))
716 "=" (group (+? nonl))) 720 "Regexp to parse GVFS file attributes with `gvfs-ls'.")
717 "Regexp to parse GVFS file attributes with `gvfs-ls'."))
718 721
719(defconst tramp-gvfs-file-attributes-with-gvfs-info-regexp 722(defconst tramp-gvfs-file-attributes-with-gvfs-info-regexp
720 (rx bol (* blank) (group (regexp (regexp-opt tramp-gvfs-file-attributes))) 723 (rx bol (* blank) (group (regexp (regexp-opt tramp-gvfs-file-attributes)))
@@ -1317,7 +1320,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
1317 (if (eq id-format 'integer) 1320 (if (eq id-format 'integer)
1318 (string-to-number 1321 (string-to-number
1319 (or (cdr (assoc "unix::uid" attributes)) 1322 (or (cdr (assoc "unix::uid" attributes))
1320 (eval-when-compile (format "%s" tramp-unknown-id-integer)))) 1323 (number-to-string tramp-unknown-id-integer)))
1321 (or (cdr (assoc "owner::user" attributes)) 1324 (or (cdr (assoc "owner::user" attributes))
1322 (cdr (assoc "unix::uid" attributes)) 1325 (cdr (assoc "unix::uid" attributes))
1323 tramp-unknown-id-string))) 1326 tramp-unknown-id-string)))
@@ -1325,7 +1328,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
1325 (if (eq id-format 'integer) 1328 (if (eq id-format 'integer)
1326 (string-to-number 1329 (string-to-number
1327 (or (cdr (assoc "unix::gid" attributes)) 1330 (or (cdr (assoc "unix::gid" attributes))
1328 (eval-when-compile (format "%s" tramp-unknown-id-integer)))) 1331 (number-to-string tramp-unknown-id-integer)))
1329 (or (cdr (assoc "owner::group" attributes)) 1332 (or (cdr (assoc "owner::group" attributes))
1330 (cdr (assoc "unix::gid" attributes)) 1333 (cdr (assoc "unix::gid" attributes))
1331 tramp-unknown-id-string))) 1334 tramp-unknown-id-string)))
@@ -1726,7 +1729,7 @@ ID-FORMAT valid values are `string' and `integer'."
1726 "Retrieve file name from D-Bus OBJECT-PATH." 1729 "Retrieve file name from D-Bus OBJECT-PATH."
1727 (dbus-unescape-from-identifier 1730 (dbus-unescape-from-identifier
1728 (replace-regexp-in-string 1731 (replace-regexp-in-string
1729 (rx bol (* nonl) "/" (+ (not (any "/"))) eol) "\\1" object-path))) 1732 (rx bol (* nonl) "/" (group (+ (not (any "/")))) eol) "\\1" object-path)))
1730 1733
1731(defun tramp-gvfs-url-host (url) 1734(defun tramp-gvfs-url-host (url)
1732 "Return the host name part of URL, a string. 1735 "Return the host name part of URL, a string.
diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el
index 946f9725022..afc3e945802 100644
--- a/lisp/net/tramp-integration.el
+++ b/lisp/net/tramp-integration.el
@@ -86,7 +86,7 @@ special handling of `substitute-in-file-name'."
86(defun tramp-rfn-eshadow-update-overlay-regexp () 86(defun tramp-rfn-eshadow-update-overlay-regexp ()
87 "An overlay covering the shadowed part of the filename." 87 "An overlay covering the shadowed part of the filename."
88 (rx-to-string 88 (rx-to-string
89 `(: (* (not (any ,tramp-postfix-host-format "/~"))) (or "/" "~")))) 89 `(: (* (not (any ,tramp-postfix-host-format "/~"))) (| "/" "~"))))
90 90
91(defun tramp-rfn-eshadow-update-overlay () 91(defun tramp-rfn-eshadow-update-overlay ()
92 "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input. 92 "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input.
@@ -218,11 +218,11 @@ NAME must be equal to `tramp-current-connection'."
218 :mode 'tramp-info-lookup-mode :topic 'symbol 218 :mode 'tramp-info-lookup-mode :topic 'symbol
219 :regexp (rx (+ (not (any "\t\n \"'(),[]`‘’")))) 219 :regexp (rx (+ (not (any "\t\n \"'(),[]`‘’"))))
220 :doc-spec '(("(tramp)Function Index" nil 220 :doc-spec '(("(tramp)Function Index" nil
221 (rx bol " " (+ "-") " " (* nonl) ": ") 221 (rx bol space (+ "-") space (* nonl) ": ")
222 (rx (group (| " " eol)))) 222 (rx (| space eol)))
223 ("(tramp)Variable Index" nil 223 ("(tramp)Variable Index" nil
224 (rx bol " " (+ "-") " " (* nonl) ": ") 224 (rx bol space (+ "-") space (* nonl) ": ")
225 (rx (group (| " " eol)))))) 225 (rx (| space eol)))))
226 226
227 (add-hook 227 (add-hook
228 'tramp-integration-unload-hook 228 'tramp-integration-unload-hook
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 2489ac9aec9..dfb87059bdf 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -414,15 +414,13 @@ The string is used in `tramp-methods'.")
414 ,(rx bos (literal tramp-root-id-string) eos) "su")) 414 ,(rx bos (literal tramp-root-id-string) eos) "su"))
415 415
416 (add-to-list 'tramp-default-user-alist 416 (add-to-list 'tramp-default-user-alist
417 `(,(rx bos (regexp (regexp-opt '("su" "sudo" "doas" "ksu"))) eos) 417 `(,(rx bos (| "su" "sudo" "doas" "ksu") eos)
418 nil ,tramp-root-id-string)) 418 nil ,tramp-root-id-string))
419 ;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored. 419 ;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored.
420 ;; Do not add "plink" based methods, they ask interactively for the user. 420 ;; Do not add "plink" based methods, they ask interactively for the user.
421 (add-to-list 'tramp-default-user-alist 421 (add-to-list 'tramp-default-user-alist
422 `(,(rx bos 422 `(,(rx bos
423 (regexp 423 (| "rcp" "remcp" "rsh" "telnet" "nc" "krlogin" "fcp")
424 (regexp-opt
425 '("rcp" "remcp" "rsh" "telnet" "nc" "krlogin" "fcp")))
426 eos) 424 eos)
427 nil ,(user-login-name)))) 425 nil ,(user-login-name))))
428 426
@@ -1250,7 +1248,7 @@ component is used as the target of the symlink."
1250 (tramp-do-file-attributes-with-perl v localname)) 1248 (tramp-do-file-attributes-with-perl v localname))
1251 (t (tramp-do-file-attributes-with-ls v localname))))))) 1249 (t (tramp-do-file-attributes-with-ls v localname)))))))
1252 1250
1253(defconst tramp-sunos-unames (regexp-opt '("SunOS 5.10" "SunOS 5.11")) 1251(defconst tramp-sunos-unames (rx (| "SunOS 5.10" "SunOS 5.11"))
1254 "Regexp to determine remote SunOS.") 1252 "Regexp to determine remote SunOS.")
1255 1253
1256(defun tramp-sh--quoting-style-options (vec) 1254(defun tramp-sh--quoting-style-options (vec)
@@ -4237,10 +4235,9 @@ file exists and nonzero exit status otherwise."
4237 ;; first. 4235 ;; first.
4238 (tramp-send-command 4236 (tramp-send-command
4239 vec (format 4237 vec (format
4240 (eval-when-compile 4238 (concat
4241 (concat 4239 "exec env TERM='%s' INSIDE_EMACS='%s' "
4242 "exec env TERM='%s' INSIDE_EMACS='%s' " 4240 "ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s -i")
4243 "ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s -i"))
4244 tramp-terminal-type (tramp-inside-emacs) 4241 tramp-terminal-type (tramp-inside-emacs)
4245 (or (getenv-internal "ENV" tramp-remote-process-environment) "") 4242 (or (getenv-internal "ENV" tramp-remote-process-environment) "")
4246 (if (stringp tramp-histfile-override) 4243 (if (stringp tramp-histfile-override)
@@ -4316,10 +4313,9 @@ file exists and nonzero exit status otherwise."
4316 default-shell 4313 default-shell
4317 (tramp-message 4314 (tramp-message
4318 vec 2 4315 vec 2
4319 (eval-when-compile 4316 (concat
4320 (concat 4317 "Couldn't find a remote shell which groks tilde "
4321 "Couldn't find a remote shell which groks tilde " 4318 "expansion, using `%s'")
4322 "expansion, using `%s'"))
4323 default-shell))) 4319 default-shell)))
4324 4320
4325 default-shell))) 4321 default-shell)))
@@ -4980,7 +4976,8 @@ Goes through the list `tramp-inline-compress-commands'."
4980 string 4976 string
4981 (and 4977 (and
4982 (string-match 4978 (string-match
4983 (rx bol (+ (not (any " #"))) " " (+ (not space)) " " 4979 (rx bol (+ (not (any space "#"))) space
4980 (+ (not space)) space
4984 (group (+ (not space))) eol) 4981 (group (+ (not space))) eol)
4985 string) 4982 string)
4986 (match-string 1 string)) 4983 (match-string 1 string))
@@ -5554,7 +5551,7 @@ Nonexistent directories are removed from spec."
5554 (while candidates 5551 (while candidates
5555 (goto-char (point-min)) 5552 (goto-char (point-min))
5556 (if (string-match-p 5553 (if (string-match-p
5557 (rx bol (literal (car candidates))"%s" (? "\r") eol) 5554 (rx bol (literal (car candidates)) (? "\r") eol)
5558 (buffer-string)) 5555 (buffer-string))
5559 (setq locale (car candidates) 5556 (setq locale (car candidates)
5560 candidates nil) 5557 candidates nil)
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 9e63d532626..3d65520282b 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -98,15 +98,14 @@ this variable \"client min protocol=NT1\"."
98 "Regexp of SMB server identification.") 98 "Regexp of SMB server identification.")
99 99
100(defconst tramp-smb-prompt 100(defconst tramp-smb-prompt
101 (rx bol (| (: (| "smb:" "PS") " " (+ nonl) "> ") 101 (rx bol (| (: (| "smb:" "PS") space (+ nonl) "> ")
102 (: (+ space) "Server" 102 (: (+ space) "Server"
103 (+ space) "Comment" eol))) 103 (+ space) "Comment" eol)))
104 "Regexp used as prompt in smbclient or powershell.") 104 "Regexp used as prompt in smbclient or powershell.")
105 105
106(defconst tramp-smb-wrong-passwd-regexp 106(defconst tramp-smb-wrong-passwd-regexp
107 (regexp-opt 107 (rx (| "NT_STATUS_LOGON_FAILURE"
108 '("NT_STATUS_LOGON_FAILURE" 108 "NT_STATUS_WRONG_PASSWORD"))
109 "NT_STATUS_WRONG_PASSWORD"))
110 "Regexp for login error strings of SMB servers.") 109 "Regexp for login error strings of SMB servers.")
111 110
112(defconst tramp-smb-errors 111(defconst tramp-smb-errors
@@ -116,57 +115,56 @@ this variable \"client min protocol=NT1\"."
116 "Call timed out: server did not respond" 115 "Call timed out: server did not respond"
117 (: (+ (not space)) ": command not found") 116 (: (+ (not space)) ": command not found")
118 "Server doesn't support UNIX CIFS calls" 117 "Server doesn't support UNIX CIFS calls"
119 (regexp (regexp-opt 118 (| ;; Samba.
120 '(;; Samba. 119 "ERRDOS"
121 "ERRDOS" 120 "ERRHRD"
122 "ERRHRD" 121 "ERRSRV"
123 "ERRSRV" 122 "ERRbadfile"
124 "ERRbadfile" 123 "ERRbadpw"
125 "ERRbadpw" 124 "ERRfilexists"
126 "ERRfilexists" 125 "ERRnoaccess"
127 "ERRnoaccess" 126 "ERRnomem"
128 "ERRnomem" 127 "ERRnosuchshare"
129 "ERRnosuchshare" 128 ;; See /usr/include/samba-4.0/core/ntstatus.h.
130 ;; See /usr/include/samba-4.0/core/ntstatus.h. 129 ;; Windows 4.0 (Windows NT), Windows 5.0 (Windows 2000),
131 ;; Windows 4.0 (Windows NT), Windows 5.0 (Windows 2000), 130 ;; Windows 5.1 (Windows XP), Windows 5.2 (Windows Server 2003),
132 ;; Windows 5.1 (Windows XP), Windows 5.2 (Windows Server 2003), 131 ;; Windows 6.0 (Windows Vista), Windows 6.1 (Windows 7),
133 ;; Windows 6.0 (Windows Vista), Windows 6.1 (Windows 7), 132 ;; Windows 6.3 (Windows Server 2012, Windows 10).
134 ;; Windows 6.3 (Windows Server 2012, Windows 10). 133 "NT_STATUS_ACCESS_DENIED"
135 "NT_STATUS_ACCESS_DENIED" 134 "NT_STATUS_ACCOUNT_LOCKED_OUT"
136 "NT_STATUS_ACCOUNT_LOCKED_OUT" 135 "NT_STATUS_BAD_NETWORK_NAME"
137 "NT_STATUS_BAD_NETWORK_NAME" 136 "NT_STATUS_CANNOT_DELETE"
138 "NT_STATUS_CANNOT_DELETE" 137 "NT_STATUS_CONNECTION_DISCONNECTED"
139 "NT_STATUS_CONNECTION_DISCONNECTED" 138 "NT_STATUS_CONNECTION_REFUSED"
140 "NT_STATUS_CONNECTION_REFUSED" 139 "NT_STATUS_CONNECTION_RESET"
141 "NT_STATUS_CONNECTION_RESET" 140 "NT_STATUS_DIRECTORY_NOT_EMPTY"
142 "NT_STATUS_DIRECTORY_NOT_EMPTY" 141 "NT_STATUS_DUPLICATE_NAME"
143 "NT_STATUS_DUPLICATE_NAME" 142 "NT_STATUS_FILE_IS_A_DIRECTORY"
144 "NT_STATUS_FILE_IS_A_DIRECTORY" 143 "NT_STATUS_HOST_UNREACHABLE"
145 "NT_STATUS_HOST_UNREACHABLE" 144 "NT_STATUS_IMAGE_ALREADY_LOADED"
146 "NT_STATUS_IMAGE_ALREADY_LOADED" 145 "NT_STATUS_INVALID_LEVEL"
147 "NT_STATUS_INVALID_LEVEL" 146 "NT_STATUS_INVALID_PARAMETER"
148 "NT_STATUS_INVALID_PARAMETER" 147 "NT_STATUS_INVALID_PARAMETER_MIX"
149 "NT_STATUS_INVALID_PARAMETER_MIX" 148 "NT_STATUS_IO_TIMEOUT"
150 "NT_STATUS_IO_TIMEOUT" 149 "NT_STATUS_LOGON_FAILURE"
151 "NT_STATUS_LOGON_FAILURE" 150 "NT_STATUS_NETWORK_ACCESS_DENIED"
152 "NT_STATUS_NETWORK_ACCESS_DENIED" 151 "NT_STATUS_NOT_IMPLEMENTED"
153 "NT_STATUS_NOT_IMPLEMENTED" 152 "NT_STATUS_NO_LOGON_SERVERS"
154 "NT_STATUS_NO_LOGON_SERVERS" 153 "NT_STATUS_NO_SUCH_FILE"
155 "NT_STATUS_NO_SUCH_FILE" 154 "NT_STATUS_NO_SUCH_USER"
156 "NT_STATUS_NO_SUCH_USER" 155 "NT_STATUS_NOT_A_DIRECTORY"
157 "NT_STATUS_NOT_A_DIRECTORY" 156 "NT_STATUS_NOT_SUPPORTED"
158 "NT_STATUS_NOT_SUPPORTED" 157 "NT_STATUS_OBJECT_NAME_COLLISION"
159 "NT_STATUS_OBJECT_NAME_COLLISION" 158 "NT_STATUS_OBJECT_NAME_INVALID"
160 "NT_STATUS_OBJECT_NAME_INVALID" 159 "NT_STATUS_OBJECT_NAME_NOT_FOUND"
161 "NT_STATUS_OBJECT_NAME_NOT_FOUND" 160 "NT_STATUS_OBJECT_PATH_SYNTAX_BAD"
162 "NT_STATUS_OBJECT_PATH_SYNTAX_BAD" 161 "NT_STATUS_PASSWORD_MUST_CHANGE"
163 "NT_STATUS_PASSWORD_MUST_CHANGE" 162 "NT_STATUS_RESOURCE_NAME_NOT_FOUND"
164 "NT_STATUS_RESOURCE_NAME_NOT_FOUND" 163 "NT_STATUS_REVISION_MISMATCH"
165 "NT_STATUS_REVISION_MISMATCH" 164 "NT_STATUS_SHARING_VIOLATION"
166 "NT_STATUS_SHARING_VIOLATION" 165 "NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE"
167 "NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE" 166 "NT_STATUS_UNSUCCESSFUL"
168 "NT_STATUS_UNSUCCESSFUL" 167 "NT_STATUS_WRONG_PASSWORD")))
169 "NT_STATUS_WRONG_PASSWORD")))))
170 "Regexp for possible error strings of SMB servers. 168 "Regexp for possible error strings of SMB servers.
171Used instead of analyzing error codes of commands.") 169Used instead of analyzing error codes of commands.")
172 170
@@ -1658,11 +1656,11 @@ If VEC has no cifs capabilities, exchange \"/\" by \"\\\\\"."
1658 ""))) 1656 "")))
1659 1657
1660 ;; Sometimes we have discarded `substitute-in-file-name'. 1658 ;; Sometimes we have discarded `substitute-in-file-name'.
1661 (when (string-match (rx (group "$$") (group (| "/" eol))) localname) 1659 (when (string-match (rx (group "$$") (| "/" eol)) localname)
1662 (setq localname (replace-match "$" nil nil localname 1))) 1660 (setq localname (replace-match "$" nil nil localname 1)))
1663 1661
1664 ;; A trailing space is not supported. 1662 ;; A trailing space is not supported.
1665 (when (string-match-p (rx " " eol) localname) 1663 (when (string-match-p (rx space eol) localname)
1666 (tramp-error 1664 (tramp-error
1667 vec 'file-error 1665 vec 'file-error
1668 "Invalid file name %s" (tramp-make-tramp-file-name vec localname))) 1666 "Invalid file name %s" (tramp-make-tramp-file-name vec localname)))
@@ -1821,7 +1819,7 @@ are listed. Result is the list (LOCALNAME MODE SIZE MTIME)."
1821 (cl-return)) 1819 (cl-return))
1822 1820
1823 ;; weekday. 1821 ;; weekday.
1824 (if (string-match-p (rx (group (+ wordchar)) eol) line) 1822 (if (string-match-p (rx (+ wordchar) eol) line)
1825 (setq line (substring line 0 -5)) 1823 (setq line (substring line 0 -5))
1826 (cl-return)) 1824 (cl-return))
1827 1825
@@ -1856,7 +1854,7 @@ are listed. Result is the list (LOCALNAME MODE SIZE MTIME)."
1856 ;; localname. 1854 ;; localname.
1857 (if (string-match 1855 (if (string-match
1858 (rx bol (+ space) 1856 (rx bol (+ space)
1859 (group (not space) (? (group (* nonl) (not space)))) 1857 (group (not space) (? (* nonl) (not space)))
1860 (* space) eol) 1858 (* space) eol)
1861 line) 1859 line)
1862 (setq localname (match-string 1 line)) 1860 (setq localname (match-string 1 line))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index bb6eeaa7417..bf8c5d4a3df 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -516,8 +516,8 @@ interpreted as a regular expression which always matches."
516(defcustom tramp-restricted-shell-hosts-alist 516(defcustom tramp-restricted-shell-hosts-alist
517 (when (and (eq system-type 'windows-nt) 517 (when (and (eq system-type 'windows-nt)
518 (not (string-match-p (rx "sh" eol) tramp-encoding-shell))) 518 (not (string-match-p (rx "sh" eol) tramp-encoding-shell)))
519 (list (rx bos (group (| (literal (downcase tramp-system-name)) 519 (list (rx bos (| (literal (downcase tramp-system-name))
520 (literal (upcase tramp-system-name)))) 520 (literal (upcase tramp-system-name)))
521 eos))) 521 eos)))
522 "List of hosts, which run a restricted shell. 522 "List of hosts, which run a restricted shell.
523This is a list of regular expressions, which denote hosts running 523This is a list of regular expressions, which denote hosts running
@@ -530,9 +530,8 @@ host runs a restricted shell, it shall be added to this list, too."
530;;;###tramp-autoload 530;;;###tramp-autoload
531(defcustom tramp-local-host-regexp 531(defcustom tramp-local-host-regexp
532 (rx bos 532 (rx bos
533 (regexp (regexp-opt 533 (| (literal tramp-system-name)
534 `("localhost" "localhost4" "localhost6" 534 (| "localhost" "localhost4" "localhost6" "127.0.0.1" "::1"))
535 ,tramp-system-name "127.0.0.1" "::1")))
536 eos) 535 eos)
537 "Host names which are regarded as local host. 536 "Host names which are regarded as local host.
538If the local host runs a chrooted environment, set this to nil." 537If the local host runs a chrooted environment, set this to nil."
@@ -582,7 +581,7 @@ usually suffice.")
582(defconst tramp-echoed-echo-mark-regexp 581(defconst tramp-echoed-echo-mark-regexp
583 (rx-to-string 582 (rx-to-string
584 `(: ,tramp-echo-mark-marker 583 `(: ,tramp-echo-mark-marker
585 (= ,tramp-echo-mark-marker-length (group "\b" (? " \b"))))) 584 (= ,tramp-echo-mark-marker-length "\b" (? " \b"))))
586 "Regexp which matches `tramp-echo-mark' as it gets echoed by \ 585 "Regexp which matches `tramp-echo-mark' as it gets echoed by \
587the remote shell.") 586the remote shell.")
588 587
@@ -599,7 +598,7 @@ if you need to change this."
599 :type 'string) 598 :type 'string)
600 599
601(defcustom tramp-login-prompt-regexp 600(defcustom tramp-login-prompt-regexp
602 (rx (* nonl) (group (| "user" "login")) (? (group " " (* nonl))) ":" (* " ")) 601 (rx (* nonl) (| "user" "login") (? space (* nonl)) ":" (* space))
603 "Regexp matching login-like prompts. 602 "Regexp matching login-like prompts.
604The regexp should match at end of buffer. 603The regexp should match at end of buffer.
605 604
@@ -692,9 +691,8 @@ files conditionalize this setup based on the TERM environment variable."
692 :type 'string) 691 :type 'string)
693 692
694(defcustom tramp-terminal-prompt-regexp 693(defcustom tramp-terminal-prompt-regexp
695 (rx (group 694 (rx (| (: "TERM = (" (* nonl) ")")
696 (| (: "TERM = (" (* nonl) ")") 695 (: "Terminal type? [" (* nonl) "]"))
697 (: "Terminal type? [" (* nonl) "]")))
698 (* space)) 696 (* space))
699 "Regular expression matching all terminal setting prompts. 697 "Regular expression matching all terminal setting prompts.
700The regexp should match at end of buffer. 698The regexp should match at end of buffer.
@@ -706,7 +704,7 @@ The answer will be provided by `tramp-action-terminal', which see."
706;; "-no-antispoof". However, since we don't know which PuTTY 704;; "-no-antispoof". However, since we don't know which PuTTY
707;; version is installed, we must react interactively. 705;; version is installed, we must react interactively.
708(defcustom tramp-antispoof-regexp 706(defcustom tramp-antispoof-regexp
709 (rx (literal "Access granted. Press Return to begin session. ")) 707 (rx "Access granted. Press Return to begin session. ")
710 "Regular expression matching plink's anti-spoofing message. 708 "Regular expression matching plink's anti-spoofing message.
711The regexp should match at end of buffer." 709The regexp should match at end of buffer."
712 :version "27.1" 710 :version "27.1"
@@ -1177,7 +1175,7 @@ The `ftp' syntax does not support methods.")
1177 "Return `tramp-completion-file-name-regexp' according to `tramp-syntax'." 1175 "Return `tramp-completion-file-name-regexp' according to `tramp-syntax'."
1178 (if (eq tramp-syntax 'separate) 1176 (if (eq tramp-syntax 'separate)
1179 ;; FIXME: This shouldn't be necessary. 1177 ;; FIXME: This shouldn't be necessary.
1180 (rx bos "/" (? (group "[" (* (not (any "]"))))) eos) 1178 (rx bos "/" (? "[" (* (not (any "]")))) eos)
1181 (rx bos 1179 (rx bos
1182 ;; `file-name-completion' uses absolute paths for matching. 1180 ;; `file-name-completion' uses absolute paths for matching.
1183 ;; This means that on W32 systems, something like 1181 ;; This means that on W32 systems, something like
@@ -1942,11 +1940,11 @@ of `current-buffer'."
1942 1940
1943(defconst tramp-debug-outline-regexp 1941(defconst tramp-debug-outline-regexp
1944 (rx ;; Timestamp. 1942 (rx ;; Timestamp.
1945 (+ digit) ":" (+ digit) ":" (+ digit) "." (+ digit) " " 1943 (+ digit) ":" (+ digit) ":" (+ digit) "." (+ digit) space
1946 ;; Thread. 1944 ;; Thread.
1947 (? (group "#<thread " (+ nonl) ">") " ") 1945 (? (group "#<thread " (+ nonl) ">") space)
1948 ;; Function name, verbosity. 1946 ;; Function name, verbosity.
1949 (+ (any "-" alnum)) " (" (group (group (+ digit))) ") #") 1947 (+ (any "-" alnum)) " (" (group (+ digit)) ") #")
1950 "Used for highlighting Tramp debug buffers in `outline-mode'.") 1948 "Used for highlighting Tramp debug buffers in `outline-mode'.")
1951 1949
1952(defconst tramp-debug-font-lock-keywords 1950(defconst tramp-debug-font-lock-keywords
@@ -2804,7 +2802,7 @@ remote file names."
2804 #'file-name-sans-extension 2802 #'file-name-sans-extension
2805 (directory-files 2803 (directory-files
2806 dir nil (rx bos "tramp" (+ nonl) ".el" (? "c") eos))))) 2804 dir nil (rx bos "tramp" (+ nonl) ".el" (? "c") eos)))))
2807 (files-regexp (rx bol (: (regexp (regexp-opt files))) eol))) 2805 (files-regexp (rx bol (regexp (regexp-opt files)) eol)))
2808 (mapatoms 2806 (mapatoms
2809 (lambda (atom) 2807 (lambda (atom)
2810 (when (and (functionp atom) 2808 (when (and (functionp atom)
@@ -3038,58 +3036,58 @@ not in completion mode."
3038(defun tramp-completion-dissect-file-name (name) 3036(defun tramp-completion-dissect-file-name (name)
3039 "Return a list of `tramp-file-name' structures for NAME. 3037 "Return a list of `tramp-file-name' structures for NAME.
3040They are collected by `tramp-completion-dissect-file-name1'." 3038They are collected by `tramp-completion-dissect-file-name1'."
3041 (let* (;; "/method" "/[method" 3039 (let (;; "/method" "/[method"
3042 (tramp-completion-file-name-structure1 3040 (tramp-completion-file-name-structure1
3043 (list 3041 (list
3044 (rx (regexp tramp-prefix-regexp) 3042 (rx (regexp tramp-prefix-regexp)
3045 (group (? (regexp tramp-completion-method-regexp))) eol) 3043 (group (? (regexp tramp-completion-method-regexp))) eol)
3046 1 nil nil nil)) 3044 1 nil nil nil))
3047 ;; "/method:user" "/[method/user" 3045 ;; "/method:user" "/[method/user"
3048 (tramp-completion-file-name-structure2 3046 (tramp-completion-file-name-structure2
3049 (list 3047 (list
3050 (rx (regexp tramp-prefix-regexp) 3048 (rx (regexp tramp-prefix-regexp)
3051 (group (regexp tramp-method-regexp)) 3049 (group (regexp tramp-method-regexp))
3052 (regexp tramp-postfix-method-regexp) 3050 (regexp tramp-postfix-method-regexp)
3053 (group (? (regexp tramp-user-regexp))) eol) 3051 (group (? (regexp tramp-user-regexp))) eol)
3054 1 2 nil nil)) 3052 1 2 nil nil))
3055 ;; "/method:host" "/[method/host" 3053 ;; "/method:host" "/[method/host"
3056 (tramp-completion-file-name-structure3 3054 (tramp-completion-file-name-structure3
3057 (list 3055 (list
3058 (rx (regexp tramp-prefix-regexp) 3056 (rx (regexp tramp-prefix-regexp)
3059 (group (regexp tramp-method-regexp)) 3057 (group (regexp tramp-method-regexp))
3060 (regexp tramp-postfix-method-regexp) 3058 (regexp tramp-postfix-method-regexp)
3061 (group (? (regexp tramp-host-regexp))) eol) 3059 (group (? (regexp tramp-host-regexp))) eol)
3062 1 nil 2 nil)) 3060 1 nil 2 nil))
3063 ;; "/method:[ipv6" "/[method/ipv6" 3061 ;; "/method:[ipv6" "/[method/ipv6"
3064 (tramp-completion-file-name-structure4 3062 (tramp-completion-file-name-structure4
3065 (list 3063 (list
3066 (rx (regexp tramp-prefix-regexp) 3064 (rx (regexp tramp-prefix-regexp)
3067 (group (regexp tramp-method-regexp)) 3065 (group (regexp tramp-method-regexp))
3068 (regexp tramp-postfix-method-regexp) 3066 (regexp tramp-postfix-method-regexp)
3069 (regexp tramp-prefix-ipv6-regexp) 3067 (regexp tramp-prefix-ipv6-regexp)
3070 (group (? (regexp tramp-ipv6-regexp))) eol) 3068 (group (? (regexp tramp-ipv6-regexp))) eol)
3071 1 nil 2 nil)) 3069 1 nil 2 nil))
3072 ;; "/method:user@host" "/[method/user@host" 3070 ;; "/method:user@host" "/[method/user@host"
3073 (tramp-completion-file-name-structure5 3071 (tramp-completion-file-name-structure5
3074 (list 3072 (list
3075 (rx (regexp tramp-prefix-regexp) 3073 (rx (regexp tramp-prefix-regexp)
3076 (group (regexp tramp-method-regexp)) 3074 (group (regexp tramp-method-regexp))
3077 (regexp tramp-postfix-method-regexp) 3075 (regexp tramp-postfix-method-regexp)
3078 (group (regexp tramp-user-regexp)) 3076 (group (regexp tramp-user-regexp))
3079 (regexp tramp-postfix-user-regexp) 3077 (regexp tramp-postfix-user-regexp)
3080 (group (? (regexp tramp-host-regexp))) eol) 3078 (group (? (regexp tramp-host-regexp))) eol)
3081 1 2 3 nil)) 3079 1 2 3 nil))
3082 ;; "/method:user@[ipv6" "/[method/user@ipv6" 3080 ;; "/method:user@[ipv6" "/[method/user@ipv6"
3083 (tramp-completion-file-name-structure6 3081 (tramp-completion-file-name-structure6
3084 (list 3082 (list
3085 (rx (regexp tramp-prefix-regexp) 3083 (rx (regexp tramp-prefix-regexp)
3086 (group (regexp tramp-method-regexp)) 3084 (group (regexp tramp-method-regexp))
3087 (regexp tramp-postfix-method-regexp) 3085 (regexp tramp-postfix-method-regexp)
3088 (group (regexp tramp-user-regexp)) 3086 (group (regexp tramp-user-regexp))
3089 (regexp tramp-postfix-user-regexp) 3087 (regexp tramp-postfix-user-regexp)
3090 (regexp tramp-prefix-ipv6-regexp) 3088 (regexp tramp-prefix-ipv6-regexp)
3091 (group (? (regexp tramp-ipv6-regexp))) eol) 3089 (group (? (regexp tramp-ipv6-regexp))) eol)
3092 1 2 3 nil))) 3090 1 2 3 nil)))
3093 (delq 3091 (delq
3094 nil 3092 nil
3095 (mapcar 3093 (mapcar
@@ -3356,14 +3354,14 @@ User is always nil."
3356 registry-or-dirname (rx bol (group (regexp tramp-host-regexp)) eol)))) 3354 registry-or-dirname (rx bol (group (regexp tramp-host-regexp)) eol))))
3357 3355
3358(defun tramp-parse-putty-group (registry) 3356(defun tramp-parse-putty-group (registry)
3359 "Return a (user host) tuple allowed to access. 3357 "Return a (user host) tuple allowed to access.
3360User is always nil." 3358User is always nil."
3361 (let (result 3359 (let (result
3362 (regexp (rx (literal registry) "\\" (group (+ nonl))))) 3360 (regexp (rx (literal registry) "\\" (group (+ nonl)))))
3363 (when (re-search-forward regexp (line-end-position) t) 3361 (when (re-search-forward regexp (line-end-position) t)
3364 (setq result (list nil (match-string 1)))) 3362 (setq result (list nil (match-string 1))))
3365 (forward-line 1) 3363 (forward-line 1)
3366 result)) 3364 result))
3367 3365
3368;;; Skeleton macros for file name handler functions. 3366;;; Skeleton macros for file name handler functions.
3369 3367
@@ -4104,10 +4102,9 @@ Let-bind it when necessary.")
4104 (not (with-tramp-connection-property 4102 (not (with-tramp-connection-property
4105 (tramp-get-process v) "unsafe-temporary-file" 4103 (tramp-get-process v) "unsafe-temporary-file"
4106 (yes-or-no-p 4104 (yes-or-no-p
4107 (eval-when-compile 4105 (concat
4108 (concat 4106 "Backup file on local temporary directory, "
4109 "Backup file on local temporary directory, " 4107 "do you want to continue?")))))
4110 "do you want to continue?"))))))
4111 (tramp-error v 'file-error "Unsafe backup file name")))))) 4108 (tramp-error v 'file-error "Unsafe backup file name"))))))
4112 4109
4113(defun tramp-handle-insert-directory 4110(defun tramp-handle-insert-directory
@@ -4439,7 +4436,7 @@ Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.")
4439 (rx bos (group (+ nonl)) 4436 (rx bos (group (+ nonl))
4440 "@" (group (+ nonl)) 4437 "@" (group (+ nonl))
4441 "." (group (+ digit)) 4438 "." (group (+ digit))
4442 (? ":" (group (+ digit))) eos) 4439 (? ":" (+ digit)) eos)
4443 "The format of a lock file.") 4440 "The format of a lock file.")
4444 4441
4445(defun tramp-handle-file-locked-p (file) 4442(defun tramp-handle-file-locked-p (file)
@@ -4494,10 +4491,9 @@ Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.")
4494 (not (with-tramp-connection-property 4491 (not (with-tramp-connection-property
4495 (tramp-get-process v) "unsafe-temporary-file" 4492 (tramp-get-process v) "unsafe-temporary-file"
4496 (yes-or-no-p 4493 (yes-or-no-p
4497 (eval-when-compile 4494 (concat
4498 (concat 4495 "Lock file on local temporary directory, "
4499 "Lock file on local temporary directory, " 4496 "do you want to continue?")))))
4500 "do you want to continue?"))))))
4501 (tramp-error v 'file-error "Unsafe lock file name"))) 4497 (tramp-error v 'file-error "Unsafe lock file name")))
4502 4498
4503 ;; Do the lock. 4499 ;; Do the lock.
@@ -6112,10 +6108,9 @@ this file, if that variable is non-nil."
6112 (not (with-tramp-connection-property 6108 (not (with-tramp-connection-property
6113 (tramp-get-process v) "unsafe-temporary-file" 6109 (tramp-get-process v) "unsafe-temporary-file"
6114 (yes-or-no-p 6110 (yes-or-no-p
6115 (eval-when-compile 6111 (concat
6116 (concat 6112 "Autosave file on local temporary directory, "
6117 "Autosave file on local temporary directory, " 6113 "do you want to continue?")))))
6118 "do you want to continue?"))))))
6119 (tramp-error v 'file-error "Unsafe autosave file name")))))) 6114 (tramp-error v 'file-error "Unsafe autosave file name"))))))
6120 6115
6121(defun tramp-subst-strs-in-string (alist string) 6116(defun tramp-subst-strs-in-string (alist string)
@@ -6389,15 +6384,13 @@ would use a wrong quoting for local file names. See `w32-shell-name'."
6389Only works for Bourne-like shells." 6384Only works for Bourne-like shells."
6390 (let ((system-type 'not-windows)) 6385 (let ((system-type 'not-windows))
6391 (save-match-data 6386 (save-match-data
6392 (let ((result (tramp-unquote-shell-quote-argument s)) 6387 (let ((result (tramp-unquote-shell-quote-argument s)))
6393 (nl (regexp-quote (format "\\%s" tramp-rsh-end-of-line))))
6394 (when (and (>= (length result) 2) 6388 (when (and (>= (length result) 2)
6395 (string= (substring result 0 2) "\\~")) 6389 (string= (substring result 0 2) "\\~"))
6396 (setq result (substring result 1))) 6390 (setq result (substring result 1)))
6397 (while (string-match nl result) 6391 (replace-regexp-in-string
6398 (setq result (replace-match (format "'%s'" tramp-rsh-end-of-line) 6392 (rx "\\" (literal tramp-rsh-end-of-line))
6399 t t result))) 6393 (format "'%s'" tramp-rsh-end-of-line) result)))))
6400 result))))
6401 6394
6402;;; Signal handling. This works for remote processes, which have set 6395;;; Signal handling. This works for remote processes, which have set
6403;;; the process property `remote-pid'. 6396;;; the process property `remote-pid'.
diff --git a/test/lisp/net/tramp-archive-tests.el b/test/lisp/net/tramp-archive-tests.el
index 964404b4bf7..aa5d1cc496c 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -622,7 +622,7 @@ This checks also `file-name-as-directory', `file-name-directory',
622 (goto-char (point-min)) 622 (goto-char (point-min))
623 (should 623 (should
624 (looking-at-p 624 (looking-at-p
625 (rx bol (+ nonl) " " (literal tramp-archive-test-archive) eol)))) 625 (rx bol (+ nonl) space (literal tramp-archive-test-archive) eol))))
626 (with-temp-buffer 626 (with-temp-buffer
627 (insert-directory 627 (insert-directory
628 (file-name-as-directory tramp-archive-test-archive) 628 (file-name-as-directory tramp-archive-test-archive)
@@ -633,14 +633,14 @@ This checks also `file-name-as-directory', `file-name-directory',
633 (rx-to-string 633 (rx-to-string
634 `(: 634 `(:
635 ;; There might be a summary line. 635 ;; There might be a summary line.
636 (? "total" (+ nonl) (+ digit) (? " ") 636 (? "total" (+ nonl) (+ digit) (? space)
637 (? (any "EGKMPTYZk")) (? "i") (? "B") "\n") 637 (? (any "EGKMPTYZk")) (? "i") (? "B") "\n")
638 ;; We don't know in which order the files appear. 638 ;; We don't know in which order the files appear.
639 (= ,(length (directory-files tramp-archive-test-archive)) 639 (= ,(length (directory-files tramp-archive-test-archive))
640 (+ nonl) " " 640 (+ nonl) space
641 (regexp 641 (regexp
642 ,(regexp-opt (directory-files tramp-archive-test-archive))) 642 ,(regexp-opt (directory-files tramp-archive-test-archive)))
643 (? " ->" (one-or-more nonl)) "\n")))))) 643 (? " ->" (+ nonl)) "\n"))))))
644 ;; Check error case. 644 ;; Check error case.
645 (with-temp-buffer 645 (with-temp-buffer
646 (should-error 646 (should-error
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index bc67ff2ace7..fed1d881c57 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -3222,13 +3222,13 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
3222 (insert-directory tmp-name1 "-al") 3222 (insert-directory tmp-name1 "-al")
3223 (goto-char (point-min)) 3223 (goto-char (point-min))
3224 (should 3224 (should
3225 (looking-at-p (rx bol (+ nonl) " " (literal tmp-name1) eol)))) 3225 (looking-at-p (rx bol (+ nonl) space (literal tmp-name1) eol))))
3226 (with-temp-buffer 3226 (with-temp-buffer
3227 (insert-directory (file-name-as-directory tmp-name1) "-al") 3227 (insert-directory (file-name-as-directory tmp-name1) "-al")
3228 (goto-char (point-min)) 3228 (goto-char (point-min))
3229 (should 3229 (should
3230 (looking-at-p 3230 (looking-at-p
3231 (rx bol (+ nonl) " " (literal tmp-name1) "/" eol)))) 3231 (rx bol (+ nonl) space (literal tmp-name1) "/" eol))))
3232 (with-temp-buffer 3232 (with-temp-buffer
3233 (insert-directory 3233 (insert-directory
3234 (file-name-as-directory tmp-name1) "-al" nil 'full-directory-p) 3234 (file-name-as-directory tmp-name1) "-al" nil 'full-directory-p)
@@ -3238,11 +3238,11 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
3238 (rx-to-string 3238 (rx-to-string
3239 `(: 3239 `(:
3240 ;; There might be a summary line. 3240 ;; There might be a summary line.
3241 (? "total" (+ nonl) (+ digit) (? " ") 3241 (? "total" (+ nonl) (+ digit) (? space)
3242 (? (any "EGKMPTYZk")) (? "i") (? "B") "\n") 3242 (? (any "EGKMPTYZk")) (? "i") (? "B") "\n")
3243 ;; We don't know in which order ".", ".." and "foo" appear. 3243 ;; We don't know in which order ".", ".." and "foo" appear.
3244 (= ,(length (directory-files tmp-name1)) 3244 (= ,(length (directory-files tmp-name1))
3245 (+ nonl) " " 3245 (+ nonl) space
3246 (regexp ,(regexp-opt (directory-files tmp-name1))) 3246 (regexp ,(regexp-opt (directory-files tmp-name1)))
3247 (? " ->" (+ nonl)) "\n")))))) 3247 (? " ->" (+ nonl)) "\n"))))))
3248 3248
@@ -6703,7 +6703,7 @@ Additionally, ls does not support \"--dired\"."
6703 "Check, whether the method needs a share." 6703 "Check, whether the method needs a share."
6704 (and (tramp--test-gvfs-p) 6704 (and (tramp--test-gvfs-p)
6705 (string-match-p 6705 (string-match-p
6706 (rx bol (or "afp" (: "dav" (opt "s")) "smb") eol) 6706 (rx bol (| "afp" (: "dav" (? "s")) "smb") eol)
6707 (file-remote-p ert-remote-temporary-file-directory 'method)))) 6707 (file-remote-p ert-remote-temporary-file-directory 'method))))
6708 6708
6709(defun tramp--test-sshfs-p () 6709(defun tramp--test-sshfs-p ()