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 12:18:52 +0100 Message-ID: <87efl9pbab.fsf@gmail.com> References: <20180224180640.29490-1-m.othacehe@gmail.com> <87371qqf70.fsf@gmx.de> <87woz2p0a0.fsf@gmx.de> <87h8q5pfr9.fsf@gmail.com> <87fu5ppcpn.fsf@gmail.com> <87sh9ppc99.fsf@gmx.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1519557436 30469 195.159.176.226 (25 Feb 2018 11:17:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 25 Feb 2018 11:17:16 +0000 (UTC) User-Agent: mu4e 0.9.18; emacs 25.3.1 Cc: 30594@debbugs.gnu.org, Andreas Schwab To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 25 12:17:12 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 1epuIp-0007M1-GP for geb-bug-gnu-emacs@m.gmane.org; Sun, 25 Feb 2018 12:17:11 +0100 Original-Received: from localhost ([::1]:53820 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epuKr-0003as-Vy for geb-bug-gnu-emacs@m.gmane.org; Sun, 25 Feb 2018 06:19:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epuKh-0003aU-7v for bug-gnu-emacs@gnu.org; Sun, 25 Feb 2018 06:19:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1epuKc-0002dw-9J for bug-gnu-emacs@gnu.org; Sun, 25 Feb 2018 06:19:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51551) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1epuKc-0002dm-26 for bug-gnu-emacs@gnu.org; Sun, 25 Feb 2018 06:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1epuKb-0002ts-Sh for bug-gnu-emacs@gnu.org; Sun, 25 Feb 2018 06:19: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 11:19: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.151955754111142 (code B ref 30594); Sun, 25 Feb 2018 11:19:01 +0000 Original-Received: (at 30594) by debbugs.gnu.org; 25 Feb 2018 11:19:01 +0000 Original-Received: from localhost ([127.0.0.1]:59447 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1epuKa-0002tb-ON for submit@debbugs.gnu.org; Sun, 25 Feb 2018 06:19:01 -0500 Original-Received: from mail-wr0-f170.google.com ([209.85.128.170]:34696) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1epuKZ-0002tO-N0 for 30594@debbugs.gnu.org; Sun, 25 Feb 2018 06:19:00 -0500 Original-Received: by mail-wr0-f170.google.com with SMTP id m5so18330255wrg.1 for <30594@debbugs.gnu.org>; Sun, 25 Feb 2018 03:18:59 -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=rf882r2kYC6eorqiTpykJUiZ9PTEswOd9HTL6a+759I=; b=u7sfUrRRUgZwREA46oCpOHNAPyeznJ+/ADukKG2efLZfc8h8Va/MqJCBRAnApioTAw bQ45Q1LZP+x5OFKD5mP3c+RceEybjhZq0BmQEpWnlERJxCYpM0UGrNvVfSmTQGdChMYw rYsanhkAx/UKoWrfpXdtuOSCZGp5t4DXucUfDxuCgI0YZ7RnsnlYiu6Bokse3RmCJM/B LUP0MTdkVcUFYDNRpZmzfhBc6g58fObuBAKxiXDBevT21mGM2mzUgPVP+szVyW9KKYNd oHGR/fMfzgXxv0W7vyI8XGxE4Jg5z+khpNVAQ8CizOw8ijNNW8KxP4bUnCYf3ZMMPGlY Emmg== 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=rf882r2kYC6eorqiTpykJUiZ9PTEswOd9HTL6a+759I=; b=OLy/TbYDcwhaYun5LC8F13mVVRaK86TgpUUMKJnWxj3T/nPTzj72m94eLdHv9KgiPQ r2m6amaoguNUGhYg58OlQCTxBWKxA55IjYU9kQZQKOvDdakh1xGIHGf3Xux+gv3d5+J0 mo0/LJgXR81PHvj3N196vuEuvyZyRirrOux318cZp7hL7XinlJyMY1obp7+W7e6+Jx5j Bk+o/s6ZcBR3dRw6UQZbpMw30YUhNwhpaWmY9N9ud57lfPUJCCcyY7QD/EoYJ8QgbiRQ 6e2ZMz6tlKVZVzjenrfwEJ0/aTlmwFfqMYAp4bKYBoiucIsuU5CHLA87wn4Mt8VOln9c iAlA== X-Gm-Message-State: APf1xPC7jL8uETdXzTYGcdK5FE/l3kCSqlw4LOoDPkVGO8/o0XAo4ths qNkdWumUu5OvwLAaGU34aJZ2CQ== X-Google-Smtp-Source: AH8x226HedS9lys4pjoOeKR4Rim9i7g0Y474uXXCLnopeO6/YhUOafuDDwAzmh+s2/aaai0+svoWtQ== X-Received: by 10.223.157.205 with SMTP id q13mr6407269wre.266.1519557533819; Sun, 25 Feb 2018 03:18:53 -0800 (PST) Original-Received: from cervin ([78.192.96.126]) by smtp.gmail.com with ESMTPSA id k2sm15641303wrc.30.2018.02.25.03.18.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 25 Feb 2018 03:18:52 -0800 (PST) In-reply-to: <87sh9ppc99.fsf@gmx.de> 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:143655 Archived-At: --=-=-= Content-Type: text/plain > This is not what we have agreed. Could you, pls, rework? Oops wrong rebase, sorry about that. Here's an update version. Mathieu --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-coreutils-ls-support-for-tramp-adb.patch >From c904d5da9d65b95a6176c86bb6ba143b29e90f1d 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..6257f84d6f 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 --time-style=long-iso /dev/null") + "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 6d216933f307bdb946d569510853003fafea3c45 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 6257f84d6f..3f4de93bc5 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 --=-=-=--