This service will be undergoing maintenance at 20:00 UTC, 2017-04-03. It is expected to last about 30 minutes
Bug 112869 - grep -iE segfaults using \W unless LANG=C
grep -iE segfaults using \W unless LANG=C
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
1
athlon Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-01-04 17:09 EST by Davide Bolcioni
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-01-14 10:49:44 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Davide Bolcioni 2004-01-04 17:09:03 EST
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 17:10:18 EST
If -i is omitted, works as expected.
Comment 2 Tim Waugh 2004-01-05 07:15:13 EST
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 10:49:44 EST
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.