Source-Changes-HG archive

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

[src/trunk]: src/share/mk On second thoughts, don't run "rm -rf" in bsd.clean...



details:   https://anonhg.NetBSD.org/src/rev/76a67e967a92
branches:  trunk
changeset: 782763:76a67e967a92
user:      apb <apb%NetBSD.org@localhost>
date:      Mon Nov 19 16:04:54 2012 +0000

description:
On second thoughts, don't run "rm -rf" in bsd.clean.mk.  Instead,
document that CLEANFILES and CLEANDIRFILES must not contain
directory names.

diffstat:

 share/mk/bsd.README   |   7 ++++++-
 share/mk/bsd.clean.mk |  12 +++++++++---
 2 files changed, 15 insertions(+), 4 deletions(-)

diffs (57 lines):

diff -r 573c5f75230e -r 76a67e967a92 share/mk/bsd.README
--- a/share/mk/bsd.README       Mon Nov 19 15:14:27 2012 +0000
+++ b/share/mk/bsd.README       Mon Nov 19 16:04:54 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.README,v 1.307 2012/11/13 22:30:38 pooka Exp $
+#      $NetBSD: bsd.README,v 1.308 2012/11/19 16:04:54 apb Exp $
 #      @(#)bsd.README  8.2 (Berkeley) 4/2/94
 
 This is the README file for the make "include" files for the NetBSD
@@ -904,6 +904,11 @@
 
            .include <bsd.clean.mk>
 
+The files listed in CLEANFILES and CLEANDIRFILES must not be
+directories, because the potential risk from running "rm -rf" commands
+in bsd.clean.mk is considered too great.  If you want to recursively
+delete a directory as part of "make clean" or "make cleandir" then you
+need to provide your own target.
 
 =-=-=-=-=   bsd.dep.mk   =-=-=-=-=
 
diff -r 573c5f75230e -r 76a67e967a92 share/mk/bsd.clean.mk
--- a/share/mk/bsd.clean.mk     Mon Nov 19 15:14:27 2012 +0000
+++ b/share/mk/bsd.clean.mk     Mon Nov 19 16:04:54 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.clean.mk,v 1.7 2012/11/19 15:14:27 apb Exp $
+# $NetBSD: bsd.clean.mk,v 1.8 2012/11/19 16:04:54 apb Exp $
 
 # <bsd.clean.mk>
 #
@@ -15,10 +15,16 @@
 #              the clean target.
 #
 # MKCLEANSRC   Whether or not to clean the source directory
-#              in addition to the object directory.
+#              in addition to the object directory.  Defaults to "yes".
 #
 # MKCLEANVERIFY        Whether or not to verify that the file deletion worked.
+#              Defaults to "yes".
 #
+# The files listed in CLEANFILES and CLEANDIRFILES must not be
+# directories, because the potential risk from running "rm -rf" commands
+# in bsd.clean.mk is considered too great.  If you want to recursively
+# delete a directory as part of "make clean" or "make cleandir" then you
+# need to provide your own target.
 
 .if !defined(_BSD_CLEAN_MK_)
 _BSD_CLEAN_MK_=1
@@ -62,7 +68,7 @@
                :? ${.OBJDIR} \
                :  ${.OBJDIR} ${.CURDIR} }
        ${"${.ALLSRC:@v@${${v}:M*}@:Q}" == "":?@true: \
-           (cd ${_d} && rm -rf ${.ALLSRC:@v@${${v}}@} || true) }
+           (cd ${_d} && rm -f ${.ALLSRC:@v@${${v}}@} || true) }
 .if "${MKCLEANVERIFY}" == "yes"
        @${"${.ALLSRC:@v@${${v}:M*}@:Q}" == "":?true: \
            bad="\$(cd ${_d} && ls -1d ${.ALLSRC:@v@${${v}}@} 2>/dev/null)"; \



Home | Main Index | Thread Index | Old Index