Aki Helin wrote: > For some reason Grep appears to occasionally exit with 0 even when there > was no match. This could also be bug Bash, but I wasn't able to reproduce > this with other programs, and the failure seems to be more common with > some patterns, or pairs of a pattern and an input, which would suggest > that the issue is in Grep. > > The following is enough to eventually reproduce this on Debian 6.0.4 > (x86_64) using the included version (GNU grep 2.6.3) and 2.10 from > ftp.gnu.org. The shell is Bash is version 4.1.5(1)-release. > > $ wget haltp.org/aoh/misc/cout.sh > $ while true; do grep RANDOM cout.sh && date; done > > Nothing should happen, but I'm getting occasional dates as in > > $ while true > > do > > grep -q RANDOM tests/cout.sh && date > > done > Wed Feb 8 05:52:23 EET 2012 > Wed Feb 8 06:28:02 EET 2012 > > and for Grep 2.10 > > $ while true; do $HOME/opt/grep/bin/grep RANDOM tests/cout.sh && date; done > Wed Feb 8 14:56:00 EET 2012 > > Can anyone reproduce this, and if so, does it look like a Grep thing or > something else?
Can you reproduce that on more than one system? With such low frequency, I would suspect your system's RAM or other hardware. I had a system that was 100% reliable for about six years, but then a few of the big capacitors near the CPU began (very slowly) to bulge and even to leak a little. By the time 5 or 6 were bulging, I began to see errors and the occasional crash, usually only accompanying heavy disk or network activity. I've started one of your loops on a debian unstable system using grep-2.10 and zsh. I will let it run for a few hours.
