From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#21548: 25.0.50; [PATCH] Prevent empty -path arguments for not-ignored directories in rgrep's find commands Date: Thu, 24 Sep 2015 23:28:39 +1200 Message-ID: <5603DE67.1010903@orcon.net.nz> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080801030508040608070302" X-Trace: ger.gmane.org 1443094167 7410 80.91.229.3 (24 Sep 2015 11:29:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Sep 2015 11:29:27 +0000 (UTC) To: 21548@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 24 13:29:15 2015 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 1Zf4i7-0005ul-Og for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Sep 2015 13:29:11 +0200 Original-Received: from localhost ([::1]:57579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf4i7-0002Cg-4w for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Sep 2015 07:29:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf4i3-0002CI-HE for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2015 07:29:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zf4hy-0002Mr-Gr for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2015 07:29:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52495) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf4hy-0002Mn-DR for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2015 07:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Zf4hy-00058k-96 for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2015 07:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Sep 2015 11:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21548 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.144309413819746 (code B ref -1); Thu, 24 Sep 2015 11:29:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Sep 2015 11:28:58 +0000 Original-Received: from localhost ([127.0.0.1]:41466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zf4hu-00058Q-5a for submit@debbugs.gnu.org; Thu, 24 Sep 2015 07:28:58 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46623) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zf4hs-00058H-Ec for submit@debbugs.gnu.org; Thu, 24 Sep 2015 07:28:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zf4hr-0002Jh-2T for submit@debbugs.gnu.org; Thu, 24 Sep 2015 07:28:55 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:49771) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf4hr-0002Jd-07 for submit@debbugs.gnu.org; Thu, 24 Sep 2015 07:28:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf4hq-00029a-0i for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2015 07:28:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zf4hl-0002Iz-0Y for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2015 07:28:53 -0400 Original-Received: from [219.88.242.62] (port=50865 helo=mail.orcon.net.nz) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf4hk-0002Gj-Gu for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2015 07:28:48 -0400 Original-Received: from [10.1.1.2] (202-150-97-63.bng1.avl.orcon.net.nz [202.150.97.63] (may be forged)) (authenticated bits=0) by mail.orcon.net.nz (8.14.3/8.14.3/Debian-9.4) with ESMTP id t8OBSdAS010226 for ; Thu, 24 Sep 2015 23:28:40 +1200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 X-Bayes-Prob: 0.0001 (Score 0: No Bayes scoring rules defined, tokens from: outbound) X-CanIt-Geo: ip=202.150.97.63; country=NZ; latitude=-41; longitude=174.0000; http://maps.google.com/maps?q=-41,174.0000&z=6 X-CanItPRO-Stream: base:outbound X-Canit-Stats-ID: 01PkXsEIx - f5127de22d1a - 20150924 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:106858 Archived-At: This is a multi-part message in MIME format. --------------080801030508040608070302 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars) of 2015-09-05 Repository revision: 2330ca33a97867f2ea1123bcf7bfe5cfcc030b36 rgrep's `grep-find-ignored-directories' conditional-ignore behaviour (for list elements which are cons cells) produces 'find' constraints like: "find . -type d \( -path -o -path \*/SCCS [...]" (i.e. a -path argument with no value) when the associated function returns nil. The nil elements need to be deleted from the list before the command line arguments for the ignored directories are generated. --------------080801030508040608070302 Content-Type: text/x-patch; name="0001-Prevent-empty-path-arguments-in-rgrep-find-commands.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Prevent-empty-path-arguments-in-rgrep-find-commands.pat"; filename*1="ch" >From fa2ebb275e0ec1f88e154d55022548084d442736 Mon Sep 17 00:00:00 2001 From: Phil Sainty Date: Thu, 24 Sep 2015 23:16:14 +1200 Subject: [PATCH] Prevent empty -path arguments in rgrep find commands rgrep's `grep-find-ignored-directories' conditional-ignore behaviour (for list elements which are cons cells) produces 'find' constraints like: "find . -type d \( -path -o -path \*/SCCS [...]" (i.e. a -path argument with no value) when the associated function returns nil. The nil elements need to be deleted from the list before the command line arguments are generated. --- lisp/progmodes/grep.el | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 3240ee8..452a42f 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -1039,16 +1039,18 @@ to specify a command to run." ;; we should use shell-quote-argument here " -path " (mapconcat - #'(lambda (ignore) - (cond ((stringp ignore) - (shell-quote-argument - (concat "*/" ignore))) - ((consp ignore) - (and (funcall (car ignore) dir) - (shell-quote-argument - (concat "*/" - (cdr ignore))))))) - grep-find-ignored-directories + 'identity + (delq nil (mapcar + #'(lambda (ignore) + (cond ((stringp ignore) + (shell-quote-argument + (concat "*/" ignore))) + ((consp ignore) + (and (funcall (car ignore) dir) + (shell-quote-argument + (concat "*/" + (cdr ignore))))))) + grep-find-ignored-directories)) " -o -path ") " " (shell-quote-argument ")") -- 2.1.0 --------------080801030508040608070302--