From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Quotes in Dired listing switches Date: Mon, 11 Jan 2010 02:43:35 +0200 Organization: JURTA Message-ID: <878wc7nhv7.fsf@mail.jurta.org> References: <87vdfy5om7.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1263174962 16340 80.91.229.12 (11 Jan 2010 01:56:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 Jan 2010 01:56:02 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 11 02:55:55 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NU9VZ-0006Sb-Gx for ged-emacs-devel@m.gmane.org; Mon, 11 Jan 2010 02:55:53 +0100 Original-Received: from localhost ([127.0.0.1]:45309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NU9VX-0003aT-LB for ged-emacs-devel@m.gmane.org; Sun, 10 Jan 2010 20:55:51 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NU9VR-0003a5-LO for emacs-devel@gnu.org; Sun, 10 Jan 2010 20:55:45 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NU9VN-0003Zt-MC for emacs-devel@gnu.org; Sun, 10 Jan 2010 20:55:45 -0500 Original-Received: from [199.232.76.173] (port=57799 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NU9VN-0003Zj-Hv for emacs-devel@gnu.org; Sun, 10 Jan 2010 20:55:41 -0500 Original-Received: from smtp-out4.starman.ee ([85.253.0.6]:51190 helo=mx2.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NU9VN-0008Ue-4Z for emacs-devel@gnu.org; Sun, 10 Jan 2010 20:55:41 -0500 X-Virus-Scanned: by Amavisd-New at mx2.starman.ee Original-Received: from mail.starman.ee (82.131.31.199.cable.starman.ee [82.131.31.199]) by mx2.starman.ee (Postfix) with ESMTP id 80E303F4147; Mon, 11 Jan 2010 03:55:29 +0200 (EET) In-Reply-To: (Stefan Monnier's message of "Wed, 23 Dec 2009 22:18:58 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (x86_64-pc-linux-gnu) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:119806 Archived-At: >> (setq dired-listing-switches "-al --block-size=\"'1\"") > [...] >> (apply 'call-process >> insert-directory-program nil t nil >> '("--dired" "-al" "--block-size=\"'1\"" "--" "/tmp/.")) > [...] >> then Dired works correctly, but with e.g. `C-x d /sudo::/tmp' >> Tramp hangs because the unmatched single quote causes the shell >> to wait for the closing quote. > > Obviously, there's a problem in the inconsistent parsing of > dired-listing-switches, where the basic code splits it at spaces without > doing any additional unquoting or analysis, whereas the Tramp code seems > to just pass it as-is to the shell (so if you set it to "-al $(rm -rf ~/.)" > it will try to do something funny). > I won't claim that the basic code's naive splitting is great, but > Tramp's similarly naive use is not great either. So, I suggest to treat > it as a bug in Tramp which should split it like the basic code and then > shell-quote-argument the parts. There is still something wrong in `insert-directory'. Currently it's impossible to use both `C-x d dir-name RET' and `C-x d file-name RET' (where the latter specifies a filename wildcard for dired). With (setq dired-listing-switches "-al --block-size='1") `insert-directory' succeeds for `C-x d /tmp/ RET', but fails for `C-x d /tmp/file RET'. With (setq dired-listing-switches "-al --block-size=\"'1\"") `insert-directory' fails for `C-x d /tmp/ RET', and succeeds for `C-x d /tmp/file RET'. The difference in `insert-directory' is in the `if wildcard' condition: the first branch calls `insert-directory-program' using `shell-file-name', the second branch calls `insert-directory-program' directly. -- Juri Linkov http://www.jurta.org/emacs/