Subject: pkg/32921: pkgtools/pkg_comp is inconsistent in libkver usage
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <kre@munnari.OZ.AU>
List: pkgsrc-bugs
Date: 02/23/2006 20:40:00
>Number:         32921
>Category:       pkg
>Synopsis:       pkgtools/pkg_comp is inconsistent in libkver usage
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 23 20:40:00 +0000 2006
>Originator:     Robert Elz
>Release:        NetBSD 3.99.15  (pkgsrc current as of ~ 12 hours ago)
>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:
	pkg_comp uses (allows for the use of) libkver to allow
	packages to be built for aystem version that is not
	identical to the kernel actually running (great feature!)

	Most of the time this works just fine (it certainly
	works fine for building most packages - a few tha use
	linux compat mode fail, there's another PR about that).

	Howwever, when using "pkg_comp chroot" the results are
	not consistent.

>How-To-Repeat:

	As follows.   First, include
		NETBSD_RELEASE=3.0
	(or something like that in your $HOME/pkg_comp/default.conf
	- if you don't use default.condf then add the necessary -c
	options to the commands below).   You should not be running the
	same kernel version as the one given as NETBSD_RELEASE

	Then 
		pkg_comp makeroot

	And, the bit that shows it, which I will cut/paste ...

jade# pkg_comp chroot
PKG_COMP ==> Mounting sandboxed filesystems
PKG_COMP ==> Entering sandbox `/local/pkg_comp/default'
pkg_comp:default.conf# uname -a
NetBSD jade.coe.psu.ac.th 3.0 NetBSD 3.0 (LIBKVER) #0: Tue Jan 19 00:00:00 UTC 2038 root@localhost:/sys/arch/i386/compile/LIBKVER i386
pkg_comp:default.conf# exit
PKG_COMP ==> Unmounting sandboxed filesystems

jade# pkg_comp chroot uname -a
PKG_COMP ==> Mounting sandboxed filesystems
PKG_COMP ==> Entering sandbox `/local/pkg_comp/default'
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

PKG_COMP ==> Unmounting sandboxed filesystems

	Notice that with just "pkg_comp chroot" libkver is
	being used as intended, but with pkg_comp chroot command
	it does not.

	This is particularly relevant with things like
		pkg_comp chroot lintpkgsrc -p
	(or other similar lintpkgsrc options), as that then
	always finds packages like devel/p5-perk-headers to
	be out of date (as the package has the kernel version
	embedded into it - it always builds as 3.0 using libkver,
	but then is checked iwth the real kernel version visible)

>Fix:
	Scatter more uses of LD_PRELOAD around.