pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/42788: pkgtools/libkver update to add dummy libkver for linux emulation



>Number:         42788
>Category:       pkg
>Synopsis:       pkgtools/libkver update to add dummy libkver for linux 
>emulation
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 11 10:50:00 +0000 2010
>Originator:     Robert Elz
>Release:        NetBSD *.*    pkgsrc current as of 2010-02-11
>Organization:
        Prince of Songkla University
>Environment:
System: NetBSD jade.coe.psu.ac.th 5.0.2 NetBSD 5.0.2 (JADE-$Revision: 1.12 $) 
#15: Thu Feb 11 12:42:36 ICT 2010 
kre%jade.coe.psu.ac.th@localhost:/usr/obj/5/kernels/JADE i386
Architecture: i386
Machine: i386
>Description:
        When pkgtools/libkver is installed and used as intended
        (as documented in kver.3 that it supplies), and as used
        by pkg_comp, programs that use linux emulation fail to run,
        as they get LD_PRELOAD'd with libkver along with everything
        else.

        See (the now closed) PR pkg/29700 for details of one of the
        problems this causes, along with a discussion, which all led
        to the brilliant observation by OBATA Akio (obache@) that this
        could all be solved installing a dummy do-nothing version of
        libkver.so inside /emul/linux

        This patch adds such a dummy library to the libkver package
        so (when appropriate) it can be used.

        It works.

        The dummy library supplied might not be the best dummy library
        anyone could invent - I did not experiment, "works" was quite
        good enough for me!   But feel free to make an even smaller one.

        Along with that change, I also took the liberty of removing the
        long dead standalone-install target from libkver's Makefile.
        See PR pkg/38651 for details.   If this patch is adopted, that
        PR can close as well.   However, if this is done (the removal of
        standalone-install is retained) then pkgtools/pkg_comp will break.
        It uses (well, attempts to use, since it is broken, it fails...)
        the standalone-install target.   I will be submitting a companion
        PR to this one with an update to pkg_comp - they should probably
        be applied together.

>How-To-Repeat:
        Try running pkg_comp with NETBSD_RELEASE defined to be something
        other than "no" in pkg_comp's config file.   Then - if you're able
        to get the sandbox built at all, try using that pkg_comp sandbox
        to build something like lan/sun-jre16  (anything that runs a
        linux emulated binary while building.)   More failure...

>Fix:
        Apply the following patch in pkgtools/libkver.

        I took the liberty of moving from libkver 0.6 to libkver 1.0
        with this update (but obviously anything > 0.6 would do).

        I also added a meaningless (commented out) LICENCE definition
        (yes, spelled correctly, and I know pkgsrc accepts either...)
        as a reminder that someone should ask seb@ what licence conditions
        apply to his code.

        This isn't a "cvs diff" as I've never managed to make that
        correctly process new created directories.

        Use 'patch -p1' to apply this patch (why 1?  beats me, it works...)

Index: Makefile
diff -r -N -u ./Makefile ../libkver.new/Makefile
--- ./Makefile  2009-02-10 07:13:34.000000000 +0700
+++ ../libkver.new/Makefile     2010-02-11 16:12:47.000000000 +0700
@@ -8,6 +8,7 @@
 MAINTAINER=    seb%NetBSD.org@localhost
 #HOMEPAGE=
 COMMENT=       Shared library and sysctl(1) replacement to override system 
version
+#LICENCE=      Ask seb
 
 PKG_INSTALLATION_TYPES=        overwrite pkgviews
 PKG_DESTDIR_SUPPORT=   user-destdir
@@ -19,7 +20,7 @@
 NO_PKGTOOLS_REQD_CHECK=        yes
 USE_BSD_MAKEFILE=      yes
 
-VERSION=               0.6
+VERSION=               1.0
 
 ONLY_FOR_PLATFORM=     NetBSD-*-*
 
@@ -43,9 +44,4 @@
 do-extract:
        ${CP} -R ${FILESDIR} ${WRKSRC}
 
