From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: no-spam@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.bugs Subject: Re: grep.el bugs: grep-find-use-xargs handling, non-use of shell-quote-argument, find-grep and alternative find Date: Wed, 23 Aug 2006 00:28:40 +0200 Message-ID: References: <44EB5844.1020509@tomseddon.plus.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1156315578 4751 80.91.229.2 (23 Aug 2006 06:46:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 23 Aug 2006 06:46:18 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 23 08:46:16 2006 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GFmV2-0007dW-I3 for geb-bug-gnu-emacs@m.gmane.org; Wed, 23 Aug 2006 08:46:05 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFmV2-0002pZ-1z for geb-bug-gnu-emacs@m.gmane.org; Wed, 23 Aug 2006 02:46:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GFel1-0004qT-Fw for bug-gnu-emacs@gnu.org; Tue, 22 Aug 2006 18:30:03 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GFekz-0004nF-M6 for bug-gnu-emacs@gnu.org; Tue, 22 Aug 2006 18:30:02 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFekz-0004n8-EH for bug-gnu-emacs@gnu.org; Tue, 22 Aug 2006 18:30:01 -0400 Original-Received: from [195.41.46.236] (helo=pfepb.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GFesg-0006op-Mm for bug-gnu-emacs@gnu.org; Tue, 22 Aug 2006 18:37:58 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepb.post.tele.dk (Postfix) with SMTP id AEFA8A5001B; Wed, 23 Aug 2006 00:29:53 +0200 (CEST) Original-To: Tom Seddon In-Reply-To: <44EB5844.1020509@tomseddon.plus.com> (Tom Seddon's message of "Tue, 22 Aug 2006 20:17:24 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-Mailman-Approved-At: Wed, 23 Aug 2006 02:46:02 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:15270 Archived-At: Tom Seddon writes: > Hi, > > I've included a patch to fix three grep.el bugs. Thank you for the bug report. I will install fixes for these problems shortly. > > I'm using patched EmacsW32-1.06 (Emacs-22-CvsP060818-EmacsW32-1.06.exe) > but grep.el looks to be the same as the latest one in CVS. OS is Windows > XP, default shell is 4NT, and I'm using the GnuWin32 versions of find, > grep and xargs. > > Firstly, grep-find-use-xargs handling is slightly wrong. The docs state > that if grep-find-use-xargs is nil, xargs won't be used. But that isn't > quite true -- if grep-find-use-xargs is nil, grep-compute-defaults tries > to work out whether grep-find-use-xargs should actually be 'gnu. > > On my PC at least, 'gnu doesn't work (xargs gives the error "grep: > Invalid argument"). I didn't look into this bit, because it seemed like > you could make grep.el use find -exec instead. But that wasn't the case > -- since I actually have a GNU xargs.exe available in the PATH it was > impossible to make grep-compute-defaults set things up to use find -exec > rather than xargs. > > Judging by the docstring for grep-find-use-xargs, this was wrong. The > new behaviour is described in the new docstring. It should be > backwards-compatible for all sensible uses. In particular, if > grep-find-use-xargs is nil, the existing autodetection is still performed. > > (Perhaps I should just have figured out why xargs doesn't work...) > > The second bug is that grep.el doesn't use shell-quote-argument when > constructing the args for find. It just use "\\(", "\\)" and "\\;" > literally. This was causing errors on my PC: > > unixfind: paths must precede expression > Usage: unixfind [-H] [-L] [-P] [path...] [expression] > > Changing grep.el to use shell-quote-argument where appropriate fixed this. > > Finally, grep.el mishandles the case where find-program is something > other than "find". (Since Windows XP includes a "find.exe", I suppose > others might be changing find-program to point at an > alternatively-named version of GNU find.) See also: > > http://lists.gnu.org/archive/html/bug-gnu-emacs/2003-11/msg00029.html > > I've changed grep-compute-defaults accordingly, so that M-x find-grep > puts the cursor at the right point. -- Kim F. Storm http://www.cua.dk