spy: "rm -f" and "rm -rf" without args are portable
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 22 Feb 2012 13:27:17 +0000 (14:27 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 22 Feb 2012 13:27:17 +0000 (14:27 +0100)
commit2dfeef41c3a2045a6f54a75f710b8d7b930d4471
tree320e6e97abb724e4b7fa9914971980336a23cff9
parent66873b596119fc691f1b1c05aa6d09f2ff1b5849
spy: "rm -f" and "rm -rf" without args are portable

According to recent testing by Eric Blake, it seems that all
non-museum rm(1) implementations don't complain if called without
file operands, *if* the '-f' option is used.  This behaviour will
likely be mandated by future versions of the POSIX standard as
well.

We'd like to start assuming this rm(1) behaviour in future Automake
releases, in order to simplify some automake-provided cleanup rules.
So, for the moment, we add a new "spy" test in our test suite, to
try ensuring that all the rm(1) implementation we encounter "in the
wild" truly behaves as expected in this regard.

For more references, see this discussion on the bug-autoconf list:
 <http://lists.gnu.org/archive/html/bug-autoconf/2012-02/msg00002.html>
which sprang from coreutils bug#10819:
 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10819>
and brought to the POSIX issue#542:
 <http://austingroupbugs.net/view.php?id=542>
which has been accepted and will ensure that future version of the
POSIX standards will mandate that 'rm' shouldn't complain if called
without file operands, when the '-f' option is in use.

* tests/spy-rm.test: New test.
* tests/list-of-tests.mk: Add it.
tests/list-of-tests.mk
tests/spy-rm.tap [new file with mode: 0755]