Bug 112869 - grep -iE segfaults using \W unless LANG=C
Summary: grep -iE segfaults using \W unless LANG=C
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 1
Hardware: athlon
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-01-04 22:09 UTC by Davide Bolcioni
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-01-14 15:49:44 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2004:083 0 normal SHIPPED_LIVE Updated grep package speeds UTF-8 searching 2004-03-18 05:00:00 UTC
Red Hat Product Errata RHBA-2004:143 0 normal SHIPPED_LIVE GNU C Library bugfix update 2004-05-11 04:00:00 UTC
Red Hat Product Errata RHBA-2004:212 0 normal SHIPPED_LIVE Updated shadow-utils package available 2004-05-11 04:00:00 UTC
Red Hat Product Errata RHBA-2004:213 0 normal SHIPPED_LIVE Updated ypserv package available 2004-05-11 04:00:00 UTC

Description Davide Bolcioni 2004-01-04 22:09:03 UTC
Description of problem: Attempting to use grep -iE with \W in the 
pattern segfaults with LANG=it_IT, but not with LANG=C.


Version-Release number of selected component (if applicable): 2.5.1-17.4

How reproducible: Always


Steps to Reproduce:
1. echo '<form>' | LANG=it_IT grep -iE '\Wform\W' segfaults
2.
3.
  
Actual results: segfaults.


Expected results: no segfault and outputs <form>.


Additional info:  echo '<form>' | LANG=C grep -iE '\Wform\W' does not
segfault and works as expected.

Comment 1 Davide Bolcioni 2004-01-04 22:10:18 UTC
If -i is omitted, works as expected.

Comment 2 Tim Waugh 2004-01-05 12:15:13 UTC
This seems to be a glibc bug, as shown by:

#include <locale.h>
#include <regex.h>
#include <ctype.h>
int main (void)
{
  struct re_pattern_buffer re = { 0 };
  unsigned char trans[256];
  int i;
  setlocale (LC_ALL, "en_GB");
  for (i = 0; i < 256; ++i) trans[i] = tolower (i);
  re.translate = trans;
  re_set_syntax (RE_SYNTAX_POSIX_EGREP);
  re_compile_pattern ("\\W", 2, &re);
}

However, I have built grep-2.5.1-24 with a work-around to avoid this bug.

Changing component to glibc and reassigning.

Comment 3 Jakub Jelinek 2004-01-14 15:49:44 UTC
Should be fixed in glibc-2.3.2-101.4.


Note You need to log in before you can comment on or make changes to this bug.