bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #29358] segmentation fault in isdir1 with grep-2.6.1


From: Jim Meyering
Subject: Re: [bug #29358] segmentation fault in isdir1 with grep-2.6.1
Date: Sun, 28 Mar 2010 20:52:39 +0200

Javier Villavicencio wrote:
> Follow-up Comment #6, bug #29358 (project grep):
> I forgot, this one to main.c, manpage reads:
>
> --include=GLOB
>        Search  only  files whose base name matches GLOB (using wildcard
>        matching as described under --exclude).
>
> Which currently doesn't happens unless EXCLUDE_WILDCARDS is also on
> add_exclude() options:
>
> --- grep-2.6.1/src/main.c.orig
> +++ grep-2.6.1/src/main.c
> @@ -2066,7 +2066,7 @@
>        case INCLUDE_OPTION:
>       if (!included_patterns)
>         included_patterns = new_exclude ();
> -     add_exclude (included_patterns, optarg, EXCLUDE_INCLUDE);
> +     add_exclude (included_patterns, optarg, EXCLUDE_INCLUDE |
> EXCLUDE_WILDCARDS);
>       break;
>
>        case GROUP_SEPARATOR_OPTION:

Thanks, Javier,

I'll push this change in your name shortly.
(in case you haven't noticed, I prefer to correspond on bug-grep
and not on the bug tracker).

This plus an added test, plus an update-to-latest-gnulib
should solve this once and for all.

>From 11fb160b8dffddb01257a4a3cf93f9473a821e52 Mon Sep 17 00:00:00 2001
From: Javier Villavicencio <address@hidden>
Date: Sun, 28 Mar 2010 20:38:10 +0200
Subject: [PATCH] fix --include with globs, too

The previous fix addressed only the non-glob case.
* src/main.c (main): Use add_exclude's EXCLUDE_WILDCARDS option,
to enable the use of fnmatch with --include=GLOB.
---
 src/main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/main.c b/src/main.c
index e5bf50f..fe4e101 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2066,7 +2066,8 @@ main (int argc, char **argv)
       case INCLUDE_OPTION:
        if (!included_patterns)
          included_patterns = new_exclude ();
-       add_exclude (included_patterns, optarg, EXCLUDE_INCLUDE);
+       add_exclude (included_patterns, optarg,
+                    EXCLUDE_WILDCARDS | EXCLUDE_INCLUDE);
        break;

       case GROUP_SEPARATOR_OPTION:
--
1.7.0.3.448.g82eeb




reply via email to

[Prev in Thread] Current Thread [Next in Thread]