Aki Helin wrote: > Jim Meyering <[email protected]> wrote: > >> 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. >> > [..] >> >> 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. > > Yes, this happens on several computers. I also suspected hardware issues > at first, but this seems to depend too much on what the software does, > and there have been no issues apart from this on any of the machines. > > >> 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. > > I left several loops running on several equal machines overnight to get > some more data. The machines are running 64-bit Debian stable and have > Atom CPUs, so they're a bit slower than typical desktops. > > Machine 1, Bash, Grep 2.6.3 > - Loop 1: 1 date > - Loop 2: 4 dates > - Loops 3 and 4 reading from stdin: 0 dates > > Machine 2, Dash, Grep 2.6.3 > - Loop 1: 0 dates > - Loop 2: 1 segfault (will drop core next time if this happens again) > > Machine 3, Bash, Grep 2.10 > - Loop 1: 5 dates > - Loop 2: 6 dates > - Loop 3: 3 dates > - Loop 4 reading from stdin: 0 dates
Compiled with which compiler? Could it be that your Atom-based systems are sometimes too hot? After 1.5 hours with zsh, and no output, I've switched to bash and dash in separate windows (it's a 4-core x86_64 system): bash -c 'while :; do grep RANDOM cout.sh && date; done' dash -c 'while :; do grep RANDOM cout.sh && date; done' > Machine 4, Bash, Grep 2.10 compiled with Clang & AddressSanitizer > - Loops 1, 2 and 3: 0 dates > > Machine 5, Zsh, Grep 2.6.3 > - Loops 1, 2 and 3: 0 dates > > I also had a few similar loops running in Bash comparing two files with > cmp, but all return values stayed nonzero as expected.