-LIBKVER_STANDALONE_PREFIX?=    /libkver
-standalone-install:
-       ${MAKE} ${MAKEFLAGS} PKG_DBDIR=${LIBKVER_STANDALONE_PREFIX:Q}/pkg \
-         PREFIX=${LIBKVER_STANDALONE_PREFIX:Q} install
-
 .include "../../mk/bsd.pkg.mk"

Index: PLIST
diff -r -N -u ./PLIST ../libkver.new/PLIST
--- ./PLIST     2008-04-13 05:43:09.000000000 +0700
+++ ../libkver.new/PLIST        2010-02-11 15:40:39.000000000 +0700
@@ -3,6 +3,10 @@
 lib/libkver.so
 lib/libkver.so.1
 lib/libkver.so.1.0
+lib/libkverdummy.a
+lib/libkverdummy.so
+lib/libkverdummy.so.1
+lib/libkverdummy.so.1.0
 man/cat3/kver.0
 man/man3/kver.3
 ${PLIST.sysctl}sbin/sysctl

Index: Files/Makefile
diff -r -N -u ./files/Makefile ../libkver.new/files/Makefile
--- ./files/Makefile    2003-12-14 00:45:59.000000000 +0700
+++ ../libkver.new/files/Makefile       2010-02-11 14:51:13.000000000 +0700
@@ -1,6 +1,6 @@
 #      $NetBSD: Makefile,v 1.3 2003/12/13 17:45:59 seb Exp $
 
-SUBDIR=                lib
+SUBDIR=                lib dummy
 
 .ifndef(LDD_SYSCTL)
 LDD_SYSCTL!=   ldd /sbin/sysctl 2>&1

Index: files/dummy/Makefile
diff -r -N -u ./files/dummy/Makefile ../libkver.new/files/dummy/Makefile
--- ./files/dummy/Makefile      1970-01-01 07:00:00.000000000 +0700
+++ ../libkver.new/files/dummy/Makefile 2010-02-11 16:15:13.000000000 +0700
@@ -0,0 +1,11 @@
+#      $NetBSD$
+
+NOPROFILE=     # defined
+NOLINT=                # defined
+NOMAN=         # defined
+MKPICINSTALL=  no
+
+LIB=           kverdummy
+SRCS=          dummy.c
+
+.include <bsd.lib.mk>

Index; files/dummy/dummy.c
diff -r -N -u ./files/dummy/dummy.c ../libkver.new/files/dummy/dummy.c
--- ./files/dummy/dummy.c       1970-01-01 07:00:00.000000000 +0700
+++ ../libkver.new/files/dummy/dummy.c  2010-02-11 15:53:39.000000000 +0700
@@ -0,0 +1,3 @@
+/*     $NetBSD$        */
+
+static char ___absurd_name[4] = "abc";
diff -r -N -u ./files/dummy/shlib_version 
../libkver.new/files/dummy/shlib_version
--- ./files/dummy/shlib_version 1970-01-01 07:00:00.000000000 +0700
+++ ../libkver.new/files/dummy/shlib_version    2010-02-11 15:53:46.000000000 
+0700
@@ -0,0 +1,4 @@
+#      $NetBSD$
+
+major=1
+minor=0

Index: files/lib/kver.3
diff -r -N -u ./files/lib/kver.3 ../libkver.new/files/lib/kver.3
--- ./files/lib/kver.3  2004-04-24 17:53:03.000000000 +0700
+++ ../libkver.new/files/lib/kver.3     2010-02-11 16:05:51.000000000 +0700
@@ -34,6 +34,16 @@
 are checked in that order for the
 .Nx
 release number the library should reports information for.
+.Pp
+A dummy version of the library
+.Pa ( libkverdummy.so )
+is also supplied.
+This can be placed in
+.Pa /emul/linux ,
+renamed as
+.Pa libkver.so ,
+so that linux emulated programs do not attempt to load the real
+.Pa libkver.so .
 .Sh EXAMPLES
 .Dl env LD_PRELOAD=/lib/libkver.so LIBKVER_OSRELEASE=1.5 uname -r
 .Pp



Home | Main Index | Thread Index | Old Index