]> code.delx.au - gnu-emacs/commitdiff
Avoid leading tabs in shell scripts, sent by Tramp.
authorMichael Albinus <michael.albinus@gmx.de>
Tue, 17 Mar 2015 19:07:38 +0000 (20:07 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Tue, 17 Mar 2015 19:07:38 +0000 (20:07 +0100)
Fixes: debbugs:20118
* tramp-sh.el (tramp-maybe-send-script): Avoid leading tabs in
shell scripts.

lisp/ChangeLog
lisp/net/tramp-sh.el

index b734aaa39e3918355c3aa084a7868442782e1355..cf4eeae2287872f731fe55974558287c7bb0407a 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-17  Michael Albinus  <michael.albinus@gmx.de>
+
+       * tramp-sh.el (tramp-maybe-send-script): Avoid leading tabs in
+       shell scripts.  (Bug#20118)
+
 2015-03-17  Eli Zaretskii  <eliz@gnu.org>
 
        * mouse.el (mouse-appearance-menu): If w32-use-w32-font-dialog is
index b6c47bcb7bb93f750343684b4b54f22fd3525c9f..133d886f3725cb9496b56323b1843b0b8aadb1e8 100644 (file)
@@ -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)))