diff options
| author | Michael Albinus | 2024-07-26 22:10:36 +0200 |
|---|---|---|
| committer | Michael Albinus | 2024-07-26 22:10:36 +0200 |
| commit | d7665595f7bfca86b65e75fa624b0fc7a63fbb41 (patch) | |
| tree | c307dfb2c6cceeeef6952a5840a68d62c4364c90 | |
| parent | 4e250154ec4dc73eb9a2ec2c00d7a6e9a98b5476 (diff) | |
| download | emacs-d7665595f7bfca86b65e75fa624b0fc7a63fbb41.tar.gz emacs-d7665595f7bfca86b65e75fa624b0fc7a63fbb41.zip | |
Tramp: Handle hops with "%" in their names
* lisp/net/tramp.el (tramp-dissect-file-name, tramp-compute-multi-hops):
Handle hops with "%" in their names, like USER%DOMAIN or POD%NAMESPACE.
| -rw-r--r-- | lisp/net/tramp.el | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 4151b811b42..3260cf5daac 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1770,17 +1770,23 @@ default values are used." | |||
| 1770 | (unless nodefault | 1770 | (unless nodefault |
| 1771 | (when hop | 1771 | (when hop |
| 1772 | (setq v (tramp-dissect-hop-name hop) | 1772 | (setq v (tramp-dissect-hop-name hop) |
| 1773 | hop (and hop (tramp-make-tramp-hop-name v)))) | 1773 | hop (tramp-make-tramp-hop-name v))) |
| 1774 | (let ((tramp-default-host | 1774 | (let ((tramp-default-host |
| 1775 | (or (and v (not (string-search "%h" (tramp-file-name-host v))) | 1775 | (or (and v (not (string-search "%h" (tramp-file-name-host v))) |
| 1776 | (tramp-file-name-host v)) | 1776 | (tramp-file-name-host v)) |
| 1777 | tramp-default-host))) | 1777 | tramp-default-host))) |
| 1778 | (setq method (tramp-find-method method user host) | 1778 | (setq method (tramp-find-method method user host) |
| 1779 | user (tramp-find-user method user host) | 1779 | user (tramp-find-user method user host) |
| 1780 | host (tramp-find-host method user host) | 1780 | host (tramp-find-host method user host)) |
| 1781 | hop | 1781 | (when hop |
| 1782 | (and hop | 1782 | ;; Replace placeholders. The hop could contain "%" |
| 1783 | (format-spec hop (format-spec-make ?h host ?u user)))))) | 1783 | ;; which is not intended as format character, for |
| 1784 | ;; example in USER%DOMAIN or POD%NAMESPACE. | ||
| 1785 | (setq hop | ||
| 1786 | (replace-regexp-in-string | ||
| 1787 | (rx "%" (group (= 2 alnum))) "%%\\1" hop) | ||
| 1788 | hop | ||
| 1789 | (format-spec hop (format-spec-make ?h host ?u user)))))) | ||
| 1784 | 1790 | ||
| 1785 | ;; Return result. | 1791 | ;; Return result. |
| 1786 | (prog1 | 1792 | (prog1 |
| @@ -4930,8 +4936,13 @@ Do not set it manually, it is used buffer-local in `tramp-get-lock-pid'.") | |||
| 4930 | (if (null proxy) | 4936 | (if (null proxy) |
| 4931 | ;; No more hops needed. | 4937 | ;; No more hops needed. |
| 4932 | (setq choices nil) | 4938 | (setq choices nil) |
| 4933 | ;; Replace placeholders. | 4939 | ;; Replace placeholders. The proxy could contain "%" which |
| 4940 | ;; is not intended as format character, for example in | ||
| 4941 | ;; USER%DOMAIN or POD%NAMESPACE. | ||
| 4934 | (setq proxy | 4942 | (setq proxy |
| 4943 | (replace-regexp-in-string | ||
| 4944 | (rx "%" (group (= 2 alnum))) "%%\\1" proxy) | ||
| 4945 | proxy | ||
| 4935 | (format-spec | 4946 | (format-spec |
| 4936 | proxy | 4947 | proxy |
| 4937 | (format-spec-make | 4948 | (format-spec-make |