Bug 42276 - egrep is failing to parse regular expression
Summary: egrep is failing to parse regular expression
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: grep
Version: 1.0
Hardware: i386
OS: Linux
high
high
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-05-25 14:38 UTC by Jaroslaw Sosnicki
Modified: 2005-10-31 22:00 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-05-31 20:18:04 UTC
Embargoed:


Attachments (Terms of Use)
List of all packages installed on my system. (10.25 KB, text/plain)
2001-05-31 16:10 UTC, Jaroslaw Sosnicki
no flags Details

Description Jaroslaw Sosnicki 2001-05-25 14:38:59 UTC
Description of Problem:
grep-2.5e-3.i386.rpm egrep is failing to parse requlare expression.
Version grep-2.5e-2.i386.rpm works.

How Reproducible:
Rebuild apache-1.3.20-1.src.rpm with add-module statement in spec file
Line 705 of /usr/src/redhat/BUILD/apache_1.3.20/configure does not return
any file name

Steps to Reproduce:
1.  rpm -Uvh apache-1.3.20-1.src.rpm
1a.  I apply the folowing patch file to apache.spec
---
9c9
< Release: 1.1
---
> Release: 1
31d30
< Patch8: apache_1.3.19-fp.patch
108d106
< %patch8 -p0 -b .fp
142,143d139
<       --add-module=mod_frontpage.c \
<       --disable-shared=frontpage \
---
2.  rpm -bb /usr/src/redhat/SPECS/apache.spec
3. 

Actual Results:


Expected Results:


Additional Information:

Comment 1 Bernhard Rosenkraenzer 2001-05-28 14:43:10 UTC
Please provide more info (what expression is passed to grep? Does 2.5e-4 fix 
the problem? What exactly happens? Does grep simply not return anything or 
does it segfault?), since I don't have the fp patch.


Comment 2 Enrico Scholz 2001-05-28 16:46:21 UTC
Here the compilation of apache does some unexpected things in the ./configure of
mm-1.1.3:

-------------
checking whether ln -s works... yes
checking for ld used by GCC... egrep: fstat: Value too large for defined data
type
/usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... egrep: fstat: Value too large
for defined data type
no
checking whether the linker (/usr/bin/ld) supports shared libraries... no
checking for BSD-compatible nm... egrep: fstat: Value too large for defined data
type
egrep: fstat: Value too large for defined data type
/usr/bin/nm
checking command to parse /usr/bin/nm output... egrep: fstat: Value too large
for defined data t
...
-----------------


The critical command seems to be

$ /usr/bin/ld -v | egrep '(GNU|with BFD)'
egrep: fstat: Value too large for defined data type


Sometimes the command above works as expected, sometimes not.

strace'ing says:

