From 9a83b32b7bd5663bd74f8bc04d5c3f61deb2c78d Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 5 Feb 2014 15:11:50 +0100 Subject: [PATCH] Make heredocs more robust in Tramp. * net/tramp-sh.el (tramp-end-of-heredoc): New defconst. (tramp-sh-handle-set-file-acl) (tramp-sh-handle-start-file-process) (tramp-sh-handle-write-region, tramp-sh-handle-vc-registered) (tramp-find-executable, tramp-send-command): Use it. --- lisp/ChangeLog | 10 +++++++++- lisp/net/tramp-sh.el | 38 ++++++++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a74ffeda68b..5ce9ab4913c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,14 @@ +2014-02-05 Michael Albinus + + * net/tramp-sh.el (tramp-end-of-heredoc): New defconst. + (tramp-sh-handle-set-file-acl) + (tramp-sh-handle-start-file-process) + (tramp-sh-handle-write-region, tramp-sh-handle-vc-registered) + (tramp-find-executable, tramp-send-command): Use it. + 2014-02-05 Glenn Morris - * epa.el (epa-mail-aliases): Fic custom type. Doc tweak. + * epa.el (epa-mail-aliases): Fix custom type. Doc tweak. 2014-02-04 Fabián Ezequiel Gallina diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 65d5f27e967..67a517a719c 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -79,6 +79,9 @@ detected as prompt when being sent on echoing hosts, therefore.") (defconst tramp-initial-end-of-output "#$ " "Prompt when establishing a connection.") +(defconst tramp-end-of-heredoc (md5 tramp-end-of-output) + "String used to recognize end of heredoc strings.") + ;; Initialize `tramp-methods' with the supported methods. ;;;###tramp-autoload (add-to-list 'tramp-methods @@ -1443,8 +1446,11 @@ be non-negative integers." (if (and (stringp acl-string) (tramp-remote-acl-p v) (progn (tramp-send-command - v (format "setfacl --set-file=- %s <<'EOF'\n%s\nEOF\n" - (tramp-shell-quote-argument localname) acl-string)) + v (format "setfacl --set-file=- %s <<'%s'\n%s\n%s\n" + (tramp-shell-quote-argument localname) + tramp-end-of-heredoc + acl-string + tramp-end-of-heredoc)) (tramp-send-command-and-check v nil))) ;; Success. (progn @@ -2707,14 +2713,15 @@ the result will be a local, non-Tramp, filename." (when (stringp program) (format "cd %s; exec %s env PS1=%s %s" (tramp-shell-quote-argument localname) - (if heredoc "<