Subject: lib/17820: miniroot/ramdisk compile error (libhack::utmp.c)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <naoki@fukaumi.org>
List: netbsd-bugs
Date: 08/03/2002 18:32:12
>Number:         17820
>Category:       lib
>Synopsis:       miniroot/ramdisk compile error (libhack::utmp.c)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 03 02:33:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     FUKAUMI Naoki
>Release:        NetBSD 1.6D (2002/8/3 source)
>Organization:
	FUKAUMI Naoki
>Environment:
System: NetBSD nforce.naobsd.org 1.6D NetBSD 1.6D (NFORCE) #1: Wed Jul 17 16:34:22 JST 2002 fun@nforce.naobsd.org:/usr/obj/i386/sys/arch/i386/compile/NFORCE i386
Architecture: i386
Machine: i386
>Description:
	make snapshot was failed.
	utmp/wtmp handling in libhack seems to be wrong.
	(after recent utmpx changes ?)

	This is error log:
chown.cro chroot.cro wiconfig.cro sysinst.cro  libhack.o -lbz2 -ledit -lutil -lcurses -ltermcap -lrmt -lcrypt -ll -lm -L/home/d/i386/usr/lib  -lgcc -lc -lgcc /home/d/i386/usr/lib/crtend.o
/home/d/i386/usr/lib/libutil.a(logwtmp.o): In function `logwtmp':
logwtmp.o(.text+0x0): multiple definition of `logwtmp'
libhack.o(.text+0x17bc): first defined here
/home/t/i386/i386--netbsdelf/bin/ld: Warning: size of symbol `logwtmp' changed from 5 to 192 in logwtmp.o
/home/d/i386/usr/lib/libutil.a(logout.o): In function `logout':
logout.o(.text+0x0): multiple definition of `logout'
libhack.o(.text+0x17b4): first defined here
/home/t/i386/i386--netbsdelf/bin/ld: Warning: size of symbol `logout' changed from 7 to 212 in logout.o
collect2: ld returned 1 exit status
*** [ramdiskbin] Error code 1

>How-To-Repeat:
	make snapshot from -current (2002/8/3) source.

>Fix:
	This is ad-hoc patch.

	Sorry, I don't know what is weak_alias ;)
	And please review, utmpx guru :)

--- src/distrib/utils/libhack/utmp.c.orig	Mon Jun 21 11:32:20 1999
+++ src/distrib/utils/libhack/utmp.c	Sat Aug  3 17:58:51 2002
@@ -5,17 +5,42 @@
  * Public domain.
  */
 
+#include <sys/cdefs.h>
+
+#ifdef __weak_alias
+#define login		_login
+#define loginx		_loginx
+#define logout		_logout
+#define logoutx		_logoutx
+#define logwtmp		_logwtmp
+#define logwtmpx	_logwtmpx
+#endif
+
 /* Simplified (do nothing:) */
 #include <sys/types.h>
-#include <utmp.h>
 #include <util.h>
 
+#ifdef __weak_alias
+__weak_alias(login,_login)
+__weak_alias(loginx,_loginx)
+__weak_alias(logout,_logout)
+__weak_alias(logoutx,_logoutx)
+__weak_alias(logwtmp,_logwtmp)
+__weak_alias(logwtmpx,_logwtmpx)
+#endif
+
 void
 login(ut)
 	const struct utmp *ut;
 {
 }
 
+void
+loginx(ut)
+	const struct utmpx *ut;
+{
+}
+
 int
 logout(line)
 	const char *line;
@@ -23,9 +48,23 @@
 	return(0);
 }
 
+int
+logoutx(line, status, type)
+	const char *line;
+	int status, type;
+{
+	return(0);
+}
 
 void
 logwtmp(line, name, host)
 	const char *line, *name, *host;
+{
+}
+
+void
+logwtmpx(line, name, host, status, type)
+	const char *line, *name, *host;
+	int status, type;
 {
 }
>Release-Note:
>Audit-Trail:
>Unformatted: