buggrep - Bugs: bug #35915, segfault when passing -r &...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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

Submitter:  Jonathan Hartley <tartley>
Submitted:  Tue 20 Mar 2012 06:23:35 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Wed 21 Mar 2012 12:29:55 AM UTC, comment #2: 

Thanks, that bug is fixed here:

http://git.savannah.gnu.org/cgit/grep.git/commit/?id=12c957f786b12a4dd116f9c40a715d671d17fa16

and the fix should be in the next version.

Paul Eggert <eggert>
Group Member
Tue 20 Mar 2012 06:38:01 PM UTC, comment #1: 

I've compiled source for grep 2.9 and 2.10, and can't reproduce using those, so I believe it's a real bug, and was introduced at 2.11.

Jonathan Hartley <tartley>
Tue 20 Mar 2012 06:23:35 PM UTC, original submission:  

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.

Jonathan Hartley <tartley>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #34406:  0.html added by wickedshelter34 (3KiB - text/html)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by wickedshelter34 (Updated the item)
  • -email is unavailable- added by eggert (Posted a comment)
  • -email is unavailable- added by tartley (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-07-09 wickedshelter34 Attached File- Added 0.html, #34406
    2012-03-21 eggert StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code