From h.eichmann@gmx.de  Sat Jan 24 09:03:49 2004
Return-Path: <h.eichmann@gmx.de>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2D68F16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 24 Jan 2004 09:03:49 -0800 (PST)
Received: from mail.gmx.net (mail.gmx.de [213.165.64.20])
	by mx1.FreeBSD.org (Postfix) with SMTP id 1AFAA43D68
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 24 Jan 2004 09:02:51 -0800 (PST)
	(envelope-from h.eichmann@gmx.de)
Received: (qmail 9040 invoked by uid 65534); 24 Jan 2004 17:02:49 -0000
Received: from pD9EC219D.dip.t-dialin.net (EHLO 7of9.unimatrix-zero.borg) (217.236.33.157)
  by mail.gmx.net (mp002) with SMTP; 24 Jan 2004 18:02:49 +0100
Message-Id: <200401241803.25218.h.eichmann@gmx.de>
Date: Sat, 24 Jan 2004 18:03:25 +0100
From: Heiner <h.eichmann@gmx.de>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Port sysutils/cdrdao might corrupt package database

>Number:         61840
>Category:       ports
>Synopsis:       Port sysutils/cdrdao might corrupt package database
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 24 09:10:17 PST 2004
>Closed-Date:    Sun Jan 25 12:48:33 PST 2004
>Last-Modified:  Sun Jan 25 12:48:33 PST 2004
>Originator:     Heiner Eichmann <h.eichmann@gmx.de>
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
Sirius Cybernetics Corp.
>Environment:
=46reeBSD 7of9.unimatrix-zero.borg 4.9-STABLE FreeBSD 4.9-STABLE #0: Tue De=
c 30=20
09:19:53 CET 2003 =A0 =A0=20
root@7of9.unimatrix-zero.borg:/usr/obj/usr/src/sys/MYKERNEL =A0i386
>Description:
The port cdrdao might corrupt the package database. See How-To-Repeat secti=
on.=20
The reason is the dynamic calculation of the dependencies. If gnomelibs is=
=20
not installed during installation of cdrdao but installed lateron, all port=
s=20
depending on cdrdao also depend on gnome--, which is not necessarily=20
installed!
>How-To-Repeat:
1. Make sure, that pkgdb -F reports no error.
2. pkg_deinstall -f the ports gnomelibs, cdrdao, gnome-- and k3b, if they a=
re=20
installed.
3. portinstall gnomelibs, cdrdao and k3b in this order. Note that gnome-- i=
s=20
installed automatically by cdrdao.
4. pkgdb -F reports no error. Everything is fine.
5. repeat step 2
6. portinstall cdrdao, gnomelibs and k3b in this order. Note that gnome-- i=
s=20
NOT installed automatically by cdrdao
7. pkgdb -F reports a missing dependency (k3b -> gnome--). The package=20
database is corrupt!

>Fix:

There are two obvious fixes:
1. Follow the instructions in http://www.freebsd.org/gnome/docs/porting.htm=
l.=20
Note, that the example of dynamic dependencies

=2Eif ${HAVE_GNOME:Mgnomepanel}!=3D""
    USE_GNOME+=3D gnomeprefix gnomepanel
    CONFIGURE_ARGS+=3D    --with-gnome
    PKGNAMESUFFIX=3D  -gnome
    PLIST_SUB=3D  DATADIR=3D"share/gnome"
=2Eelse
    CONFIGURE_ARGS+=3D    --without-gnome
    PLIST_SUB=3D  DATADIR=3D"share"
=2Eendif

does NOT contain any LIB_DEPENDS!! The current Makefile of cdrdao contains =
two=20
of them:

=2Eif ${HAVE_GNOME:Mgnomelibs} !=3D ""
USE_GNOME=3D		gnomelibs
LIB_DEPENDS+=3D		gtkmm.2:${PORTSDIR}/x11-toolkits/gtk--
LIB_DEPENDS+=3D		gnomemm-1.2.10:${PORTSDIR}/x11-toolkits/gnome--
CONFIGURE_ARGS=3D		--with-gtkmm-prefix=3D${X11BASE}
PKGNAMESUFFIX?=3D		-gnome
PLIST_SUB=3D		GNOME=3D""
MAN1+=3D			gcdmaster.1
=2Eelse
CONFIGURE_ARGS=3D		--with-gtkmm-prefix=3D${NONEXISTENT}
PLIST_SUB=3D		GNOME=3D"@comment "
_WITHOUT_GNOME=3D		yes
=2Eendif

They cause the problem. Converting them into USE_GNOME requires a change of=
=20
bsd.gnome.mk as well but fixes the problem

2. A better fix is to follow the cvsup example. Here two ports exist (cvsup=
=20
and cvsup-withoutgui), where the second points to the first. On cdrdao I=20
recommend to create a port cdrdao, which depends on the gnome stuff only, i=
f=20
the environment variable WITH_GNOME is set. A second port cdrdao-gnome sets=
=20
it and points to cdrdao. Then all dependending ports, which do not need gui=
=20
stuff, point to cdrdao and the user can decide, which one he needs.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: pav 
State-Changed-When: Sun Jan 25 12:46:33 PST 2004 
State-Changed-Why:  
Corruption was caused by your invalid usage of pkg_deinstall -f, 
where -f flag stands for forcibly removal of package, leaving 
other packages which depends on it broken. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=61840 
>Unformatted:
