From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Dec 31 02:10:10 2010 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCEF01065675 for ; Fri, 31 Dec 2010 02:10:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 857508FC0C for ; Fri, 31 Dec 2010 02:10:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id oBV2AAR2024349 for ; Fri, 31 Dec 2010 02:10:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id oBV2AA2u024348; Fri, 31 Dec 2010 02:10:10 GMT (envelope-from gnats) Resent-Date: Fri, 31 Dec 2010 02:10:10 GMT Resent-Message-Id: <201012310210.oBV2AA2u024348@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Olli Hauer Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50243106566C; Fri, 31 Dec 2010 02:08:23 +0000 (UTC) (envelope-from ohauer@FreeBSD.org) Received: from u18-124.dslaccess.de (unknown [194.231.39.124]) by mx1.freebsd.org (Postfix) with ESMTP id 91DE88FC14; Fri, 31 Dec 2010 02:08:22 +0000 (UTC) Received: by u18-124.dslaccess.de (Postfix, from userid 1100) id 478DF205CC; Fri, 31 Dec 2010 03:08:20 +0100 (CET) Message-Id: <20101231020820.478DF205CC@u18-124.dslaccess.de> Date: Fri, 31 Dec 2010 03:08:20 +0100 (CET) From: Olli Hauer To: X-Send-Pr-Version: 3.113 Cc: Subject: ports/153573: [patch] ports/Mk bsd.license.mk honor pkg_add -p/-P X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Dec 2010 02:10:10 -0000 >Number: 153573 >Category: ports >Synopsis: [patch] ports/Mk bsd.license.mk honor pkg_add -p/-P >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Dec 31 02:10:10 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Olli Hauer >Release: >Organization: >Environment: >Description: If a package is installed with pkg_add -p or -P there is an issue during deinstall of the package. You will notice a simmilar message during deinstall: # pkg_delete lic-test-1.0 pkg_delete: file '/usr/local/share/licenses/lic-test-1.0' doesn't exist pkg_delete: unable to completely remove directory '/usr/local/share/licenses/lic-test-1.0' pkg_delete: couldn't entirely delete package (perhaps the packing list is incorrectly specified?) This issue comes from a hard coded PREFIX injected to TMPPLIST during package generation. ( @\${ECHO_CMD} "@cwd \${PREFIX}" >> \${TMPPLIST} ) >How-To-Repeat: I've made some tests and found an interesting behavior of pkg_add which solves this issue. If "@cwd " without target is given it will be replaced during pkg_add with "@cwd $PKG_PREFIX". Important, there must be an whitespace behind "@cwd "! Testcase: 1) create package with test port 2) pkg_info -f lic-test-1.0 | grep CWD CWD to /usr/local CWD to /tmp CWD to /var/tmp CWD to /usr/local 3) pkg_delete lic-test-1.0 4) mtree -U -f /usr/ports/Templates/BSD.local.dist -d -e -p /tmp/lic-test >/dev/null 5) pkg_add -p /tmp/lic-test lic-test-1.0.tbz 6) pkg_info -f lic-test-1.0 | grep CWD CWD to /tmp/lic-test CWD to /tmp CWD to /var/tmp wrong --> CWD to /usr/local 7) pkg_delete lic-test-1.0 pkg_delete: file '/usr/local/share/licenses/lic-test-1.0' doesn't exist pkg_delete: unable to completely remove directory '/usr/local/share/licenses/lic-test-1.0' pkg_delete: couldn't entirely delete package (perhaps the packing list is incorrectly specified?) 8) Apply patch for bsd.license.mk and go back to 1) Now we have the follwing output for 2) and 6) 2) CWD to /usr/local CWD to /tmp CWD to /var/tmp CWD to /usr/local 6) CWD to /tmp/lic-test CWD to /tmp CWD to /var/tmp OK --> CWD to /tmp/lic-test Even in /var/db/pkg/lic-test-1.0/+CONTENTS we can find this lines @comment the following entries are added by the ports framework @cwd /tmp/lic-test @dirrm share/licenses/lic-test-1.0 >Fix: --- patch_ports-MK__bsd.license.mk.txt begins here --- Index: Mk/bsd.licenses.mk =================================================================== RCS file: /home/pcvs/ports/Mk/bsd.licenses.mk,v retrieving revision 1.4 diff -u -r1.4 bsd.licenses.mk --- Mk/bsd.licenses.mk +++ Mk/bsd.licenses.mk @@ -744,7 +744,8 @@ . endfor .endif # XXX @dirrmtry entry must be here (no way to do with PLIST_* vars) - @${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST} +# XXX Important, keep the whitespace behind "@cwd "! + @${ECHO_CMD} "@cwd " >> ${TMPPLIST} @${ECHO_CMD} "@dirrm ${_LICENSE_DIR_REL}" >> ${TMPPLIST} @${ECHO_CMD} "@unexec rmdir %D/share/licenses 2>/dev/null || true" >> ${TMPPLIST} --- patch_ports-MK__bsd.license.mk.txt ends here --- --- test-port-and-patch-for-bsd.license.mk begins here --- --- /dev/null +++ Makefile @@ -0,0 +1,19 @@ +# lic-test + +PORTNAME= lic-test +PORTVERSION= 1.0 +CATEGORIES= misc +MASTER_SITES= # none +DISTFILES= # none + +MAINTAINER= devnull@example.org +COMMENT= Lic test for pkg_add -p or -P + +LICENSE= BSD +NO_BUILD= yes + +do-install: + @${MKDIR} ${DATADIR} + @${INSTALL_DATA} ${WRKDIR}/.PLIST.mktmp ${DATADIR}/PLIST + +.include --- /dev/null +++ pkg-plist @@ -0,0 +1,7 @@ +%%DATADIR%%/PLIST +@dirrm %%DATADIR%% +@exec echo "PKG_PREFIX $PKG_PREFIX" +@comment do at last 2x cwd +@cwd /tmp +@cwd /var/tmp +@comment the following entries are added by the ports framework --- /dev/null +++ pkg-descr @@ -0,0 +1,5 @@ +license test if installed from package +with parameter -p or -P + +for example: +pkg_add -p /foo/bar dummy.pkg --- test-port-and-patch-for-bsd.license.mk ends here --- >Release-Note: >Audit-Trail: >Unformatted: