From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add shell-quasiquote. Date: Sat, 17 Oct 2015 20:28:05 +0300 Message-ID: <83bnbx4d7e.fsf@gnu.org> References: <87si59wj42.fsf@T420.taylan> <83eggt4esi.fsf@gnu.org> <87fv19wh7b.fsf@T420.taylan> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: ger.gmane.org 1445102910 30723 80.91.229.3 (17 Oct 2015 17:28:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 17 Oct 2015 17:28:30 +0000 (UTC) Cc: emacs-devel@gnu.org To: taylanbayirli@gmail.com (Taylan Ulrich =?utf-8?Q?Bay=C4=B1rl=C4=B1=2FK?= =?utf-8?Q?ammer?=) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 17 19:28:21 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 1ZnVHJ-0006x0-7V for ged-emacs-devel@m.gmane.org; Sat, 17 Oct 2015 19:28:21 +0200 Original-Received: from localhost ([::1]:59267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnVHH-0004dF-Pj for ged-emacs-devel@m.gmane.org; Sat, 17 Oct 2015 13:28:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnVH5-0004cz-Ac for emacs-devel@gnu.org; Sat, 17 Oct 2015 13:28:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZnVH0-0007eD-A4 for emacs-devel@gnu.org; Sat, 17 Oct 2015 13:28:07 -0400 Original-Received: from mtaout27.012.net.il ([80.179.55.183]:39971) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZnVH0-0007dx-26 for emacs-devel@gnu.org; Sat, 17 Oct 2015 13:28:02 -0400 Original-Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0NWD00C00K5NRQ00@mtaout27.012.net.il> for emacs-devel@gnu.org; Sat, 17 Oct 2015 20:23:54 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NWD002L0KBTNY90@mtaout27.012.net.il>; Sat, 17 Oct 2015 20:23:54 +0300 (IDT) In-reply-to: <87fv19wh7b.fsf@T420.taylan> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.183 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:191862 Archived-At: > From: taylanbayirli@gmail.com (Taylan Ulrich Bay=C4=B1rl=C4=B1/Kamm= er) > Cc: emacs-devel@gnu.org > Date: Sat, 17 Oct 2015 19:14:16 +0200 >=20 > Eli Zaretskii writes: >=20 > >> +;;; Like `shell-quote-argument', but much simpler in implementa= tion. > >> +(defun shqq--quote-string (string) > >> + (concat "'" (replace-regexp-in-string "'" "'\\\\''" string) "= '")) > > > > It might be simpler, but it's wrong, because the result is only > > correct for Posix shells. > > > > Please do use shell-quote-argument instead. >=20 > Hmm, I don't really want to take responsibility of my library being= used > with shells other than POSIX shells. (The library could make that > clearer and error on other systems.) I don't think we'd like to have packages limited in that way. AFAIK, we didn't until now, at least not consciously. And it really isn't a big deal. Emacs already has all the infrastructure for portable handling of shell commands. > How much can I rely on shell-quote-argument? You can rely on it. Emacs uses it in umpteen important places. > Can one fully rely on it being safe against code injection? I don't think I understand what code injection you had in mind. Please elaborate.