Subject: pkg/29461: emulators/suse_base needs COMPAT_LINUX (settimeofday 1970/01/01)
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <makoto@ki.nu>
List: pkgsrc-bugs
Date: 02/20/2005 06:50:00
>Number:         29461
>Category:       pkg
>Synopsis:       emulators/suse_base needs COMPAT_LINUX (settimeofday 1970/01/01)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 20 06:50:00 +0000 2005
>Originator:     Makoto Fujiwara
>Release:        NetBSD 2.99.15
>Organization:
KINU Corporation
>Environment:
	
	
System: NetBSD harry 2.99.15 NetBSD 2.99.15 (INSECURE-ZS-L2-1M-PB2-SHM) #0: Fri Feb 18 00:41:12 JST 2005 makoto@harry:/export/src-20050214ts/sys/arch/macppc/compile/INSECURE-ZS-L2-1M-PB2-SHM macppc
Architecture: powerpc
Machine: macppc
>Description:
	
(1) make install on emulators/suse_base brings system time into 1970/01/01 
if 'options COMPAT_LINUX' is not included in kernel config.

(2) Related things have been discussed in 2002/11 current-users, starting 
with 
|   From:Murray Armfield	 
| Subject: installing suse_base on current i386 sets time to 1970
 It seems to me that problems was fixed. 

(3) with NetBSD/macppc, the 'options COMPAT_LINUX' are usually not included.

(4) cd /usr/pkgsrc/emulators/suse_base
    make install

install -c -o root -g wheel -m 444 /export/pkgsrc/emulators/suse_base/files/ld.so.conf /usr/pkg/emul/linux/etc
/usr/pkg/sbin/fixelfprot /usr/pkg/emul/linux/sbin/ldconfig
fixelfprot: execute permission added
/usr/pkg/emul/linux/sbin/ldconfig -r /usr/pkg/emul/linux
FATAL: kernel too old
*** Signal 6

    and then,  it get system time 1970/01/01

(5) The point of failure:

The date is changed when emulationg ldconfig is executed. 
------------------------
ttyp3:root@mini  DING!/700101(...emulators/suse_base)# date 200502191417
Sat Feb 19 14:17:00 JST 2005
ttyp3:root@mini  14:17:00/050219(...emulators/suse_base)# 
ttyp3:root@mini  14:17:01/050219(...emulators/suse_base)# 
ttyp3:root@mini  14:17:01/050219(...emulators/suse_base)# /usr/pkg/emul/linux/sbin/ldconfig -r /usr/pkg/emul/linux
FATAL: kernel too old
Abort (core dumped)
ttyp3:root@mini  DING!/700101(...emulators/suse_base)# 
------------------------

(6) We can ktrace/kdump as:

ttyp2:makoto@harry  9:00:19/700101(...emulators/suse_base)> kdump ktrace.out 
 17699 ktrace   EMUL  "netbsd"
 17699 ktrace   CALL  execve(0x7fffdc27,0x7fffdb30,0x7fffdb40)
 17699 ktrace   NAMI  "/usr/pkg/emul/linux/sbin/ldconfig"
 17699 ldconfig EMUL  "netbsd"
 17699 ldconfig RET   execve JUSTRETURN
 17699 ldconfig CALL  settimeofday(0x7fffd918,0x7fffdb34)
 17699 ldconfig RET   settimeofday 0
 17699 ldconfig CALL  write(2,0x1005d0e8,0x16)
 17699 ldconfig GIO   fd 2 wrote 22 bytes
       "FATAL: kernel too old
       "
 17699 ldconfig RET   write 22/0x16
 17699 ldconfig CALL  pwrite(1,0x7fffd838,0,8,0x7f7f7f7f,0x8080)
 17699 ldconfig GIO   fd 1 wrote 0 bytes
       ""
 17699 ldconfig RET   pwrite 0
 17699 ldconfig CALL  getpid
 17699 ldconfig RET   getpid 17699/0x4523, 16588/0x40cc
 17699 ldconfig CALL  kill(0x4523, SIGABRT)
 17699 ldconfig RET   kill 0
 17699 ldconfig PSIG  SIGABRT SIG_DFL
 17699 ldconfig NAMI  "ldconfig.core"
ttyp2:makoto@harry  9:00:21/700101(...emulators/suse_base)> 

>How-To-Repeat:
	
        (1) make sure 'options COMPAT_LINUX' is not included in kernel
        (2) cd /usr/pkgsrc/emulators/suse_base
            make install
>Fix:
	
 One thing we have to do is to check the Kernel configuration before
we do make install (or even make), say add following line on 
 emulators/suse_base/Makefile:

Index: Makefile
===================================================================
RCS file: /e/st4200/cvsync/pkgsrc/emulators/suse_base/Makefile,v
retrieving revision 1.52
diff -u -r1.52 Makefile
--- Makefile	23 Jan 2005 12:06:07 -0000	1.52
+++ Makefile	1 Jan 1970 20:05:48 -0000
@@ -25,6 +25,10 @@
 RPMFILES=		aaa_dir.rpm gppshare.rpm ncurses.rpm \
 			readline.rpm bash.rpm sh-utils.rpm
 
+.if !defined(LINUX_SYSCTL_OSRELEASE)
+PKG_SKIP_REASON+= "${PKGNAME} is not available for ${MACHINE_PLATFORM}, needs 'options COMPAT_LINUX' kernel config"
+.endif
+
 .include "../../emulators/suse_linux/arch.mk"
 
 .if ${SUSE_ARCH} == "i386"
    

>Unformatted:
 emulators/suse_base needs COMPAT_LINUX (settimeofday 1970/01/01)