Major flaws of the new make deinstall code

Joe Marcus Clarke marcus at marcuscom.com
Mon Jul 14 12:28:55 PDT 2003


On Mon, 2003-07-14 at 14:48, Joe Marcus Clarke wrote:
> On Mon, 2003-07-14 at 14:41, Maxim Sobolev wrote:
> > On Mon, Jul 14, 2003 at 02:23:46PM -0400, Joe Marcus Clarke wrote:
> > > On Mon, 2003-07-14 at 12:53, Maxim Sobolev wrote:
> > > > Folks,
> > > > 
> > > > I've noticed several misbehaviours of the new make deinstall code,
> > > > particularly:
> > > > 
> > > > 1. The new code behaves incorrectly when there are several @cwd
> > > > statements in the packing list. Particularly, it affects many
> > > > ports from games category, which usually create files and dirs
> > > > under /var. For some reason, make deinstall code takes the second
> > > > @cwd as the prefix of the installed package and obviously mismatch
> > > > happens. This needs to be corrected ASAP.
> > > 
> > > Do you have a specific port in mind?  I don't recall seeing this in
> > > testing.
> > 
> > This is an in-house port for our product, pkg-plist looks like following:
> > 
> > bin/radlast
> > bin/radtest
> > bin/raduse
> > bin/radwho
> > bin/radzap
> > lib/xtradius/perlAAA.soc
> > sbin/checkrad
> > sbin/radiusd
> > @dirrm lib/xtradius
> > @cwd /var
> > @exec /bin/mkdir %D/log/radacc > /dev/null 2> /dev/null || /usr/bin/true
> > @unexec /bin/rmdir %D/log/radacc > /dev/null 2> /dev/null || /usr/bin/true
> > @unexec if cmp -s %D/db/raddb/clients %D/db/raddb/clients.sample; then rm -f %D/db/raddb/clients; fi
> > db/raddb/clients.sample
> > @exec [ -f %B/clients ] || cp %B/%f %B/clients
> > db/raddb/dictionary
> > db/raddb/dictionary.ascend
> > db/raddb/dictionary.cisco
> > db/raddb/dictionary.compat
> > db/raddb/dictionary.livingston
> > db/raddb/dictionary.quintum
> > db/raddb/dictionary.shiva
> > db/raddb/dictionary.tunnel
> > db/raddb/dictionary.usr
> > db/raddb/dictionary.versanet
> > db/raddb/dictionary.xtradius
> > db/raddb/execparams
> > db/raddb/hints
> > db/raddb/huntgroups
> > @unexec if cmp -s %D/db/raddb/naslist %D/db/raddb/naslist.sample; then rm -f %D/db/raddb/naslist; fi
> > db/raddb/naslist.sample
> > @exec [ -f %B/naslist ] || cp %B/%f %B/naslist
> > db/raddb/naspasswd
> > db/raddb/realms
> > db/raddb/users
> > db/raddb/users.xtr
> > @dirrm db/raddb
> > 
> > For some reason, it picks /var from the installed package as a main
> > prefix resulting in false positive. I have not checked other ports
> > with multiple @cwd's though.
> 
> I'll take a look.

This patch should take care of the problem.

Joe

> 
> > 
> > > > 2. In general, prefix-safety feature of make deinstall is misdesigned,
> > > > as it should not reject deinstalling package which has no dependants
> > > > (i.e. packages that depend on it) regardless of its prefix, as
> > > > replacing this package with one with a different prefix will not
> > > > lead to any problems I can think of.
> > > 
> > > Replacing a dependency (pkgconfig, for example) with a version in a
> > > different prefix could have disasterous effects if you're dealing with
> > > files you expect to exist in a certain location.  In any event, make
> > > deinstall-all will remove all packages with a given ORIGIN regardless of
> > > PKGNAME or PREFIX.
> > 
> > I am not talking about "replacing", but about deleting - deleting
> > package with different prefix should be harmless if no packages
> > depend on one being deleted.
> 
> Ah, I see what you're saying.  The old bsd.port.mk didn't do this
> either.  It only deleted the package if PKGNAME matched exactly.  At
> least with this version you have the ability to remove packages based on
> ORIGIN (and PREFIX).  Plus, the deinstall-all option turns on the
> "ignore PREFIX" mode.
> 
> Joe
> 
> > 
> > -Maxim
> > 
> > > 
> > > Joe
> > > 
> > > > 
> > > > -Maxim
> > > -- 
> > > PGP Key : http://www.marcuscom.com/pgp.asc
> > > 
> > > 
> > 
-- 
PGP Key : http://www.marcuscom.com/pgp.asc


-------------- next part --------------
--- /usr/ports/Mk/bsd.port.mk	Sat Jul 12 15:01:17 2003
+++ bsd.port.mk	Mon Jul 14 15:00:02 2003
@@ -3012,7 +3012,7 @@
 		@already_installed=`${PKG_INFO} -q -O ${PKGORIGIN} 2> /dev/null`; \
 		if [ -n "$${already_installed}" ]; then \
 				for p in $${already_installed}; do \
-						prfx=`${PKG_INFO} -q -p $${p} 2> /dev/null | ${SED} -e 's|^@cwd ||'`; \
+						prfx=`${PKG_INFO} -q -p $${p} 2> /dev/null | ${HEAD} -n 1 | ${SED} -e 's|^@cwd ||'`; \
 						if [ "x${PREFIX}" = "x$${prfx}" ]; then \
 								df=`${PKG_INFO} -q -f $${p} 2> /dev/null | ${GREP} -v "^@" | ${COMM} -12 - ${TMPPLIST}`; \
 								if [ -n "$${df}" ]; then \
@@ -3403,7 +3403,7 @@
 	for p in $${found_names}; do \
 			check_name=`${ECHO} $${p} | ${SED} -e 's/-[^-]*$$//'`; \
 			if [ "$${check_name}" = "${PKGBASE}" ]; then \
-					prfx=`${PKG_INFO} -q -p $${p} 2> /dev/null | ${SED} -e 's|^@cwd ||'`; \
+					prfx=`${PKG_INFO} -q -p $${p} 2> /dev/null | ${HEAD} -n 1 | ${SED} -e 's|^@cwd ||'`; \
 					if [ "x${PREFIX}" = "x$${prfx}" ]; then \
 							${ECHO_MSG} "===>   Deinstalling $${p}"; \
 							${PKG_DELETE} -f $${p}; \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20030714/0485414d/attachment.bin


More information about the freebsd-ports mailing list