From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: [mange@freemail.hu: grep-tree doesn't shell-quote-argument] Date: Tue, 18 Apr 2006 16:02:44 +0200 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1145369110 15660 80.91.229.2 (18 Apr 2006 14:05:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 18 Apr 2006 14:05:10 +0000 (UTC) Cc: Magnus Henoch , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 18 16:05:07 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FVqpF-0001fV-RG for ged-emacs-devel@m.gmane.org; Tue, 18 Apr 2006 16:05:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FVqpF-0004rD-JF for ged-emacs-devel@m.gmane.org; Tue, 18 Apr 2006 10:05:05 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FVqp1-0004qI-69 for emacs-devel@gnu.org; Tue, 18 Apr 2006 10:04:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FVqoy-0004pX-4z for emacs-devel@gnu.org; Tue, 18 Apr 2006 10:04:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FVqox-0004pJ-Sj for emacs-devel@gnu.org; Tue, 18 Apr 2006 10:04:47 -0400 Original-Received: from [195.41.46.236] (helo=pfepb.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FVqpo-0006tr-Cb; Tue, 18 Apr 2006 10:05:40 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepb.post.tele.dk (Postfix) with SMTP id 6E7D7A50029; Tue, 18 Apr 2006 16:04:38 +0200 (CEST) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Tue, 18 Apr 2006 08:57:34 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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:53008 Archived-At: Richard Stallman writes: > Since M-x grep does not do this, I am not sure it is desirable > to make M-x grep-tree incompatible with it. But I don't use > grep-tree. What do others think? M-x grep prompts for the entire command line, so the user can easily add the necessary quoting of the regexp. M-x grep-tree prompts individually for the regexp, files, and directory, so I think it makes good sense to quote the regexp automatically. It would make sense to rewrite the following line to use shell-quote-argument as well: > (and files (concat "-name '" files "'")) i.e. (and files (concat "-name " (shell-quote-argument files))) > > From: Magnus Henoch > Subject: grep-tree doesn't shell-quote-argument > To: emacs-pretest-bug@gnu.org > Date: Mon, 17 Apr 2006 23:17:14 +0200 > Mail-Followup-To: emacs-pretest-bug@gnu.org > Mail-Copies-To: never > > - --=-=-= > > grep-tree doesn't quote its regexp argument to protect it from the > shell. This makes it harder to use * and ? in regexps. I propose > this patch: > > 2006-04-17 Magnus Henoch > > * progmodes/grep.el (grep-tree): Call shell-quote-argument on > regexp. > > > - --=-=-= > Content-Type: text/x-patch > Content-Disposition: inline > > *** orig/lisp/progmodes/grep.el > - --- mod/lisp/progmodes/grep.el > *************** > *** 631,637 **** > (setq files (cdr mf))))) > (let ((command-args (grep-expand-command-macros > grep-tree-command > ! (setq grep-tree-last-regexp regexp) > (and files (concat "-name '" files "'")) > (if subdirs > (if (stringp subdirs) > - --- 632,638 ---- > (setq files (cdr mf))))) > (let ((command-args (grep-expand-command-macros > grep-tree-command > ! (shell-quote-argument (setq grep-tree-last-regexp regexp)) > (and files (concat "-name '" files "'")) > (if subdirs > (if (stringp subdirs) > > - --=-=-= > Content-Type: text/plain; charset="us-ascii" > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Content-Disposition: inline > > _______________________________________________ > emacs-pretest-bug mailing list > emacs-pretest-bug@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug > > - --=-=-=-- > ---------- > -- Kim F. Storm http://www.cua.dk