ports/75379: [patch] bsd.port.mk / add-plist-docs is too relaxed

Edwin Groothuis edwin at mavetju.org
Wed Dec 22 05:30:30 UTC 2004


>Number:         75379
>Category:       ports
>Synopsis:       [patch] bsd.port.mk / add-plist-docs is too relaxed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 22 05:30:29 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Edwin Groothuis
>Release:        FreeBSD 5.2.1-RELEASE i386
>Organization:
-
>Environment:
System: FreeBSD k7.mavetju 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #7: Tue Sep 21 23:13:39 EST 2004 root at k7.mavetju:/usr/src-5.2.1/sys/i386/compile/k7 i386

>Description:

Today I had a port which installed its docs into
/usr/local/share/docs/blaat. At least, that was the expected
behaviour. What the port did not do was creating that directory
first, and thus was copying the files over the file
/usr/local/share/docs/blaat each time.

All with all very annoying, and I was surprised that the ports
framework didn't alert me about it while running "make deinstall".

When looking at add-plist-docs, it only adds the files in PORTDOCS
which it can find (although find(1) gives a warning it is /dev/nulled).
At the end of it only adds the DOCSDIR if it is a directory.


Although it is a discussion issue to start with, it is my opinion
that the variables set in the ports Makefile have to be correct.
And if they are not, bsd.port.mk should warn us about them being
wrong (USE_LIBTOOL_VER=14 is a nice example) instead of being Mr
Nice Guy and fix it behind our backs.

>How-To-Repeat:

Checkout ports/dns/sqldjbdns/Makefile revision 1.1, and wonder why
an install / deinstall you have a file called
/usr/local/share/docs/sqldjbdns leftover.

>Fix:

This will make bsd.port.mk / add-plist-docs less tolerant to
mistakes.

Index: bsd.port.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.501
diff -u -r1.501 bsd.port.mk
--- bsd.port.mk	9 Dec 2004 21:44:48 -0000	1.501
+++ bsd.port.mk	22 Dec 2004 05:27:28 -0000
@@ -4761,13 +4761,19 @@
 		[ "`${SED} -En -e '/^@cw?d[ 	]*/s,,,p' ${TMPPLIST} | ${TAIL} -n 1`" != "${PREFIX}" ]; then \
 		${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}; \
 	fi
+.for x in ${PORTDOCS}
+	# Create a file for every file which is defined but does not exist
+	# so that pkg_delete(1)/pkg_create(1) complains about missing files.
+	if [ ! -e ${DOCSDIR}/${x} ]; then \
+		${ECHO_CMD} ${DOCSDIR}/${x} | \
+			${SED} -e 's,^${PREFIX}/,,' >> ${TMPPLIST}; \
+	fi
+.endfor
 	@${FIND} -P ${PORTDOCS:S/^/${DOCSDIR}\//} ! -type d 2>/dev/null | \
 		${SED} -ne 's,^${PREFIX}/,,p' >> ${TMPPLIST}
 	@${FIND} -P -d ${PORTDOCS:S/^/${DOCSDIR}\//} -type d 2>/dev/null | \
 		${SED} -ne 's,^${PREFIX}/, at dirrm ,p' >> ${TMPPLIST}
-	@if [ -d "${DOCSDIR}" ]; then \
-		${ECHO_CMD} "@unexec rmdir %D/${DOCSDIR:S,^${PREFIX}/,,} 2>/dev/null || true" >> ${TMPPLIST}; \
-	fi
+	${ECHO_CMD} "@dirrm ${DOCSDIR:S,^${PREFIX}/,,}" >> ${TMPPLIST}
 .else
 	@${DO_NADA}
 .endif
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list