unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Giovanni Biscuolo <g@xelera.eu>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: tramp and adb, strange escape codes in dired
Date: Fri, 12 Jun 2020 11:28:01 +0200	[thread overview]
Message-ID: <87bllozl9a.fsf@roquette.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <87pna5ebbs.fsf@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 11282 bytes --]

Hi Michael,

thank you for your help.

Michael Albinus <michael.albinus@gmx.de> 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=never" and unfortunately
toybox output is coloured when the option "--color=never" 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):

--8<---------------cut here---------------start------------->8---

jflte:/ # ls --help
ls --help
usage: ls [-ACFHLRSZacdfhiklmnpqrstux1] [--color[=auto]] [directory...]

List files.

what to show:
-a  all files including .hidden    -b  escape nongraphic chars
-c  use ctime for timestamps       -d  directory, not contents
-i  inode number                   -p  put a '/' after dir names
-q  unprintable chars as '?'       -s  storage used (1024 byte units)
-u  use access time for timestamps -A  list all files but . and ..
-H  follow command line symlinks   -L  follow symlinks
-R  recursively list in subdirs    -F  append /dir *exe @sym |FIFO
-Z  security context

output formats:
-1  list one file per line         -C  columns (sorted vertically)
-g  like -l but no owner           -h  human readable sizes
-l  long (show full details)       -m  comma separated
-n  like -l but numeric uid/gid    -o  like -l but no group
-x  columns (horizontal sort)      -ll long with nanoseconds (--full-time)
--color  device=yellow  symlink=turquoise/red  dir=blue  socket=purple
         files: exe=green  suid=red  suidfile=redback  stickydir=greenback
         =auto means detect if output is a tty.

sorting (default is alphabetical):
-f  unsorted    -r  reverse    -t  timestamp    -S  size

--8<---------------cut here---------------end--------------->8---

Test #1 (adb shell via Emacs shell):

--8<---------------cut here---------------start------------->8---

jflte:/ # ls --time-style=long-iso /dev/null
ls --time-style=long-iso /dev/null
ls: Unknown option time-style=long-iso (see "ls --help")

--8<---------------cut here---------------end--------------->8---

Test #2 (adb shell via Emacs shell):

--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 

--8<---------------cut here---------------end--------------->8---

Test #3 (adb shell via Emacs shell):

--8<---------------cut here---------------start------------->8---

jflte:/ # ls --color=never -al /dev/null
ls --color=never -al /dev/null
crw-rw-rw- 1 root root 1,   3 2020-05-31 13:03 /dev/null

--8<---------------cut here---------------end--------------->8---
(/dev/null in the output above is in yellow)


Last but not least, the tramp/adb debug:

--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 ‘/adb::/’
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 connection...
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="///""8fee333788322a0f14cf84fe70346e90""#$"
10:02:42.380023 tramp-wait-for-regexp (6) # 
PS1="///""8fee333788322a0f14cf84fe70346e90""#$"
///8fee333788322a0f14cf84fe70346e90#$
10:02:42.380221 tramp-adb-maybe-open-connection (5) # Checking system information
10:02:42.380342 tramp-adb-send-command (6) # echo \"`getprop ro.product.model` `getprop ro.product.version` `getprop ro.build.version.release`\"
10:02:42.568086 tramp-wait-for-regexp (6) # 
echo \"`getprop ro.product.model` `getprocho \"`getprop ro.product.model` `getpro                                      <\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bp ro.product.version` `getprop ro.buil.model` `getprop ro.product.version` `getprop ro.buil                         <\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bd.version.release`\"
"GT-I9505 10"
///8fee333788322a0f14cf84fe70346e90#$
10:02:42.568769 tramp-adb-maybe-open-connection (3) # Opening adb shell connection...done
10:02:42.568858 tramp-adb-send-command (6) # ls --color=never -d -l /; echo tramp_exit_status $?
10:02:42.678601 tramp-wait-for-regexp (6) # 
ls --color=never -d -l /; echo tramp_exits --color=never -d -l /; echo tramp_exit                                      <\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b_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 ‘/’ is ‘/’
10:02:42.681116 tramp-handle-insert-directory (0) # Opening directory /adb::/...
10:02:42.686233 tramp-adb-send-command (6) # ls --color=never -a -l /; echo tramp_exit_status $?
10:02:42.880321 tramp-wait-for-regexp (6) # 
ls --color=never -a -l /; echo tramp_exits --color=never -a -l /; echo tramp_exit                                      <\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b_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/sys/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
-rw-------   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;32m/system/bin/init[0m
-rwxr-x---   1 root   shell    1698 2009-01-01 01:00 [1;32minit.environ.rc[0m
-rwxr-x---   1 root   shell   33516 2009-01-01 01:00 [1;32minit.rc[0m
-rwxr-x---   1 root   shell    7690 2009-01-01 01:00 [1;32minit.usb.configfs.rc[0m
-rwxr-x---   1 root   shell    5649 2009-01-01 01:00 [1;32minit.usb.rc[0m
-rwxr-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
-rw-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
-rw-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
-rw-r--r--   1 root   root     1993 2009-01-01 01:00 vendor_service_contexts
tramp_exit_status 0
///8fee333788322a0f14cf84fe70346e90#$
10:02:42.881148 tramp-adb-send-command (6) # ls --color=never -d -a -l /. /..
10:02:43.013417 tramp-wait-for-regexp (6) # 
ls --color=never -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

--8<---------------cut here---------------end--------------->8---

Hope this helps.

Thank you and happy hacking! Gio'

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2020-06-12  9:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 13:55 tramp and adb, strange escape codes in dired Giovanni Biscuolo
2020-06-11 14:12 ` Michael Heerdegen
2020-06-11 17:03   ` Giovanni Biscuolo
2020-06-11 15:28 ` tomas
2020-06-11 17:55   ` Michael Albinus
2020-06-12  9:28     ` Giovanni Biscuolo [this message]
2020-06-12 15:50       ` Michael Albinus
2020-06-13 12:57         ` Giovanni Biscuolo
2020-06-13 13:20           ` 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=87bllozl9a.fsf@roquette.i-did-not-set--mail-host-address--so-tickle-me \
    --to=g@xelera.eu \
    --cc=help-gnu-emacs@gnu.org \
    --cc=michael.albinus@gmx.de \
    /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.
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).