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: Sun, 25 Feb 2018 11:48:04 +0100 Message-ID: <87fu5ppcpn.fsf@gmail.com> References: <20180224180640.29490-1-m.othacehe@gmail.com> <87371qqf70.fsf@gmx.de> <87woz2p0a0.fsf@gmx.de> <87h8q5pfr9.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1519555633 31450 195.159.176.226 (25 Feb 2018 10:47:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 25 Feb 2018 10:47:13 +0000 (UTC) User-Agent: mu4e 0.9.18; emacs 25.3.1 Cc: 30594@debbugs.gnu.org, Michael Albinus To: Andreas Schwab Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 25 11:47:09 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 1eptpi-0007bX-Oq for geb-bug-gnu-emacs@m.gmane.org; Sun, 25 Feb 2018 11:47:07 +0100 Original-Received: from localhost ([::1]:53685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eptrk-0006ko-Sa for geb-bug-gnu-emacs@m.gmane.org; Sun, 25 Feb 2018 05:49:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eptrf-0006kY-5G for bug-gnu-emacs@gnu.org; Sun, 25 Feb 2018 05:49:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eptra-0006XQ-9Q for bug-gnu-emacs@gnu.org; Sun, 25 Feb 2018 05:49:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51518) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eptra-0006Wx-3B for bug-gnu-emacs@gnu.org; Sun, 25 Feb 2018 05:49:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eptrZ-0002Ck-Sg for bug-gnu-emacs@gnu.org; Sun, 25 Feb 2018 05:49: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: Sun, 25 Feb 2018 10:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30594 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 30594-submit@debbugs.gnu.org id=B30594.15195556948420 (code B ref 30594); Sun, 25 Feb 2018 10:49:01 +0000 Original-Received: (at 30594) by debbugs.gnu.org; 25 Feb 2018 10:48:14 +0000 Original-Received: from localhost ([127.0.0.1]:59415 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eptqo-0002Bk-HW for submit@debbugs.gnu.org; Sun, 25 Feb 2018 05:48:14 -0500 Original-Received: from mail-wm0-f49.google.com ([74.125.82.49]:54984) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eptql-0002BW-Un for 30594@debbugs.gnu.org; Sun, 25 Feb 2018 05:48:12 -0500 Original-Received: by mail-wm0-f49.google.com with SMTP id z81so12271582wmb.4 for <30594@debbugs.gnu.org>; Sun, 25 Feb 2018 02:48:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=QnxFzRCO4AVPp4AGplmVQdOfuKSAVGP1/TSCHsce/vE=; b=Uo/ONlI0Cpitlt3Jd9JNFoGA3yiIvL/xUbOwpsj66Yyk0VOFVls0Yi9c+HgfVBvzD+ A5SHrRXtKW/PnW3A8afPNCF7chfZaDXd282kMgb5D+VdEzxuzjTF0SFD5Re146taylRL 714pNttv99w07Lcs2bwOKezVaxuTdNTZR4e3YANE6GkQVN6ERpBMz61sor9N22W8ESP8 pA7kLAp2VIQ85qDYbsZxxxlSMrUC83qUPy9cwoRuapUG9kD00/U5IlJjGtOiTU6xjyic 1CepzppMemKbC24OApzsjBxkEIHWyKZcd0OXYXljU+oYZaTeoOJCudu9RJCL4eLYllMD btMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=QnxFzRCO4AVPp4AGplmVQdOfuKSAVGP1/TSCHsce/vE=; b=bjItIeVst8tbSIzzYPjurZ1Ng7V6rMN+Pt1W65E90UPZ5zkusNIOEFNnnuL1mXOCzn b1BH1Vw5bizdAu2vHU8onvaGMiWMwFvvwMXwTzV/d0l1BArdud/fbeiHNanZYQqlI6Je Z92QqyCWIjvSGe/VZo+3yEgSaYOy8Z7kBnf8KyZKw5R67diDcRZ68hUKddaLvU/CWFTT wNX1XszAsV0SpUIFkYqtgcijKFrI9994bOcFION7mIw3o9W1yDE1JOOeg6rTb9aT0W+h H3PS/2hq5s7vELCVjtxGUYw4w+qjB8h3nUmLUOJMyiJ0iQTeuGmi56eQTNG3foYZHsH2 kTIA== X-Gm-Message-State: APf1xPD6teh4xNkb05oIVCCUbhPeStfve3spX9CNz5njFgDZKSr7Hpcd Zg76jDCS04Z1L7gLz5zT4ubiYA== X-Google-Smtp-Source: AH8x227J9gCs794LtPnEUgwr7VG/daHS866FN8utnXSCLRJkOWST8/gns3N7MQ32+noGsveHlMkD/g== X-Received: by 10.28.191.193 with SMTP id o62mr5692109wmi.113.1519555685667; Sun, 25 Feb 2018 02:48:05 -0800 (PST) Original-Received: from cervin ([78.192.96.126]) by smtp.gmail.com with ESMTPSA id e15sm6014382wmd.26.2018.02.25.02.48.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 25 Feb 2018 02:48:04 -0800 (PST) In-reply-to: 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:143653 Archived-At: --=-=-= Content-Type: text/plain Hi Andreas, > Thats `ls -1'. You're right, I updated my patch. As toybox 'ls' seems to also support this option, here's an other patch to use 'ls -1' for toybox too. Thanks, Mathieu --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-coreutils-ls-support-for-tramp-adb.patch >From 20a0de9436cdac80ac22c1b1efbbaf9654d5bf7f Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Sat, 24 Feb 2018 18:12:36 +0100 Subject: [PATCH] Add coreutils 'ls' support for tramp adb 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..5489dbe5a5 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") + "ls -1 --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 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Use-ls-1-to-list-files-with-toybox-ls.patch >From c41d53965288843285faf1cf9344d6b751eaf1fc Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Sun, 25 Feb 2018 11:32:30 +0100 Subject: [PATCH] Use 'ls -1' to list files with toybox ls * lisp/net/tramp-adb.el (tramp-adb-get-ls-command): Use 'ls -1' instead of passing COLUMNS=1 env variable. This is isofunctional. --- lisp/net/tramp-adb.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 5489dbe5a5..6fe38fb2e5 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -470,7 +470,7 @@ tramp-adb-get-ls-command ;; 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") - "env COLUMNS=1 ls") + "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. -- 2.16.1 --=-=-=--