[mdlug] grep bug?
Wojtak, Greg
GregWojtak at quickenloans.com
Wed Apr 16 16:44:46 EDT 2008
This does not occur on RHEL 5.1.
[root at ql1mgt2 push]# grep -V
grep (GNU grep) 2.5.1
[root at ql1mgt2 push]# rpm -q grep
grep-2.5.1-54.2.el5
-----Original Message-----
From: mdlug-bounces at mdlug.org [mailto:mdlug-bounces at mdlug.org] On Behalf
Of Robert Citek
Sent: Wednesday, April 16, 2008 4:34 PM
To: MDLUG's Main discussion list
Subject: [mdlug] grep bug?
Hello all,
I was running grep on my Ubuntu 7.10 box the other day and came across
some rather bizarre behaviour. If I ran this grep command, everything
worked just fine:
$ echo hello | grep --color=always -e ^
However, if I make grep case-insensitive, grep seems to hang:
$ echo hello | grep -i --color=always -e ^
A little sleuthing suggests that grep is stuck in some kind of infinite
loop:
$ echo hello | grep -i --color=always -e ^ | hexdump -C | head -3
00000000 1b 5b 30 31 3b 33 31 6d 1b 5b 30 30 6d 1b 5b 30
|.[01;31m.[00m.[0|
00000010 31 3b 33 31 6d 1b 5b 30 30 6d 1b 5b 30 31 3b 33
|1;31m.[00m.[01;3|
00000020 31 6d 1b 5b 30 30 6d 1b 5b 30 31 3b 33 31 6d 1b
|1m.[00m.[01;31m.|
$ grep -V | head -1
grep (GNU grep) 2.5.1
I was wondering if folks here could confirm this behaviour on their
boxes, especially on non-Ubuntu 7.10 installs. Here it is in script
form:
$ true && (
echo hello | grep --color=always -e ^ | hexdump -C | head -1
echo hello | grep -i --color=always -e ^ | hexdump -C | head -1
)
If I run the above I get this output:
00000000 68 65 6c 6c 6f 0a |hello.|
00000000 1b 5b 30 31 3b 33 31 6d 1b 5b 30 30 6d 1b 5b 30
|.[01;31m.[00m.[0|
I would imagine that on non-affected systems one would get two lines
with "hello".
Thanks in advance for your help.
Regards,
- Robert
_______________________________________________
mdlug mailing list
mdlug at mdlug.org
http://mdlug.org/mailman/listinfo/mdlug
More information about the mdlug
mailing list