Subject: POSIX will say running "rm -f" with no argument is OK

From: Stefano Lattarini <[email-masked]>
Date: Thu, 16 Feb 2012 21:41:03 +0100

Severity: wishlist

[CC:ing bug-automake, so that we won't forget about this issue]

Reference:
  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10819#40>

POSIX will say in a future version that running "rm -f" with no argument is OK;
we might simplify several automake-generated "cleaning" rules accordingly, to
get rid of the awful idiom:

  test -z "$(VAR)" || rm -f $(VAR)

On 02/16/2012 08:15 PM, Philip Rowlands wrote:
> On 16/02/2012 18:58, Eric Blake wrote:
> 
>>> so that we could simplify a bunch of automake recipes); but a more extensive
>>> probing is needed in this matter I guess.  And if you are right (as I hope),
>>> then this 'rm' feature could be documented in the Autoconf manual.
>>
>> Yep, I think that's appropriate, as it is unlikely that we will come up
>> with any counterexamples any time soon.
> 
> As the now-POSIX-infringing behaviour is simple to detect, couldn't automake detect
> it early and die with a helpful message, or is that contrary to its philosophy?
>
Well, that might be an overkill, since it appears that all the non-museum
implementations of 'rm' have the behaviour we want.  But I agree that, in case
we ever stumble upon a system violating this new expectation, adding proper
configure-time probing and warning might be helpful (and might convince the
users of such an inferior system to start using GNU coreutils).

Regards,
  Stefano