From: Mathieu Othacehe <m.othacehe@gmail.com>
To: 30595@debbugs.gnu.org
Cc: Mathieu Othacehe <m.othacehe@gmail.com>
Subject: bug#30595: [PATCH] Handle command line wrapping in Tramp adb.
Date: Sat, 24 Feb 2018 19:07:09 +0100 [thread overview]
Message-ID: <20180224180709.29641-1-m.othacehe@gmail.com> (raw)
The command sent to an adb shell input might be wrapped around
terminal column count by the kernel. Remove CR and LF introduced when
it happends.
* lisp/net/tramp-adb.el (tramp-adb-send-command): Remove W32 trailing
CR but also CR/LF introduced by command line wrapping.
---
lisp/net/tramp-adb.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index be269aca51..532569414b 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1178,14 +1178,17 @@ tramp-adb-send-command
(with-current-buffer (tramp-get-connection-buffer vec)
(save-excursion
(goto-char (point-min))
- ;; We can't use stty to disable echo of command.
- (delete-matching-lines (regexp-quote command))
;; When the local machine is W32, there are still trailing ^M.
;; There must be a better solution by setting the correct coding
;; system, but this requires changes in core Tramp.
+ ;;
+ ;; Also remove CR and LF introduced by kernel when input command
+ ;; is longer than terminal column count.
+ (while (re-search-forward "\r+\n*" nil t)
+ (replace-match "" nil nil))
(goto-char (point-min))
- (while (re-search-forward "\r+$" nil t)
- (replace-match "" nil nil)))))
+ ;; We can't use stty to disable echo of command.
+ (delete-matching-lines (regexp-quote command)))))
(defun tramp-adb-send-command-and-check (vec command)
"Run COMMAND and check its exit status.
--
2.16.1
next reply other threads:[~2018-02-24 18:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-24 18:07 Mathieu Othacehe [this message]
2018-02-26 15:59 ` bug#30595: [PATCH] Handle command line wrapping in Tramp adb Michael Albinus
2018-02-27 17:13 ` Mathieu Othacehe
2018-05-14 11:09 ` Michael Albinus
2018-06-05 11:09 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180224180709.29641-1-m.othacehe@gmail.com \
--to=m.othacehe@gmail.com \
--cc=30595@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).