Comment 5 for bug 996483

Revision history for this message
Alexey Kopytov (akopytov) wrote : Re: False positive testsuite failures with grep 2.10+

It turns out the failures are a result of a bug in grep itself. All failing tests except 2 do the correct thing: they use -q which supresses the output, so grepping the same file where the output is redirected is not a problem, because grep itself generates no output.

However, grep version shipped with Ubuntu 12.04 is buggy and fails even when -q is specified. The bug was fixed in grep 2.11:

" grep no longer rejects "grep -qr . > out", i.e., when run with -q
  and an input file is the same as the output file, since with -q
  grep generates no output, so there is no risk of infinite loop or
  of an output-affecting race condition. Thus, the use of the following
  options also disables the input-equals-output failure:
    --max-count=N (-m) (for N >= 2)
    --files-with-matches (-l)
    --files-without-match (-L)
  [bug introduced in grep-2.10]"

So fixing those 2 tests that do not use -q will not help, as all tests using grep will still be failing on Ubuntu 12.04. The workaround is to redirect the output to /dev/null.