bug-grep
[Top][All Lists]
Advanced

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

updated info for earlier report about -P option


From: Chris Stith
Subject: updated info for earlier report about -P option
Date: Fri, 27 Jan 2006 12:36:37 -0600

The options

# grep -P '\?\s' filename

segfaults and coredumps when the file consists of the single character '?'.

###############

I got this from gdb:

# gdb --args /bin/grep -P '\?\s' bar
GNU gdb 6.3-5mdk (Mandriva Linux release 2006.0)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-mandriva-linux-gnu"...(no debugging
symbols found)
Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) run
Starting program: /bin/grep -P \\\?\\s bar
Reading symbols from shared object read from target memory...(no
debugging symbols found)...done.
Loaded system supplied DSO at 0xffffe000
(no debugging symbols found)
(no debugging symbols found)

Program received signal SIGSEGV, Segmentation fault.
0xb7ef5c4a in pcre_exec () from /lib/libpcre.so.0
(gdb) q


###############

This PHP program works as expected:
<?php
        $file = $argv[1];
        $content = file_get_contents ( $file );
        if ( preg_match ( '/\?>\s/', $content ) ) {
                print 'matched!' . "\n";
        }
?>

PHP uses PCRE for the Perl-compatible regex functions it offers.

################

I hope this helps.




reply via email to

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