Subject: pkg/36264: sysutils/mklivecd dependency confusion (possible pkgsrc bug)
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <kre@munnari.OZ.AU>
List: pkgsrc-bugs
Date: 05/02/2007 12:05:00
>Number:         36264
>Category:       pkg
>Synopsis:       sysutils/mklivecd dependency confusion (possible pkgsrc bug)
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 02 12:05:00 +0000 2007
>Originator:     Robert Elz
>Release:        NetBSD 3.99.15  (pkgsrc current within past 6 hours)
>Organization:
	Prince of Songkla University
>Environment:
System: NetBSD jade.coe.psu.ac.th 3.99.15 NetBSD 3.99.15 (GENERIC-1.696-20060125) #8: Wed Jan 25 04:59:39 ICT 2006 kre@jade.coe.psu.ac.th:/usr/obj/current/kernels/JADE_ASUS i386
Architecture: i386
Machine: i386
>Description:
	sysutils/mklivecd needs sysutils/cdrtools (for mkisofs I presume,
	it shouldn't really need a dependency on any actual CD writing
	software) - why doesn't matter.

	The dependency is expressed as ...

DEPENDS+=       {cdrtools,cdrtools-ossdvd}-[0-9]*:../../sysutils/cdrtools

	which, as I understand it, means "either csdtools, or cdrtools-ossdvd
	of any version at all will do, and if none is found, install from
	sysutils/cdrtools.

	That's all fine.

	For package building, I use pkg_comp - its sandbox is often
	empty, or very nearly empty (it actually always has pkglint
	installed, which implies perl and a few p5-* modules, but
	for present purposes, that is empty).

	On the other hand, I have an extensive set of up to date binary
	packages (far more than I'm ever going to actually use, though
	I expect less than th ebulk builders manage).

	In particular, I have (current versions of) binary packages for
	both cdrtools, and cdrtools-ossdvd, but most of the time, neither
	is going to be installed in the pkg_comp sandbox.

	sysutils/mklivecd was recently upgraded, so naturally, I wanted
	to build a binary package of the latest version.   It failed.
	(This is surprising, this is one truly trivial package in terms
	of its pkgsrc requirements - it is really just a script to copy.)

	The problem related to the depensencies (as the Subject/Synposis
	of this PR probably suggests).   Since neither of the the required
	alternative dependencies was installed, pkg_comp (using pkgsrc)
	needed to install one.   For whatever reason, it picked
	cdrtools-ossdvd (how pkg_add or pkgsrc choses between binary
	packages when more than one is available seems like black magic
	to me, and often, poorly executed black magic, but never mind.)

	That should be OK, either version of cdrtools is supposed to be
	satisfactory.

	However, pkgsrc then went on to compile cdrtools from source, and
	attempt to install it.   That fails, as when installing cdrtools,
	pkgsrc found cdrtools-ossdvd already installed (which shouldnot
	have surprised it, it just installed it after all!) and failed,
	cdrtools and cdrtools-ossdvd conflict with each other

	So, the install of cdrtools failed, make aborts, and. the
	mklivecd package doesn't get "built" installed, or packaged.

>How-To-Repeat:
	Build binary packages of both sysutils/cdrtools and
	sysutils/cdrtools-ossdvd.   Delete both packages from
	/usr/pkg.   Attempt to build and install sysutils/mklifecd
	(if pkgsrc doesn't pick cdrtools-ossdvd to install first,
	figure out how to make it pick that one...)

	Expect to see ...


===> Binary install for mklivecd-0.15.1
=> Installing mklivecd-0.15.1 from /pkg_comp/packages/All
pkg_add: no pkg found for 'mklivecd-0.15.1.tgz', sorry.
pkg_add: 1 package addition failed
=> No binary package found for mklivecd-0.15.1; installing from source.
===> Installing dependencies for mklivecd-0.15.1
=> Required installed package {cdrtools,cdrtools-ossdvd}-[0-9]*: NOT found
=> Verifying bin-install for ../../sysutils/cdrtools
===> Binary install for {cdrtools,cdrtools-ossdvd}-[0-9]*
=> Installing cdrtools-2.01.01.24 from /pkg_comp/packages/All

===========================================================================
$NetBSD: MESSAGE.cdrecord.conf,v 1.2 2004/02/03 05:17:43 reed Exp $

Note: The location of the cdrtools-ossdvd-2.01.1.36 `defaults' file has
been set to:

        /etc/conf/cdrecord.conf

This is the pkgsrc standard config file location, NOT the cdrtools
standard location, which is /etc/default/cdrecord.

The reason for this is that pkgsrc packages should not use configuration
files outside /usr/pkg unless they are explicitly set by the user.

===========================================================================

cdrtools-ossdvd-2.01.1.36nb1 successfully installed.

	That part is all fine, and just as expected, however
	what follows is ...

=> No binary package found for cdrtools-2.01.01.24; installing from source.
=> Required installed package digest>=20010302: digest-20060826 found
=> Checksum SHA1 OK for cdrtools-2.01.01a24.tar.bz2
=> Checksum RMD160 OK for cdrtools-2.01.01a24.tar.bz2
===> Installing dependencies for cdrtools-2.01.01.24
=> Required installed package digest>=20010302: digest-20060826 found
=> Required installed package gmake>=3.78: NOT found
=> Verifying bin-install for ../../devel/gmake
===> Binary install for gmake>=3.78
=> Installing gmake-3.81 from /pkg_comp/packages/All

	and lots more boring stuff, with gmake's install noise, and then
	compilation of cdrtools (which all works just fine ...

gmake[1]: Leaving directory `/pkg_comp/obj/pkgsrc/sysutils/cdrtools/default/cdrt
ools-2.01.01/man' 
=> Unwrapping files-to-be-installed.
cd /pkg_comp/obj/pkgsrc/sysutils/cdrtools/default/cdrtools-2.01.01;
                                         for manpage in cdda2wav/cdda2wav.1 mkis
ofs/mkisofs.8; do        /usr/bin/tbl ${manpage} > ${manpage}.tmp;
         /bin/mv -f ${manpage}.tmp ${manpage};                   done
===> Installing for cdrtools-2.01.01.24
ERROR: cdrtools-2.01.01.24 conflicts with installed package(s):
ERROR:     cdrtools-ossdvd-2.01.1.36nb1
ERROR: They install the same files into the same place.
ERROR: Please remove conflicts first with pkg_delete(1).
*** Error code 1

	Oops...

>Fix:
	A simple workaround was to remove the cdrtools-ossdvd binary
	package (temporarily move it away), after which everything
	worked just fine, the binary package of cdrtools was installed
	instead, and mklivecd built just fine.

	However, pkgsrc's dependency handling in the presence of
	binary packages that it installs clearly needs some serious work.

	I have no idea why after installing a package to satisfy the
	dependency it then decided to go ahead and compile the
	alternative from source (it could have installed, or attempted,
	that one from a binary package as well, it existed).