On Monday 06 September 2010, Bruno Haible wrote: > Hi Stefano, > > > Internationalization tests: prefer `test ! -r' over `test ! -f' > > Why? Why is it more important to check that an expected file has > read permissions, than to check that it is a regular file? Just in case the file is erroneously created as (say) a directory or a symlink, a situation `test -f' would not catch. > This is not an objection. I just find it odd to use 'test -f' for > the positive test and 'test ! -r' for the negative one. Because in the positive test we want to make sure the file is created as a regular file, while in the negative test we want to make sure the file is not created at all.
That said, with this sentence: ``Why? Why is it more important to check that an expected file has read permissions, than to check that it is a regular file?'' you have a point IMO. In the long run, it would be better to define a (say) `file_not_exist' subroutine in tests/defs, which could use "test ! -e FILE" on decent shells and something like "test ! -f FILE && test ! -d FILE && test ! -r FILE" on dumber shells. Then we can use that subroutine instead of the suboptimal `test ! -r'. > Technically the patch is OK with me. OK, thanks. Regards, Stefano