------ bad -----
execve("/bin/egrep", ["egrep", "(GNU|with BFD)"], [/* 43 vars */]) = 0
uname({sys="Linux", node="kosh.ultra.csn.tu-chemnitz.de", ...}) = 0
brk(0)                                  = 0x80619d0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x40016000
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=84338, ...}) = 0
old_mmap(NULL, 84338, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40017000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\250\301"..., 1024) =
1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=5606962, ...}) = 0
old_mmap(NULL, 1224552, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4002c000
mprotect(0x4014e000, 36712, PROT_NONE)  = 0
old_mmap(0x4014e000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x121000) = 0x4014e000
old_mmap(0x40153000, 16232, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40153000
close(3)                                = 0
munmap(0x40017000, 84338)               = 0
getpid()                                = 14433
brk(0)                                  = 0x80619d0
brk(0x80619f8)                          = 0x80619f8
brk(0x8062000)                          = 0x8062000
brk(0x8063000)                          = 0x8063000
brk(0x806d000)                          = 0x806d000
fstat64(0, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
write(2, "egrep: ", 7egrep: )                  = 7
write(2, "fstat", 5fstat)                    = 5
write(2, ": Value too large for defined da"..., 39: Value too large for defined
data type) = 39
write(2, "\n", 1
)                       = 1
close(1)                                = 0
_exit(1)                                = ?
-----------------------------

and

---------- good ---------------
execve("/bin/egrep", ["egrep", "(GNU|with BFD)"], [/* 42 vars */]) = 0
uname({sys="Linux", node="kosh.ultra.csn.tu-chemnitz.de", ...}) = 0
brk(0)                                  = 0x80619d0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x40016000
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=84338, ...}) = 0
old_mmap(NULL, 84338, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40017000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\250\301"..., 1024) =
1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=5606962, ...}) = 0
old_mmap(NULL, 1224552, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4002c000
mprotect(0x4014e000, 36712, PROT_NONE)  = 0
old_mmap(0x4014e000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x121000) = 0x4014e000
old_mmap(0x40153000, 16232, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40153000
close(3)                                = 0
munmap(0x40017000, 84338)               = 0
getpid()                                = 14214
brk(0)                                  = 0x80619d0
brk(0x80619f8)                          = 0x80619f8
brk(0x8062000)                          = 0x8062000
brk(0x8063000)                          = 0x8063000
brk(0x806d000)                          = 0x806d000
fstat64(0, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
read(0, "GNU ld version 2.10.91 (with BFD"..., 32768) = 46
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 7), ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x40017000
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "GNU ld version 2.10.91 (with BFD"..., 46GNU ld version 2.10.91 (with
BFD 2.10.91.0.2)
) = 46
read(0, "", 32768)                      = 0
close(1)                                = 0
munmap(0x40017000, 4096)                = 0
_exit(0)                                = ?
-----------------------------

It looks like an uninitialized variable or a test against errno without checking
the return-value.

I have tested against grep-2.5e-3 only; -4 is not on ftp yet.


Info:

$ rpm -q glibc
glibc-2.2.3-9



Comment 3 Jaroslaw Sosnicki 2001-05-28 17:41:56 UTC
The reason why I discovered this problem is because I was addint additional
modules to apache and rebuilding apache from source rpm
/usr/src/redhat/BUILD/apache_1.3.20/configure
... line 705
       --add-module=*) 
            file="$apc_optarg"
            if [ "x`echo $file | egrep '/?mod_[a-zA-Z0-9][a-zA-Z0-9_]*\.c$'`" =
"x" ]; then
                echo "configure:Error: Module filename doesn't match
'/?mod_[a-zA-Z0-9][a-zA-Z0-9_]*\.c'" 1>&2
                exit 1
            fi
            if [ ! -f $file ]; then
                echo "configure:Error: Module source $file not found" 1>&2
                exit 1
            fi 
....

Comment 4 Enrico Scholz 2001-05-29 09:05:27 UTC
The issue I have seen is a kernel-bug (unitialized inode::i_blocks attribute)
which is fixed in the -ac kernels.

Comment 5 Bernhard Rosenkraenzer 2001-05-31 07:47:51 UTC
Closing as NOTABUG because it's not a bug in grep.


Comment 6 Jaroslaw Sosnicki 2001-05-31 15:49:51 UTC
I don't buy it that this is a kernel related problem.

What is the diffrence between grep-2.5e-4.i386.rpm and grep-2.4.2-5.i386.rpm
that would cause egrep regular expression option not work at all (no error and
no output)

grep-2.5e-4.i386.rpm still has a problem as described above, even when running
with kernels listed below.

The grep-2.4.2-5.i386.rpm version works with kernels listed below:

rkernel-enterprise-2.4.3-7
kernel-2.4.5-0.2.9
kernel-enterprise-2.4.5-0.2.9
kernel-enterprise-2.4.5-0.2

I am running the folowing kernel:
[root@ns2 apache]# uname -a
Linux ns2 2.4.5-0.2enterprise #1 SMP Sun May 27 16:55:37 EDT 2001 i686 unknown


Comment 7 Bernhard Rosenkraenzer 2001-05-31 16:00:42 UTC
I can't reproduce it on a full rawhide system in any case, so I'm assuming 
it's a config issue, or related to some other package you installed. (glibc is 
a possibility).


Comment 8 Jaroslaw Sosnicki 2001-05-31 16:10:36 UTC
Created attachment 20035 [details]
List of all packages installed on my system.

Comment 9 Bernhard Rosenkraenzer 2002-01-22 12:58:43 UTC
Still can't reproduce this (grep 2.5-0.f.5), assuming it's fixed.


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