bug-grep
[Top][All Lists]
Advanced

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

[bug #35915] segfault when passing -r & --exclude-dir & piping in data


From: Jonathan Hartley
Subject: [bug #35915] segfault when passing -r & --exclude-dir & piping in data
Date: Tue, 20 Mar 2012 18:23:36 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11.0) Gecko/20100101 Firefox/11.0

URL:
  <http://savannah.gnu.org/bugs/?35915>

                 Summary: segfault when passing -r & --exclude-dir & piping in
data
                 Project: grep
            Submitted by: tartley
            Submitted on: Tue 20 Mar 2012 06:23:35 PM GMT
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Hey. Longtime user, first time posting.

If I pipe data on stdin, and pass '-r' and '--exclude-dir' flags, then I get a
segfault. e.g:

$ ls | grep -r --exclude-dir=X pattern
Segmentation fault

My understanding is that both these flags are meaningless when piping in data,
so a viable workaround is simply "don't do that." However, for many years I
have invoked grep via a command-line alias (or wrapper script) to set a few
common options (such as "--exclude-dir=\.git"). This same alias gets used
regardless of whether I'm invoking grep on files, or on piped data.

Incidentally, I don't think I can use GREP_OPTIONS to do this because this
breaks tools I run which call grep internally.

I compiling from source for grep 2.11.

I'm compiling on OSX, using:
$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)

I also see the same beheviour when installing grep using Homebrew (which is
also compiling grep v2.11)

The corefiles look like:

$ gdb grep /cores/core.31786
GNU gdb 6.3.50-20050815 (Apple version gdb-1515) (Sat Jan 15 08:33:48 UTC
2011)
...
This GDB was configured as "x86_64-apple-darwin"
...
#0  0x00007fff8897ac00 in strlen ()
(gdb) bt
#0  0x00007fff8897ac00 in strlen ()
#1  0x0000000100015576 in excluded_file_name (ex=0x1001005a0, f=0x0) at
exclude.c:445
#2  0x0000000100012305 in grepdir (dir=0x0, stats=0x100048620) at main.c:1364
#3  0x0000000100014048 in main (argc=11, argv=0x7fff5fbff0b8) at main.c:2216

I can supply the corefile or any other info if that helps.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?35915>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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