Subject: pkg/26603: mk-files overwrites files while installing (patch included)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <roland.illig@gmx.de>
List: pkgsrc-bugs
Date: 08/09/2004 12:42:44
>Number:         26603
>Category:       pkg
>Synopsis:       mk-files overwrites files while installing (patch included)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 09 11:09:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Roland Illig
>Release:        
>Organization:
>Environment:
System: Linux wwid 2.4.22-1-k7 #5 Sat Oct 4 14:11:12 EST 2003 i686 GNU/Linux
Architecture: i686

	
>Description:
when installing, mk-files may overwrite some existing files in
${PREFIX}/share/mk, but does not include them in the PLIST. The files
should not be overwritten.

>How-To-Repeat:
cd $pkgsrc/devel/mk-files && bmake package

>Fix:

NB: The old installation created some symlinks, which my patched one
does not do. So be careful applying this patch.

--- Makefile	21 Feb 2004 00:15:44 -0000	1.17
+++ Makefile	9 Aug 2004 10:37:38 -0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.17 2004/02/21 00:15:44 sjg Exp $
+# $NetBSD: Makefile,v 1.16 2004/02/02 06:40:11 sjg Exp $
 #
 
 DISTNAME=	mk-20040214
@@ -18,20 +18,24 @@
 .include "../../mk/bsd.prefs.mk"
 
 PLIST_SRC=${WRKDIR}/.PLIST_SRC
+PLIST_BASENAMES=${WRKDIR}/.PLIST_BASENAMES
 
-do-install:
-	${WRKSRC}/install-mk ${PREFIX}/share/mk
+do-install: ${PLIST_BASENAMES}
+	for f in `cat ${PLIST_BASENAMES}`; do \
+	  ${INSTALL_DATA} ${WRKSRC}/$$f ${PREFIX}/share/mk/$$f; \
+	done
 
 .include "../../mk/bsd.pkg.mk"
 
-# The logic below mimics what install-mk does.
-# Ie. it won't install a sys.mk if a standard BSD one exists
-# same goes for the bsd.*.mk files (it makes the symlinks to *.mk)
-${WRKSRC}/FILES:	extract
-${WRKDIR}/.PLIST_SRC:	${WRKSRC}/FILES
-	@( ${GREP} '^[a-z].*\.mk' $> ; \
-	[ -f /usr/share/mk/sys.mk ] || ${ECHO} sys.mk; \
-	[ -f /usr/share/mk/bsd.prog.mk ] || \
-	for f in dep doc init lib man nls obj own prog subdir; do \
-		${ECHO} bsd.$$f.mk; \
-	done ) | ${SED} 's,^,share/mk/,' > $@
+${PLIST_SRC}:		${PLIST_BASENAMES}
+	${SED} 's,^,share/mk/,' $> > $@
+
+${PLIST_BASENAMES}:	${WRKSRC}/FILES
+	@{ \
+	  ${GREP} '^[a-z].*\.mk' $> ; \
+	  ${TEST} -f /usr/share/mk/sys.mk -o -f ${PREFIX}/share/mk/sys.mk || ${ECHO} sys.mk; \
+	  ${TEST} -f /usr/share/mk/bsd.prog.mk -o -f ${PREFIX}/share/mk/bsd.prog.mk || \
+	  for f in dep doc init lib man nls obj own prog subdir; do \
+	    ${ECHO} bsd.$$f.mk; \
+	  done; \
+	} > $@
>Release-Note:
>Audit-Trail:
>Unformatted: