From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mathieu Othacehe Newsgroups: gmane.emacs.bugs Subject: bug#30595: [PATCH] Handle command line wrapping in Tramp adb. Date: Sat, 24 Feb 2018 19:07:09 +0100 Message-ID: <20180224180709.29641-1-m.othacehe@gmail.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1519495572 8924 195.159.176.226 (24 Feb 2018 18:06:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 24 Feb 2018 18:06:12 +0000 (UTC) Cc: Mathieu Othacehe To: 30595@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 24 19:06:08 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1epeD2-0001qX-98 for geb-bug-gnu-emacs@m.gmane.org; Sat, 24 Feb 2018 19:06:08 +0100 Original-Received: from localhost ([::1]:51052 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epeF4-0004ng-NZ for geb-bug-gnu-emacs@m.gmane.org; Sat, 24 Feb 2018 13:08:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epeEv-0004m4-Mi for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2018 13:08:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1epeEt-0001y2-0y for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2018 13:08:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51061) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1epeEs-0001xf-TR for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2018 13:08:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1epeEs-0002GI-LI for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2018 13:08:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Feb 2018 18:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 30595 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15194956488632 (code B ref -1); Sat, 24 Feb 2018 18:08:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Feb 2018 18:07:28 +0000 Original-Received: from localhost ([127.0.0.1]:58956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1epeEJ-0002FA-P9 for submit@debbugs.gnu.org; Sat, 24 Feb 2018 13:07:27 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54138) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1epeEI-0002Ex-7D for submit@debbugs.gnu.org; Sat, 24 Feb 2018 13:07:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1epeEC-0001Ee-Bg for submit@debbugs.gnu.org; Sat, 24 Feb 2018 13:07:21 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:56738) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1epeEC-0001ET-8y for submit@debbugs.gnu.org; Sat, 24 Feb 2018 13:07:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epeEB-0004KD-5O for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2018 13:07:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1epeE7-0001BP-VO for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2018 13:07:19 -0500 Original-Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:39958) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1epeE7-0001Aq-PV for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2018 13:07:15 -0500 Original-Received: by mail-wm0-x241.google.com with SMTP id t6so1826237wmt.5 for ; Sat, 24 Feb 2018 10:07:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=otw+RDWuMbnrDONsN5+avaIR7LCB3gpZi/9XfUbmP1A=; b=GfjJ+6KkgvHTIifEXwDfJkSdb2BD9D1H8xXpkCUjcLsotnaRi8UpRsEYksZokVws3w tLvzdKNuc0MGGVSKyex5A0/5MW1/SdJjCR2aTjTjneXkl5htDWSU3E7aJcjMXX/xooJS BZcnPkrdPkHEdl/to/KxT2iW4B45/4t5/OGa9wu1JTljYZNlSqDO78zu4SOB1CX2mrIM XNr4ivUv/wIegzeHjrM9/GDMPsBrQ378XgxWYqCyW04DN9G//WHaz36z/i8wGsKzhegj CpS+O6DAeYYtQ09Ls6pLJkBMONAfdGlEawm9LqDM+CGryakcCQncwJW4YiWVmkNEQJrF NQWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=otw+RDWuMbnrDONsN5+avaIR7LCB3gpZi/9XfUbmP1A=; b=ONLeFV4MGRbD8TybrmjMN+xWYgbtg1/jeb9f7i+RBSxF6J2mb6D5oeofKX45ERu3oS JwiIkJu4181GTW/D2+xnawW6HZnCqsp8GruuyiHiQ//N8pAKC+52DBbZrHFwTbXEb5Gb lprcoMoKqF96l8Bw0FfDOFiBV5kKzsK2SGu3HRsSzb+EVcYBLj63H4zCxE+44+V/MaDl RKtTIT+jal7ajBvgpQ4KzG67n9K32lRarU43HygkNe1FjZ6AHrqwZH4B7IuRWf68IwIF qgS8HeTYqRbJCPT7Pseoe6O3DsbyeEHEJtIe3Rf7jytc0BvYeI15iujt6qfr5axdgcAA YlTQ== X-Gm-Message-State: APf1xPBk6pByQKXWIqIywXu2/BmOINvKg8VnjMIiZESnFbe4OAx2xjpw zCdMd5tnDkommWSKF4pcWd+4bw== X-Google-Smtp-Source: AG47ELvya9+yH1bAgm1Jw8i/J6axM752MTJqOza2gMm7ZcA5dAad7B0lV48eYEK4CnMKwdrulN7+Wg== X-Received: by 10.28.184.8 with SMTP id i8mr5098810wmf.52.1519495634570; Sat, 24 Feb 2018 10:07:14 -0800 (PST) Original-Received: from localhost.localdomain ([78.192.96.126]) by smtp.gmail.com with ESMTPSA id 53sm4932812wrv.95.2018.02.24.10.07.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Feb 2018 10:07:13 -0800 (PST) X-Mailer: git-send-email 2.16.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:143638 Archived-At: 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