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#30594: [PATCH] Add coreutils 'ls' support for tramp adb Date: Sat, 24 Feb 2018 19:06:40 +0100 Message-ID: <20180224180640.29490-1-m.othacehe@gmail.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1519495596 16277 195.159.176.226 (24 Feb 2018 18:06:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 24 Feb 2018 18:06:36 +0000 (UTC) Cc: Mathieu Othacehe To: 30594@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 24 19:06:32 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 1epeDP-0003lq-K1 for geb-bug-gnu-emacs@m.gmane.org; Sat, 24 Feb 2018 19:06:31 +0100 Original-Received: from localhost ([::1]:51054 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epeFS-00055R-0L for geb-bug-gnu-emacs@m.gmane.org; Sat, 24 Feb 2018 13:08:38 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epeEv-0004m3-Mf 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 1epeEs-0001wS-An for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2018 13:08:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51059) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1epeEs-0001vl-3K 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 1epeEr-0002G4-RY for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2018 13:08:01 -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:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 30594 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.15194956318604 (code B ref -1); Sat, 24 Feb 2018 18:08:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Feb 2018 18:07:11 +0000 Original-Received: from localhost ([127.0.0.1]:58953 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1epeE3-0002Eh-FM for submit@debbugs.gnu.org; Sat, 24 Feb 2018 13:07:11 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54054) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1epeE1-0002EU-1d for submit@debbugs.gnu.org; Sat, 24 Feb 2018 13:07:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1epeDu-00012j-Tn for submit@debbugs.gnu.org; Sat, 24 Feb 2018 13:07:03 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:37471) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1epeDu-00012I-QZ for submit@debbugs.gnu.org; Sat, 24 Feb 2018 13:07:02 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epeDt-0004Ac-E5 for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2018 13:07:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1epeDq-0000xW-9f for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2018 13:07:01 -0500 Original-Received: from mail-wr0-x233.google.com ([2a00:1450:400c:c0c::233]:37384) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1epeDq-0000wT-3H for bug-gnu-emacs@gnu.org; Sat, 24 Feb 2018 13:06:58 -0500 Original-Received: by mail-wr0-x233.google.com with SMTP id z12so17175009wrg.4 for ; Sat, 24 Feb 2018 10:06:57 -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=Vl9nAJZHX/I2sWgVtjF5cpAKE8a/apr6o+dNI9klFAs=; b=H91b7OzTFr4vE/afuSbpfxpXLttWFoaiJxNr7NxS2KxejyeX7ehUJNDWCLHWwabESf B+GXoXLklCRB5wqgTonIh7M0XhKV1Km5vvGultUTGny6wriJJrOTvHI03K6rHTq6JY0n 7cK6/KAn5SfBkgiT3gAO1eNO5HiSDrwqfHE1miR0xlOoLOS8tDAB5c+OZqW64/sEdz8/ YN1W1leDqixcEsqcUg7ti1XQWfGpjlKVbi6BmkBLNsIP7QGcS0J4Ke7j5xXg52KxSleJ JqQ0/pirpvhw3cS70pGq5I0fxu4tk4zEiqRA5aBRDlpAl31el19piyigKFr7m0L3Svwl ciSg== 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=Vl9nAJZHX/I2sWgVtjF5cpAKE8a/apr6o+dNI9klFAs=; b=CFdrEkd1KXPw02SAz1L9rTiKh1c/3PVRmQfo5peGJc/b4QX8bUblnDLdoaZCdlb2x7 XtccuFjuAq9IuILQOs6NeZIR9JEzH7cp+V/jsPjuGBlrmnu1uR6H/hITWKT8epF9wBj8 dA0TCG04FN3u5w9Vj3boWrYJEO6iy2TPRp/QtkSmaE+kcb99LdmMfZmUfCGBC0532bo5 O6niXPBwYMwYxWAEoyBPGGGsdIvsaSIni5VcH27VP2LW6H+AFq7YT5UVlC/+MXyHEg3r dLh5jwOUkac2fNfAjjN4ACHeJj8dbSHxo7FSVdyhFA2Nwas4ejmZWtHnOevtF4QWBsJ1 ER2A== X-Gm-Message-State: APf1xPB4cT2DhKYGY96uTCIGoraMiM/C/I0pWt7vIwcCd2fJRP436U5I /eIY/quCmdwR0EGjbS/zo+AgLQ== X-Google-Smtp-Source: AH8x227p9XCgTND7ARfWu+KNtrFK7/+5Vs4WrRHnmhcpo09DAUDdwZ3H4jl1PsG9aEazhN+lUog34Q== X-Received: by 10.223.171.247 with SMTP id s110mr5046325wrc.106.1519495616431; Sat, 24 Feb 2018 10:06:56 -0800 (PST) Original-Received: from localhost.localdomain ([78.192.96.126]) by smtp.gmail.com with ESMTPSA id 55sm27754wrz.6.2018.02.24.10.06.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Feb 2018 10:06:55 -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:143639 Archived-At: 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