[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #21342] grep --colour=yes -i ".*" hangs forever (+patch)
From: |
spiritus |
Subject: |
[bug #21342] grep --colour=yes -i ".*" hangs forever (+patch) |
Date: |
Sun, 14 Oct 2007 22:22:55 +0000 |
User-agent: |
Opera/9.23 (X11; Linux i686; U; en) |
URL:
<http://savannah.gnu.org/bugs/?21342>
Summary: grep --colour=yes -i ".*" hangs forever (+patch)
Project: grep
Submitted by: spiritus999
Submitted on: Воскресенье 14.10.2007 at 22:22
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
I have accidently found, that there is a proble with grep 2.5.1a and early
versions having --colour support. It hangs on the following test case:
echo test|grep --colour=yes -i ".*"
It loops forever in the while-loop at grep-2.5.1a/src/grep.c beginning from
line 570:
while ((match_offset = (*execute) (ibeg, ilim-ibeg, &match_size,
1))
!= (size_t) -1)
{
char const *b = beg + match_offset;
if (b == lim)
break;
fwrite (beg, sizeof (char), match_offset, stdout);
printf ("\33[%sm", grep_color);
fwrite (b, sizeof (char), match_size, stdout);
fputs ("\33[00m", stdout);
beg = b + match_size;
ibeg = ibeg + match_offset + match_size;
}
gdb show that match_offset=0, so b = beg and it and it loops forever, because
match_offset != -1 and b != lim.
It seems there is a fix for the same problem, but for different situation
when (match_icase==0) i.e. grep --colour without switch "-i".
Suggested patch attached.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Воскресенье 14.10.2007 at 22:22 Name:
grep_colorize_fix.patch Size: 649B By: spiritus999
<http://savannah.gnu.org/bugs/download.php?file_id=14142>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?21342>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug #21342] grep --colour=yes -i ".*" hangs forever (+patch),
spiritus <=