From 7cf5b3748cb1c8df5a0189bf6b5e95b550c16668 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 17 Mar 2015 20:07:38 +0100 Subject: [PATCH] Avoid leading tabs in shell scripts, sent by Tramp. Fixes: debbugs:20118 * tramp-sh.el (tramp-maybe-send-script): Avoid leading tabs in shell scripts. --- lisp/ChangeLog | 5 +++++ lisp/net/tramp-sh.el | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b734aaa39e..cf4eeae228 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2015-03-17 Michael Albinus + + * tramp-sh.el (tramp-maybe-send-script): Avoid leading tabs in + shell scripts. (Bug#20118) + 2015-03-17 Eli Zaretskii * mouse.el (mouse-appearance-menu): If w32-use-w32-font-dialog is diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index b6c47bcb7b..133d886f37 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -3725,6 +3725,10 @@ Only send the definition if it has not already been done." (tramp-get-connection-process vec) "scripts" nil))) (unless (member name scripts) (with-tramp-progress-reporter vec 5 (format "Sending script `%s'" name) + ;; In bash, leading TABs like in `tramp-vc-registered-read-file-names' + ;; could result in unwanted command expansion. Avoid this. + (setq script (tramp-compat-replace-regexp-in-string + (make-string 1 ?\t) (make-string 8 ? ) script)) ;; The script could contain a call of Perl. This is masked with `%s'. (when (and (string-match "%s" script) (not (tramp-get-remote-perl vec))) -- 2.39.2