bin/57653: [PATCH] bsd.port.mk: LIB_DEPENDS should not use libraries in ${LOCALBASE}/lib/compat/pkg

Oliver Eikemeier eikemeier at fillmore-labs.com
Mon Oct 6 10:30:13 PDT 2003


>Number:         57653
>Category:       bin
>Synopsis:       [PATCH] bsd.port.mk: LIB_DEPENDS should not use libraries in ${LOCALBASE}/lib/compat/pkg
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 06 10:30:09 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Eikemeier
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Fillmore Labs - http://www.fillmore-labs.com
>Environment:
System: FreeBSD nuuk.fillmore-labs.com 5.1-CURRENT

>Description:

When using port sysutils/portupgrade to manage port installation, it is possible
for stale libraries to end up in ${LOCALBASE}/lib/compat/pkg. Even though
portupgrade does its best to clean them up, they can persist when the library
changes its version number (libintl.so.4 => libintl.so.5), or the upgrade process
is interrupted by ctrl-C.

ldconfig -r (and bsd.port.mk) finds these libraries, assuming the whole port
needed for LIB_DEPENDS (including headers) is installed, which it isn't.

This patch aborts building if a needed library is found only in
${LOCALBASE}/lib/compat/pkg.

The initial bug report came from Thomas Fritz <tf at slash10.com>, thanks for the
help in tracking it down.

>How-To-Repeat:

# portinstall net/openldap21-client
[...]

# pkg_deinstall -P 'openldap-*'
[...]
--->  Preserving /usr/local/lib/libldap.so.2 as /usr/local/lib/compat/pkg/libldap.so.2
[...]

# portinstall net/openldap21-server
[...]
===>   openldap-server-2.1.22_2 depends on shared library: ldap.2 - found
[...]

# pkg_glob 'openldap-*'
Stale dependency: openldap-server-2.1.22_2 --> openldap-client-2.1.22 -- manually run 'pkgdb -F' to fix, or specify -O to force.

The usage of `pkg_deinstall -P' may seem artificial, but this is exactly the
command used by portupgrade if used without the `-u' option.

>Fix:

--- bsd.port.mk.patch begins here ---
--- bsd.port.mk.orig	3 Sep 2003 19:50:24 -0000
+++ bsd.port.mk	6 Oct 2003 16:51:09 -0000
@@ -1009,6 +1009,8 @@
 PREFIX?=		${LOCALBASE}
 .endif
 
+PKGCOMPATDIR?=		${LOCALBASE}/lib/compat/pkg
+
 .if !defined(PERL_LEVEL) && defined(PERL_VERSION)
 perl_major=		${PERL_VERSION:C|^([1-9]+).*|\1|}
 _perl_minor=	00${PERL_VERSION:C|^([1-9]+)\.([0-9]+).*|\2|}
@@ -3894,9 +3896,9 @@
 	@for i in ${LIB_DEPENDS}; do \
 		lib=$${i%%:*}; \
 		case $$lib in \
-			*.*.*)	pattern=$$lib ;;\
+			*.*.*)	pattern="`${ECHO_CMD} $$lib | ${SED} -e 's/\./\\./g'`" ;;\
 			*.*)	pattern="$${lib%%.*}\.$${lib#*.}" ;;\
-			*)		pattern=$$lib ;;\
+			*)		pattern="$$lib" ;;\
 		esac; \
 		dir=$${i#*:}; \
 		target=$${i##*:}; \
@@ -3941,6 +3943,11 @@
 					${FALSE}; \
 				fi; \
 			fi; \
+		fi; \
+		if ${LDCONFIG} -r | ${GREP} -wE -e "-l$$pattern" | ${HEAD} -n 1 | grep -qwF -e "${PKGCOMPATDIR}"; then \
+			${ECHO_MSG} "Error: stale library \"$$lib\" found in ${PKGCOMPATDIR}."; \
+			${ECHO_MSG} "Please clean out ${PKGCOMPATDIR} manually."; \
+			${FALSE}; \
 		fi; \
 	done
 .endif
--- bsd.port.mk.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list