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]>
Hi Julien,

        https://lists.gnu.org/archive/html/automake-patches/2018-03/index.html

Thanks for bringing them up again. I wasn't involved with automake back
then, but looking at them now, they seem mostly fine. The one that seems
too risky is making -c do something (preserve permissions) instead of
being a no-op. I think there could easily be ancient calls of install-sh
that use -c, and changing behavior now doesn't seem good. We could
invent a new option (-p I suppose) to do it.

The one that omits chown-ing of pre-existing directories also worries me
a bit (the one below). I can imagine a scenario where people installed
as root and chowned to some specific user. OTOH, I agree it seems
cleaner (not to touch existing directories.

Over the next days, I'll try installing these changes (one at a time)
and making sure the test suite still runs ok. Will keep you posted.
Thanks again. --karl


--- install-sh.orig	2018-03-17 14:18:08.701045461 +0100
+++ install-sh.useless-chown	2018-03-17 14:29:16.924781085 +0100
@@ -255,6 +255,10 @@
     dstdir=$dst
     test -d "$dstdir"
     dstdir_status=$?
+    # Don't chown directories that already exist.
+    if test $dstdir_status = 0; then
+      chowncmd=""
+    fi
   else
 
     # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
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.