From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Giovanni Biscuolo Newsgroups: gmane.emacs.help Subject: Re: tramp and adb, strange escape codes in dired Date: Fri, 12 Jun 2020 11:28:01 +0200 Organization: Xelera.eu Message-ID: <87bllozl9a.fsf@roquette.i-did-not-set--mail-host-address--so-tickle-me> References: <87eeql7lll.fsf@roquette.i-did-not-set--mail-host-address--so-tickle-me> <20200611152844.GA13455@tuxteam.de> <87pna5ebbs.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="67600"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Michael Albinus Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 12 11:29:08 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 1jjfzo-000HYa-MY for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 12 Jun 2020 11:29:08 +0200 Original-Received: from localhost ([::1]:44334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjfzn-0007H1-Ri for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 12 Jun 2020 05:29:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjfzH-0007Fy-Bl for help-gnu-emacs@gnu.org; Fri, 12 Jun 2020 05:28:35 -0400 Original-Received: from ns13.heimat.it ([46.4.214.66]:44952) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjfzE-0004bn-V4 for help-gnu-emacs@gnu.org; Fri, 12 Jun 2020 05:28:34 -0400 Original-Received: from localhost (ip6-localhost [127.0.0.1]) by ns13.heimat.it (Postfix) with ESMTP id 1CF793021B8; Fri, 12 Jun 2020 09:28:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at ns13.heimat.it Original-Received: from ns13.heimat.it ([127.0.0.1]) by localhost (ns13.heimat.it [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oCQ1VNqh5VRf; Fri, 12 Jun 2020 09:28:10 +0000 (UTC) Original-Received: from bourrache.mug.xelera.it (unknown [93.56.169.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ns13.heimat.it (Postfix) with ESMTPSA id 748F83021B7; Fri, 12 Jun 2020 09:28:10 +0000 (UTC) Original-Received: from roquette.mug.biscuolo.net (roquette [10.38.2.14]) by bourrache.mug.xelera.it (Postfix) with SMTP id 99C5F3CED98; Fri, 12 Jun 2020 11:28:06 +0200 (CEST) Original-Received: (nullmailer pid 30083 invoked by uid 1000); Fri, 12 Jun 2020 09:28:02 -0000 In-Reply-To: <87pna5ebbs.fsf@gmx.de> Received-SPF: pass client-ip=46.4.214.66; envelope-from=g@xelera.eu; helo=ns13.heimat.it X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/12 05:28:30 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: 1 X-Spam_score: 0.1 X-Spam_bar: / X-Spam_report: (0.1 / 5.0 requ) BAYES_00=-1.9, LONGWORDS=2.035, 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:123356 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Michael, thank you for your help. Michael Albinus writes: [...] > Tramp tries to find a proper `ls' command which suppresses escape > sequences. Ha ha: now I'm staring to understand, thanks! Is it more appropriate if I file a bug report? I can copy all the relevant information from this thread to a proper bug report if this helps. > The following defun does it: [...] > Obviously, in this case we need more. Giovanni, which Android version > are you running? Android 10 via LineageOS 17 on a Samsung Galaxy S4 > And can you check via "adb shell", which kind of ls is installed > there? Toybox, more info below, included tramp debug infos. > (Personally, I run a Galaxy S6 with Android 7. I fear it is much too old > for local tests.) I'd be *very* happy to help testing, just tell me what I have to do. With my Android version tramp uses "ls --color=3Dnever" and unfortunately toybox output is coloured when the option "--color=3Dnever" is passed :-S In my adb shell, "ls -1" give me no colours. This is the ls command help in my toybox (in Emacs shell): =2D-8<---------------cut here---------------start------------->8--- jflte:/ # ls --help ls --help usage: ls [-ACFHLRSZacdfhiklmnpqrstux1] [--color[=3Dauto]] [directory...] List files. what to show: =2Da all files including .hidden -b escape nongraphic chars =2Dc use ctime for timestamps -d directory, not contents =2Di inode number -p put a '/' after dir names =2Dq unprintable chars as '?' -s storage used (1024 byte units) =2Du use access time for timestamps -A list all files but . and .. =2DH follow command line symlinks -L follow symlinks =2DR recursively list in subdirs -F append /dir *exe @sym |FIFO =2DZ security context output formats: =2D1 list one file per line -C columns (sorted vertically) =2Dg like -l but no owner -h human readable sizes =2Dl long (show full details) -m comma separated =2Dn like -l but numeric uid/gid -o like -l but no group =2Dx columns (horizontal sort) -ll long with nanoseconds (--full-time) =2D-color device=3Dyellow symlink=3Dturquoise/red dir=3Dblue socket=3Dp= urple files: exe=3Dgreen suid=3Dred suidfile=3Dredback stickydir=3Dgr= eenback =3Dauto means detect if output is a tty. sorting (default is alphabetical): =2Df unsorted -r reverse -t timestamp -S size =2D-8<---------------cut here---------------end--------------->8--- Test #1 (adb shell via Emacs shell): =2D-8<---------------cut here---------------start------------->8--- jflte:/ # ls --time-style=3Dlong-iso /dev/null ls --time-style=3Dlong-iso /dev/null ls: Unknown option time-style=3Dlong-iso (see "ls --help") =2D-8<---------------cut here---------------end--------------->8--- Test #2 (adb shell via Emacs shell): =2D-8<---------------cut here---------------start------------->8--- jflte:/ # toybox toybox acpi base64 basename bc blkid blockdev cal cat chattr chcon chgrp chmod chown chroot chrt cksum clear cmp comm cp cpio cut date dd devmem df diff dirname dmesg dos2unix du echo egrep env expand expr fallocate false fgrep file find flock fmt free freeramdisk fsfreeze fsync getconf getenforce getfattr grep groups gunzip gzip head help hostname hwclock i2cdetect i2cdump i2cget i2cset iconv id ifconfig inotifyd insmod install ionice iorenice iotop kill killall ln load_policy log logname losetup ls lsattr lsmod lsof lspci lsusb makedevs md5sum microcom mkdir mkfifo mknod mkswap mktemp modinfo modprobe more mount mountpoint mv nbd-client nc netcat netstat nice nl nohup nproc nsenter od partprobe paste patch pgrep pidof ping ping6 pivot_root pkill pmap printenv printf prlimit ps pwd pwdx readlink realpath renice restorecon rev rfkill rm rmdir rmmod runcon sed sendevent seq setenforce setfattr setprop setsid sha1sum sha224sum sha256sum sha384sum sha512sum sleep sort split start stat stop strings stty swapoff swapon sync sysctl tac tail tar taskset tee time timeout top touch tr traceroute traceroute6 true truncate tty tunctl ulimit umount uname uniq unix2dos unlink unshare uptime usleep uudecode uuencode uuidgen vconfig vmstat watch wc which whoami xargs xxd yes zcat=20 =2D-8<---------------cut here---------------end--------------->8--- Test #3 (adb shell via Emacs shell): =2D-8<---------------cut here---------------start------------->8--- jflte:/ # ls --color=3Dnever -al /dev/null ls --color=3Dnever -al /dev/null crw-rw-rw- 1 root root 1, 3 2020-05-31 13:03 /dev/null =2D-8<---------------cut here---------------end--------------->8--- (/dev/null in the output above is in yellow) Last but not least, the tramp/adb debug: =2D-8<---------------cut here---------------start------------->8--- ;; Emacs: 26.3 Tramp: 2.4.3.5 -*- mode: outline; -*- 10:02:42.188582 tramp-adb-handle-file-truename (4) # Finding true name for = =E2=80=98/adb::/=E2=80=99 10:02:42.189642 tramp-process-lines (6) # adb devices 10:02:42.196980 tramp-process-lines (6) # (List of devices attached 10.38.1= .13:5555 device ) 10:02:42.197469 tramp-adb-maybe-open-connection (3) # Opening adb shell con= nection... 10:02:42.199160 tramp-adb-maybe-open-connection (6) # adb shell 10:02:42.316669 tramp-process-lines (6) # adb devices 10:02:42.324108 tramp-process-lines (6) # (List of devices attached 10.38.1= .13:5555 device ) 10:02:42.324298 tramp-adb-send-command (6) # PS1=3D"///""8fee333788322a0f14= cf84fe70346e90""#$" 10:02:42.380023 tramp-wait-for-regexp (6) #=20 PS1=3D"///""8fee333788322a0f14cf84fe70346e90""#$" ///8fee333788322a0f14cf84fe70346e90#$ 10:02:42.380221 tramp-adb-maybe-open-connection (5) # Checking system infor= mation 10:02:42.380342 tramp-adb-send-command (6) # echo \"`getprop ro.product.mod= el` `getprop ro.product.version` `getprop ro.build.version.release`\" 10:02:42.568086 tramp-wait-for-regexp (6) #=20 echo \"`getprop ro.product.model` `getprocho \"`getprop ro.product.model` `= getpro <= p ro.product.version` `getprop ro.buil.model` `getprop ro.product.= version` `getprop ro.buil <= d.version.release`\" "GT-I9505 10" ///8fee333788322a0f14cf84fe70346e90#$ 10:02:42.568769 tramp-adb-maybe-open-connection (3) # Opening adb shell con= nection...done 10:02:42.568858 tramp-adb-send-command (6) # ls --color=3Dnever -d -l /; ec= ho tramp_exit_status $? 10:02:42.678601 tramp-wait-for-regexp (6) #=20 ls --color=3Dnever -d -l /; echo tramp_exits --color=3Dnever -d -l /; echo = tramp_exit <= _status $? drwxr-xr-x 22 root root 4096 2009-01-01 01:00 [1;34m/[0m tramp_exit_status 0 ///8fee333788322a0f14cf84fe70346e90#$ 10:02:42.679276 tramp-adb-handle-file-truename (4) # True name of =E2=80=98= /=E2=80=99 is =E2=80=98/=E2=80=99 10:02:42.681116 tramp-handle-insert-directory (0) # Opening directory /adb:= :/... 10:02:42.686233 tramp-adb-send-command (6) # ls --color=3Dnever -a -l /; ec= ho tramp_exit_status $? 10:02:42.880321 tramp-wait-for-regexp (6) #=20 ls --color=3Dnever -a -l /; echo tramp_exits --color=3Dnever -a -l /; echo = tramp_exit <= _status $? total 900 drwxr-xr-x 22 root root 4096 2009-01-01 01:00 [1;34m.[0m drwxr-xr-x 22 root root 4096 2009-01-01 01:00 [1;34m..[0m drwxr-xr-x 92 root root 0 2020-05-31 13:04 [1;34macct[0m drwxr-xr-x 14 root root 280 2020-05-31 13:03 [1;34mapex[0m lrw-r--r-- 1 root root 11 2009-01-01 01:00 [1;36mbin[0m -> [1;34m= /system/bin[0m lrw-r--r-- 1 root root 50 2009-01-01 01:00 [1;36mbugreports[0m ->= [1;31m/data/user_de/0/com.android.shell/files/bugreports[0m drwxrwx--- 6 system cache 4096 2020-05-17 11:52 [1;34mcache[0m lrw-r--r-- 1 root root 19 2009-01-01 01:00 [1;36mcharger[0m -> [1= ;32m/system/bin/charger[0m drwxr-xr-x 3 root root 0 1970-01-01 01:00 [1;34mconfig[0m lrw-r--r-- 1 root root 17 2009-01-01 01:00 [1;36md[0m -> [1;34m/s= ys/kernel/debug[0m drwxrwx--x 50 system system 4096 2020-06-11 14:09 [1;34mdata[0m drwxr-xr-x 2 root root 4096 2009-01-01 01:00 [1;34mdebug_ramdisk[0m =2Drw------- 1 root root 1597 2009-01-01 01:00 default.prop drwxr-xr-x 21 root root 5140 2020-06-09 14:54 [1;34mdev[0m drwxrwx--x 10 system radio 4096 2014-01-01 01:02 [1;34mefs[0m lrw-r--r-- 1 root root 11 2009-01-01 01:00 [1;36metc[0m -> [1;34m= /system/etc[0m dr-xr-x--- 3 system system 16384 2020-05-31 13:03 [1;34mfirmware[0m dr-xr-x--- 3 system system 16384 2020-05-31 13:03 [1;34mfirmware-mdm[0m lrwxr-x--- 1 root shell 16 2009-01-01 01:00 [1;36minit[0m -> [1;32= m/system/bin/init[0m =2Drwxr-x--- 1 root shell 1698 2009-01-01 01:00 [1;32minit.environ.r= c[0m =2Drwxr-x--- 1 root shell 33516 2009-01-01 01:00 [1;32minit.rc[0m =2Drwxr-x--- 1 root shell 7690 2009-01-01 01:00 [1;32minit.usb.confi= gfs.rc[0m =2Drwxr-x--- 1 root shell 5649 2009-01-01 01:00 [1;32minit.usb.rc[0m =2Drwxr-x--- 1 root shell 563 2009-01-01 01:00 [1;32minit.zygote32.= rc[0m drwx------ 2 root root 16384 2009-01-01 01:00 [1;34mlost+found[0m drwxr-xr-x 12 root system 260 2020-05-31 13:03 [1;34mmnt[0m drwxr-xr-x 2 root root 4096 2009-01-01 01:00 [1;34modm[0m drwxr-xr-x 2 root root 4096 2009-01-01 01:00 [1;34moem[0m dr-xr-xr-x 317 root root 0 1970-01-01 01:00 [1;34mproc[0m lrw-r--r-- 1 root root 15 2009-01-01 01:00 [1;36mproduct[0m -> [1= ;34m/system/product[0m lrw-r--r-- 1 root root 24 2009-01-01 01:00 [1;36mproduct_services= [0m -> [1;31m/system/product_services[0m drwxr-xr-x 3 root root 4096 2009-01-01 01:00 [1;34mres[0m drwxr-x--- 2 root shell 4096 2009-01-01 01:00 [1;34msbin[0m lrw-r--r-- 1 root root 21 2009-01-01 01:00 [1;36msdcard[0m -> [1;= 34m/storage/self/primary[0m =2Drw-r--r-- 1 root root 739052 2009-01-01 01:00 sepolicy drwxr-xr-x 4 root root 80 2020-05-31 13:04 [1;34mstorage[0m dr-xr-xr-x 12 root root 0 2020-05-31 13:03 [1;34msys[0m drwxr-xr-x 17 root root 4096 2009-01-01 01:00 [1;34msystem[0m lrw-r--r-- 1 root root 16 2009-01-01 01:00 [1;36mtombstones[0m ->= [1;34m/data/tombstones[0m =2Drw-r--r-- 1 root root 2608 2009-01-01 01:00 ueventd.rc lrw-r--r-- 1 root root 14 2009-01-01 01:00 [1;36mvendor[0m -> [1;= 34m/system/vendor[0m =2Drw-r--r-- 1 root root 1993 2009-01-01 01:00 vendor_service_conte= xts tramp_exit_status 0 ///8fee333788322a0f14cf84fe70346e90#$ 10:02:42.881148 tramp-adb-send-command (6) # ls --color=3Dnever -d -a -l /.= /.. 10:02:43.013417 tramp-wait-for-regexp (6) #=20 ls --color=3Dnever -d -a -l /. /.. drwxr-xr-x 22 root root 4096 2009-01-01 01:00 [1;34m/.[0m drwxr-xr-x 22 root root 4096 2009-01-01 01:00 [1;34m/..[0m ///8fee333788322a0f14cf84fe70346e90#$ 10:02:43.245115 tramp-handle-insert-directory (0) # Opening directory /adb:= :/...done =2D-8<---------------cut here---------------end--------------->8--- Hope this helps. Thank you and happy hacking! Gio' =2D-=20 Giovanni Biscuolo Xelera IT Infrastructures --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEERcxjuFJYydVfNLI5030Op87MORIFAl7jSqIACgkQ030Op87M ORLENRAA3YwAegGF92qkn1b+Ly1WZAQDSZPSEjear+ZP9b1qtIkOY8WAfhYNKY5A ZlVN0ix/fO/xSOqsXMojMDsc9VGHy7xAtV6mdsSzp7Df8co5Gb5SX1pTv4vnhVwu XTbX7rZUe50TUSK8x0W0NKLdsTUFtpSj83ndgMcjVsf1wzMQ5ll8K8nbysjdMeT9 19iFJcif37mta37pbztbGQqFBiNtb7AHKQT4sVS/qKA0XhpEtx0jeeHRWVzITn+H 57KXqzDVdVpPgmCxZFOkb35SN+cEz7HaZ6gCK15YXTGoq3ihNwPTXYzn4IzjMNum ZaQ4jh4yvWz4PMcIjtCZALn6gfzwKYTVvjI0zFytH8agmYuh/doVxnCnvZ5cZZp1 sYXQEOgSw9DlfeblXOJiOe9Tgu9KVkvQzqxjrMGP6oOwmvYMcdJtsEw1s2nHDIsu UZiF9GYqXLDFA3rdM4xXgczi5jlp8eGtHhHF3I8HMPo89jvkzzJMMDU+bzrhmGtG Y+jT+PHi/JAuTn+IXRcQzWr5vfqPpGvatTkgwF8/RcAvtQsdCi2Co48Jbi7Vaniq tuglh9oO8KZnfXVxmZTN+r/LZBmSXDs0d04IH03Qeq4lMpfUdwCGFfSkd7mCFqZF Zm7kfM0PQ6dLYjL7ls015tedqsA5sUQW7uE4ZABEbItYVjrEny8= =RyTe -----END PGP SIGNATURE----- --=-=-=--