Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: user/3353: egrep -f fails on sparc64 with bus and segmentation faults

From: Brian Poole <raj(at)cerias.purdue.edu>
Date: Wed Jul 16 2003 - 12:45:03 EDT


The following reply was made to PR user/3353; it has been noted by GNATS.

From: Brian Poole <raj@cerias.purdue.edu> To: gnats@openbsd.org
Cc: mg@trash.net
Subject: Re: user/3353: egrep -f fails on sparc64 with bus and segmentation faults Date: Wed, 16 Jul 2003 11:29:21 -0500

 Quoting Mathias Gygax (mg@trash.net) from 16 July 2003:
> >Number: 3353
 

>From the quick look I took, I think its reallocing with the wrong size
 per member.. maybe wrong but changing a sizeof(int) -> sizeof(char*)  worked for me. Someone care to take a look? Patch is included at the  end. Would fit with it breaking on sparc64 & not i386.  

> Core was generated by `egrep'.
> Program terminated with signal 11, Segmentation fault.
> #0 0x10226c in ?? ()
> (gdb) bt
> #0 0x10226c in ?? ()
> #1 0x1022f0 in ?? ()
> #2 0x1028f4 in ?? ()
> #3 0x101564 in ?? ()
>
> if you need a backtrace wtih debugging symbols, let me know. this only
> happens on my sparc64 machine. i386 with current is not affected as i
> can confirm that logsentry does work properly on my two i386 boxes.
 

 Here is a better trace.. You would probably find that debugging symbols  would just cause gdb insystem to core on you ;-)  

 Program received signal SIGSEGV, Segmentation fault.  0x00000000001027c4 in add_pattern (

     pat=0x70c84e "accountment\naccouple\naccouplement\naccouter\naccouterment\naccoy\naccredit\naccreditate\naccreditation\naccredited\naccreditment\naccrementitial\naccrementition\naccresce\naccrescence\naccrescent\naccretal\naccrete\n"..., len=11) at /usr/src/usr.bin/grep/grep.c:175
 175             pattern[patterns] = grep_malloc(len + 1);
 (gdb) bt
 #0 0x00000000001027c4 in add_pattern (

     pat=0x70c84e "accountment\naccouple\naccouplement\naccouter\naccouterment\naccoy\naccredit\naccreditate\naccreditation\naccredited\naccreditment\naccrementitial\naccrementition\naccresce\naccrescence\naccrescent\naccretal\naccrete\n"..., len=11) at /usr/src/usr.bin/grep/grep.c:175

 #1  0x00000000001029d0 in read_patterns (fn=0xffffffffffffc012 "/usr/share/dict/words") at /usr/src/usr.bin/grep/grep.c:206
 #2  0x00000000001036f0 in main (argc=4, argv=0xffffffffffffbb78) at /usr/src/usr.bin/grep/grep.c:360
 #3  0x00000000001015ec in ___start ()
 
 
Do you need help?X

 Index: grep.c



 RCS file: /cvs/src/usr.bin/grep/grep.c,v  retrieving revision 1.21
 diff -u -r1.21 grep.c
  • grep.c 14 Jul 2003 23:22:35 -0000 1.21 +++ grep.c 16 Jul 2003 16:23:54 -0000 @@ -167,7 +167,7 @@ } if (patterns == pattern_sz) { pattern_sz *= 2;
    • pattern = grep_realloc(pattern, ++pattern_sz * sizeof(int)); + pattern = grep_realloc(pattern, ++pattern_sz * sizeof(char *)); } if (pat[len - 1] == '\n') --len;
Received on Wed Jul 16 13:04:08 2003

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:30:00 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library