Re: [PATCH] install-sh: Fix redundant use of the force option with the rm command

Karl Berry <[email protected]>
Newsgroups gmane.comp.sysutils.automake.patches
Message-ID <[email protected]>
    https://lists.gnu.org/archive/html/automake-patches/2018-03/msg00005.html
    
    As install-sh defines $rmcmd as "$rmprog -f", it is not necessary to add
    a second "-f" when calling the rm command.

I just installed this change, with a mention in the --help message
(and NEWS file) about the implication. Maybe overkill, but since it's a
change in behavior, it seemed prudent to me to be explicit about it.
--thanks, karl.

index b34a8fc..2915ff0 100755
--- a/lib/install-sh
+++ b/lib/install-sh
@@ -115,6 +115,9 @@ Options:
 Environment variables override the default commands:
   CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
   RMPROG STRIPPROG
+
+By default, rm is invoked with -f; when overridden with RMPROG,
+it's up to you to specify -f if you want it.
 "

 while test $# -ne 0; do
@@ -487,9 +490,9 @@ do
         # file should still install successfully.
         {
           test ! -f "$dst" ||
-          $doit $rmcmd -f "$dst" 2>/dev/null ||
+          $doit $rmcmd "$dst" 2>/dev/null ||
           { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
-            { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+            { $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
           } ||
           { echo "$0: cannot unlink or rename $dst" >&2
             (exit 1); exit 1

compile finished at Tue Nov 10 17:48:35 2020
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.