From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#20333: 24.3; Add warning about shell quoting to documentation of combine-and-quote-strings Date: Sun, 03 Jul 2016 18:34:13 +0300 Message-ID: <83inwmrb0q.fsf@gnu.org> References: <87bn2eg6no.fsf@users.sourceforge.net> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1467560127 26172 80.91.229.3 (3 Jul 2016 15:35:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Jul 2016 15:35:27 +0000 (UTC) Cc: p.stephani2@gmail.com, 20333@debbugs.gnu.org To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 03 17:35:16 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1bJjQP-0005iY-QB for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Jul 2016 17:35:14 +0200 Original-Received: from localhost ([::1]:43111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJjQP-0000w6-1g for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Jul 2016 11:35:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJjQI-0000td-G3 for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2016 11:35:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJjQE-0000k0-Ex for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2016 11:35:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51967) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJjQE-0000jw-BR for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2016 11:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bJjQE-0005px-4T for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2016 11:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Jul 2016 15:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20333 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 20333-submit@debbugs.gnu.org id=B20333.146756006922393 (code B ref 20333); Sun, 03 Jul 2016 15:35:02 +0000 Original-Received: (at 20333) by debbugs.gnu.org; 3 Jul 2016 15:34:29 +0000 Original-Received: from localhost ([127.0.0.1]:36071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJjPh-0005p6-2t for submit@debbugs.gnu.org; Sun, 03 Jul 2016 11:34:29 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39427) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bJjPf-0005ot-A3 for 20333@debbugs.gnu.org; Sun, 03 Jul 2016 11:34:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJjPW-0000co-6j for 20333@debbugs.gnu.org; Sun, 03 Jul 2016 11:34:22 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJjPW-0000ce-34; Sun, 03 Jul 2016 11:34:18 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4716 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bJjPV-0002Do-4h; Sun, 03 Jul 2016 11:34:17 -0400 In-reply-to: <87bn2eg6no.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:120343 Archived-At: > From: npostavs@users.sourceforge.net > Date: Sun, 03 Jul 2016 10:03:55 -0400 > Cc: 20333@debbugs.gnu.org > > >From 5a1d23231bcf3c279fd3b09654fb132513748e6c Mon Sep 17 00:00:00 2001 > From: Noam Postavsky > Date: Sun, 3 Jul 2016 09:56:36 -0400 > Subject: [PATCH v1] Note combine-and-quote-strings doesn't shell quote > > * doc/lispref/processes.texi (Shell Arguments): > * lisp/subr.el (combine-and-quote-strings): Add a note that > combine-and-quote-strings doesn't protect arguments against shell > evaluation (Bug #20333). > --- > doc/lispref/processes.texi | 5 +++++ > lisp/subr.el | 5 ++++- > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi > index 5bd0b11..b4542f6 100644 > --- a/doc/lispref/processes.texi > +++ b/doc/lispref/processes.texi > @@ -215,6 +215,11 @@ Shell Arguments > string arguments to be passed to @code{call-process} or > @code{start-process}, or for converting such lists of arguments into > a single Lisp string to be presented in the minibuffer or echo area. > +Note that if a shell is involved (e.g., if using > +@code{call-process-shell-command}), arguments should still be > +protected by @code{shell-quote-argument}; > +@code{combine-and-quote-strings} is @emph{not} intended to protect > +special characters from shell evaluation. > > @defun split-string-and-unquote string &optional separators > This function splits @var{string} into substrings at matches for the > diff --git a/lisp/subr.el b/lisp/subr.el > index ed2166a..e9e19d3 100644 > --- a/lisp/subr.el > +++ b/lisp/subr.el > @@ -3706,7 +3706,10 @@ combine-and-quote-strings > "Concatenate the STRINGS, adding the SEPARATOR (default \" \"). > This tries to quote the strings to avoid ambiguity such that > (split-string-and-unquote (combine-and-quote-strings strs)) == strs > -Only some SEPARATORs will work properly." > +Only some SEPARATORs will work properly. > + > +Note that this is not intended to protect STRINGS from > +interpretation by shells, use `shell-quote-argument' for that." > (let* ((sep (or separator " ")) > (re (concat "[\\\"]" "\\|" (regexp-quote sep)))) > (mapconcat > -- > 2.8.0 LGTM, thanks. This is good for emacs-25.