From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.help Subject: Re: tramp and adb, strange escape codes in dired Date: Thu, 11 Jun 2020 19:55:51 +0200 Message-ID: <87pna5ebbs.fsf@gmx.de> References: <87eeql7lll.fsf@roquette.i-did-not-set--mail-host-address--so-tickle-me> <20200611152844.GA13455@tuxteam.de> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="11253"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Giovanni Biscuolo Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 11 19:58:45 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jjRTR-0002pw-7j for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 11 Jun 2020 19:58:45 +0200 Original-Received: from localhost ([::1]:34342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjRTQ-0007tG-3w for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 11 Jun 2020 13:58:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjRQq-0007rT-Hk for help-gnu-emacs@gnu.org; Thu, 11 Jun 2020 13:56:04 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:39749) by eggs.gnu.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjRQi-0001ex-Bt for help-gnu-emacs@gnu.org; Thu, 11 Jun 2020 13:56:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1591898153; bh=CaggyBEPUB7oSwwgxvpNR3rfcXXMcCvY22SjSifymN8=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=gIXOj0Vv+3uAfIOrCqx78ml7rr8eXyseBy2WymXlSKF6CewGH8H861ErIAsjr8GEr Chs0mH9H2rZmcrMbS/FD6zhAMsSDzZnpoBDRcTmfMY2HmPgey+iLTkLDMkT2pKS0t6 xzbikx8Xmg5bJmW3BzO/a5Zr4nmoTdJWSjEix7+k= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([212.86.43.30]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M4s0t-1jkH2k2Jqp-0021CP; Thu, 11 Jun 2020 19:55:53 +0200 In-Reply-To: <20200611152844.GA13455@tuxteam.de> (tomas@tuxteam.de's message of "Thu, 11 Jun 2020 17:28:44 +0200") X-Provags-ID: V03:K1:Kk6mHArVF4KD95ITvwdqk5jHjrr0f5InzWCJaj2C2J7IhUKNGJr gC/im+nwjlbk1V1sBuhC7wSz4FbAmh2xiBadL9zWn4IYmQWmq/Smgwvv+TOyaSBGSCLj0K9 pQ8eMN5ej9yJT0Cry9IP2QfmemjvZGqqbA9BVF9+rWT8xwxMESWQCPec/s8ILF/KGYk/xve 6Bhi8kFgCABaqDBC48TzA== X-UI-Out-Filterresults: notjunk:1;V03:K0:Q2a2eRZe0AI=:auM44qfl42NV7vpdVujFBZ wysrRjBqzxxhA7PTa9vbTRTSxgo6ALJaqlCsWe9ZHlqTrUsdYJkfBiz02AD63op9P2CAK7f0h rO/3TxWIC1YRqG4duBa7FYfcuxHhntHtIyJCB9O2nSy6RwfrhYGYo4qEamuewHF0wRE+2kHGH XSuZT8P3RuUr7ojq/1urcB0Gc3zsftVDZfB4cGhCSwiL26ynv/RcT47qVSAihCK/vtb9BvgHr 8BlagUfnl6x2ciGjdko+l/PlUWhIRIpJw5kGzVpKG6MEZLohEoNggh3HJ6PQE/d7UJ5md2vig k0bioTVkCCgsoJjzAPZuiaEC8e6GtrnKuU8XAm1RAWTy5NVrroTF2J72xLN1HtDi7RNLOz+xL GO/WDfi0NAPGIX2jrqS/sALpaBkGotn3tl//SjnNZaVzDnCTYqajYzsRJWc4n3cdeEMeXPODz DTsuNxtD3/gnj1bZ7H86Q8DgFUvFYf8b8VQTF02QVIqp1ywUBmXG0L3OiW2KcjnQrHYTQroV2 sgIbs3gSsx/s5C7wli5M0VMrCKQrbezeOXNvpEP6R/qO5eK55Fdg04/kihcR4JGeTvBBOOVXB sg5gPGscDr8FiegCUk/xQua/3pkJPAlH3/IXr7JL9aVbeo2WV5Lzb7XTQhgVstLS1lAt7NrBb pWbyxbKApW5rKPudBEV4DwYSF2fD1++UY7nw8qvPLK9d90TWmFUc1hK68rENaOA+ABDJvoL2s IZhKhtZ3oBf0HoF0jlIY5ivPqMEwqd2o17I/sc4Dg69SvAmAdeBUz8ZRophh8tIu5PLk7Iow Received-SPF: pass client-ip=212.227.17.22; envelope-from=michael.albinus@gmx.de; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/11 13:55:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:123327 Archived-At: writes: Hi, > On Thu, Jun 11, 2020 at 03:55:50PM +0200, Giovanni Biscuolo wrote: >> Hello, >> >> I'm using Emacs 26.3 and adb 7.1.2_r36 [1], both installed via Guix on = a >> foreign distro (Debian 10) >> >> I'm trying to use adb via tramp (I'd love to be able to browse my phone >> filesystem in Emacs) for the first time and I get a strange dired >> buffer: >> >> --8<---------------cut here---------------start------------->8--- >> >> /adb::/storage: >> total 13 >> drwxr-xr-x 1 root root 80 05-31 13:04 [1;34m.[0m >> drwxr-xr-x 1 root root 4k 2009-01-01 [1;34m..[0m >> drwx--x--x 1 root sdcard_rw 4k 05-31 13:04 [1;34memulated[0m > > [...] > > FWIW, this looks a lot like escape sequences setting the display to > bold (ESC[1;34m) before and resetting it (ESC[0m) after the file > name. > > I don't really know what there is at the other end, but convincing > it that you have a very dumb terminal might help. Tramp tries to find a proper `ls' command which suppresses escape sequences. The following defun does it: =2D-8<---------------cut here---------------start------------->8--- (defun tramp-adb-get-ls-command (vec) "Determine `ls' command and its arguments." (with-tramp-connection-property vec "ls" (tramp-message vec 5 "Finding a suitable `ls' command") (cond ;; Support Android derived systems where "ls" command is provided ;; by GNU Coreutils. Force "ls" to print one column and set ;; time-style to imitate other "ls" flavors. ((tramp-adb-send-command-and-check vec "ls --time-style=3Dlong-iso /dev/null") "ls -1 --time-style=3Dlong-iso") ;; Can't disable coloring explicitly for toybox ls command. We ;; also must force "ls" to print just one column. ((tramp-adb-send-command-and-check vec "toybox") "ls -1") ;; On CyanogenMod based system BusyBox is used and "ls" output ;; coloring is enabled by default. So we try to disable it when ;; possible. ((tramp-adb-send-command-and-check vec "ls --color=3Dnever -al /dev/n= ull") "ls --color=3Dnever") (t "ls")))) =2D-8<---------------cut here---------------end--------------->8--- Obviously, in this case we need more. Giovanni, which Android version are you running? And can you check via "adb shell", which kind of ls is installed there? (Personally, I run a Galaxy S6 with Android 7. I fear it is much too old for local tests.) > Cheers > -- t Best regards, Michael.