all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#30594: [PATCH] Add coreutils 'ls' support for tramp adb
@ 2018-02-24 18:06 Mathieu Othacehe
  2018-02-24 20:56 ` Michael Albinus
  0 siblings, 1 reply; 9+ messages in thread
From: Mathieu Othacehe @ 2018-02-24 18:06 UTC (permalink / raw)
  To: 30594; +Cc: Mathieu Othacehe

Support some Android derived systems where 'ls' binary is provided by
GNU Coreutils.

* lisp/net/tramp-adb.el (tramp-adb-ls-toolbox-regexp): Allow '.'
character in file permissions. It indicates an SELinux security
context.
(tramp-adb-get-ls-command): Detect Coreutils version of 'ls'. Force
output on one column and long-iso time style to match the behaviour of
toybox and busybox 'ls' commands.
---
 lisp/net/tramp-adb.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index f5c45f68e9..be269aca51 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -71,7 +71,7 @@ tramp-adb-ls-date-regexp
 
 (defconst tramp-adb-ls-toolbox-regexp
   (concat
-   "^[[:space:]]*\\([-[:alpha:]]+\\)" 	; \1 permissions
+   "^[[:space:]]*\\([-\\.[:alpha:]]+\\)" ; \1 permissions
    "\\(?:[[:space:]]+[[:digit:]]+\\)?"	; links (Android 7/toybox)
    "[[:space:]]*\\([^[:space:]]+\\)"	; \2 username
    "[[:space:]]+\\([^[:space:]]+\\)"	; \3 group
@@ -462,9 +462,15 @@ tramp-adb-get-ls-command
   (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" flavours.
+     ((tramp-adb-send-command-and-check vec "ls --help | grep coreutils")
+      "env COLUMNS=1 ls --time-style=long-iso")
      ;; Can't disable coloring explicitly for toybox ls command.  We
-     ;; must force "ls" to print just one column.
-     ((tramp-adb-send-command-and-check vec "toybox") "env COLUMNS=1 ls")
+     ;; also must force "ls" to print just one column.
+     ((tramp-adb-send-command-and-check vec "toybox")
+      "env COLUMNS=1 ls")
      ;; On CyanogenMod based system BusyBox is used and "ls" output
      ;; coloring is enabled by default.  So we try to disable it when
      ;; possible.
-- 
2.16.1






^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-02-26 15:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-24 18:06 bug#30594: [PATCH] Add coreutils 'ls' support for tramp adb Mathieu Othacehe
2018-02-24 20:56 ` Michael Albinus
2018-02-24 21:04   ` Michael Albinus
2018-02-25  9:42     ` Mathieu Othacehe
2018-02-25 10:13       ` Andreas Schwab
2018-02-25 10:48         ` Mathieu Othacehe
2018-02-25 10:57           ` Michael Albinus
2018-02-25 11:18             ` Mathieu Othacehe
2018-02-26 15:52               ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.