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.
If -i is omitted, works as expected.
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.
Should be fixed in glibc-2.3.2-101.4.