automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Internationalization tests: prefer `test ! -r' over `test !


From: Stefano Lattarini
Subject: Re: [PATCH] Internationalization tests: prefer `test ! -r' over `test ! -f'
Date: Mon, 6 Sep 2010 23:01:05 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]