From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18093 invoked by alias); 1 Feb 2018 14:17:57 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42336 Received: (qmail 27560 invoked by uid 1010); 1 Feb 2018 14:17:56 -0000 X-Qmail-Scanner-Diagnostics: from forward105p.mail.yandex.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(77.88.28.108):SA:0(-2.6/5.0):. Processed in 4.425558 secs); 01 Feb 2018 14:17:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_PASS autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: wgh@torlan.ru X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | To: zsh-workers@zsh.org From: WGH Subject: completion: adb remote folder problems due to ls columnated output Message-ID: Date: Thu, 1 Feb 2018 17:08:52 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US For some reason, `adb shell ls` command on my Android (Lineage OS 14.1, Android 7.1.2) and adb (1.0.32) prints directory listing in several columns, even if its stdout is connected to pipe (as opposed of terminal). It breaks the completion script, which expects one file per line. This patch fixes the issue for me. Assuming ls supports -1 option, It shouldn't break setups that already output one file per line. diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb index 6b56d1748..f0ffdb5a4 100644 --- a/Completion/Unix/Command/_adb +++ b/Completion/Unix/Command/_adb @@ -480,7 +480,7 @@ _adb_remote_folder () {      pref=${pref%/*}/    fi    # yes, this ls is sickening to look at, but android doesn't have printf or find -  files=(${${(f)"$(adb ${=ADB_DEVICE_SPECIFICATION} shell 'ls -d 2> /dev/null '$pref'*/ '$pref'*')"}%$'\r'}) +  files=(${${(f)"$(adb ${=ADB_DEVICE_SPECIFICATION} shell 'ls -1d 2> /dev/null '$pref'*/ '$pref'*')"}%$'\r'})    dirs=(${${(M)files:#*/}%/})    files=(${${files:|dirs}:#*\*(/|)})    _adb_device_available && \