all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#21548: 25.0.50; [PATCH] Prevent empty -path arguments for not-ignored directories in rgrep's find commands
@ 2015-09-24 11:28 Phil Sainty
  2015-09-30  7:43 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Sainty @ 2015-09-24 11:28 UTC (permalink / raw)
  To: 21548

[-- Attachment #1: Type: text/plain, Size: 565 bytes --]

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.



[-- Attachment #2: 0001-Prevent-empty-path-arguments-in-rgrep-find-commands.patch --]
[-- Type: text/x-patch, Size: 2345 bytes --]

From fa2ebb275e0ec1f88e154d55022548084d442736 Mon Sep 17 00:00:00 2001
From: Phil Sainty <psainty@orcon.net.nz>
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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-30  7:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-24 11:28 bug#21548: 25.0.50; [PATCH] Prevent empty -path arguments for not-ignored directories in rgrep's find commands Phil Sainty
2015-09-30  7:43 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.