From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add shell-quasiquote. Date: Mon, 19 Oct 2015 08:10:59 -0700 Organization: UCLA Computer Science Department Message-ID: <56250803.5080601@cs.ucla.edu> References: <87si59wj42.fsf@T420.taylan> <878u6znii9.fsf@T420.taylan> <877fmjj9p6.fsf@fencepost.gnu.org> <87zizfm2dq.fsf@T420.taylan> <871tcr7yvq.fsf@fastmail.com> <87mvvfm0bd.fsf@T420.taylan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1445267923 16986 80.91.229.3 (19 Oct 2015 15:18:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 19 Oct 2015 15:18:43 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?UTF-8?Q?Taylan_Ulrich_Bay=c4=b1rl=c4=b1/Kammer?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 19 17:18:38 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZoCCr-0006b3-4k for ged-emacs-devel@m.gmane.org; Mon, 19 Oct 2015 17:18:37 +0200 Original-Received: from localhost ([::1]:40095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoCCq-0000qS-NT for ged-emacs-devel@m.gmane.org; Mon, 19 Oct 2015 11:18:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoC5i-000697-Lr for emacs-devel@gnu.org; Mon, 19 Oct 2015 11:11:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZoC5c-0002Jx-Mn for emacs-devel@gnu.org; Mon, 19 Oct 2015 11:11:14 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:51475) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoC5c-0002Jf-Hn for emacs-devel@gnu.org; Mon, 19 Oct 2015 11:11:08 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 021E9160D69; Mon, 19 Oct 2015 08:11:07 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id uL7nrLVr0ffl; Mon, 19 Oct 2015 08:11:02 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 8AE31160D75; Mon, 19 Oct 2015 08:11:02 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 94Cis8I0z4-F; Mon, 19 Oct 2015 08:11:02 -0700 (PDT) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 71CAD160D69; Mon, 19 Oct 2015 08:11:02 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: <87mvvfm0bd.fsf@T420.taylan> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:192109 Archived-At: On 10/19/2015 06:53 AM, Taylan Ulrich Bay=C4=B1rl=C4=B1/Kammer wrote: > If there's a /bin/if on the system, (shqq (if blah blah)) will call it. > Not very useful, but consistent. No, it's not consistent. If there's a file named "sh" in the working=20 directory, shqq will not attempt to call it unless "." precedes "/bin"=20 and "/usr/bin" in PATH (which is not a good idea for other reasons). =20 More amusingly, although there is a file named "." in the working=20 directory, shqq will not attempt to call it, and instead will invoke a=20 builtin shell command that allows injection of arbitrary shell code. To quote a file name that one wants to execute one must also prefix it=20 with './', unless the unquoted name starts with '/'. That would be more=20 consistent. Of course, it would also be incorrect for strings intended=20 to be the command's arguments. This means that neither=20 shqq--quote-string nor shell-quote-argument should be used blindly to=20 quote command names. In this sense, shell-quote-argument has a better=20 name than shqq--quote-string does, since the word "argument" means the=20 function is intended for command arguments, as opposed to arbitrary strin= gs. All in all there does not seem to be a good reason to have a separate=20 function shqq--quote-string. Any improvement that it has over=20 shell-quote-argument should be folded into shell-quote-argument.