Eric Blake wrote: > On 11/20/2011 06:11 AM, Bruno Haible wrote: >> Fix test failures on OSF/1 5.1. >> * tests/ignore-mmap: Pass a regular file, not /dev/null, to 'compare'. >> * tests/max-count-vs-context: Likewise. > > Autoconf learned that it is always more efficient to use 'test -s file' > rather than comparison against /dev/null when you are checking for > (non-)emptiness (one less fork, and in the case of buggy compare that > can't handle /dev/null, one less portability problem). > >> +++ tests/max-count-vs-context 2011-11-20 14:08:59.000000000 +0100 >> @@ -13,11 +13,12 @@ >> EOF >> >> sed 4q in > exp || framework_failure_ >> +: > errexp || framework_failure_ >> >> fail=0 >> grep -m1 -A5 needle in > out 2>err || fail=1 >> >> compare out exp || fail=1 >> -compare err /dev/null || fail=1 >> +compare err errexp || fail=1 > > That is, rather than creating an empty errexp, I'd rather see this test > rewritten to use a form of test -s.
How about having compare "know" about /dev/null. Then it can perform the test -s and warn if the file is nonempty. With that, all existing (and there are many) /dev/null-using compare uses will benefit.
