summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2026-05-14 12:31:04 +0200
committerMichael Albinus <michael.albinus@gmx.de>2026-05-14 12:31:04 +0200
commitd0d657fa9027a1a4fa4ce151f65f3bcac1e2d535 (patch)
treeb15947ecc25ea2631f1387757b7596bf32e7b182
parent93ea0d7d289ad384a5d71aefe9e68551abcffd24 (diff)
; Minor Tramp cleanup
* lisp/net/tramp.el (tramp-unquote-shell-quote-argument): Do not expand remote file names w/o a localname. * test/lisp/net/tramp-tests.el (tramp--test-supports-environment-variables-p): New defun. (tramp-test33-environment-variables): Use it.
-rw-r--r--lisp/net/tramp.el3
-rw-r--r--test/lisp/net/tramp-tests.el8
2 files changed, 8 insertions, 3 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index ffcf8f4929c..fc897fb2a7c 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -7406,7 +7406,8 @@ T1 and T2 are time values (as returned by `current-time' for example)."
Suppress `shell-file-name'. This is needed on w32 systems, which
would use a wrong quoting for local file names. See `w32-shell-name'."
(let (shell-file-name)
- (shell-quote-argument (file-name-unquote s))))
+ ;; Do not expand remote file names w/o a localname.
+ (shell-quote-argument (file-name-unquote s 'top))))
;; Currently (as of Emacs 20.5), the function `shell-quote-argument'
;; does not deal well with newline characters. Newline is replaced by
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index d6eb782df3d..c0ad7205c5d 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -6524,8 +6524,7 @@ INPUT, if non-nil, is a string sent to the process."
"Check that remote processes set / unset environment variables properly."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
- (skip-unless (tramp--test-sh-p))
- (skip-unless (not (tramp--test-crypt-p)))
+ (skip-unless (tramp--test-supports-environment-variables-p))
(dolist (this-shell-command-to-string
(append
@@ -7797,6 +7796,11 @@ This requires restrictions of file name syntax."
(tramp--test-sh-p) (tramp--test-smb-p)
(tramp--test-sudoedit-p)))
+(defun tramp--test-supports-environment-variables-p ()
+ "Return whether setting environment variables is supported."
+ (and (tramp--test-sh-p)
+ (not (tramp--test-crypt-p))))
+
(defun tramp--test-check-files (&rest files)
"Run a simple but comprehensive test over every file in FILES."
(dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))