NetBSD Problem Report #40003

From root@devel5.precedence.co.uk  Sat Nov 22 10:58:22 2008
Return-Path: <root@devel5.precedence.co.uk>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 95A2B63B11D
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 22 Nov 2008 10:58:22 +0000 (UTC)
Message-Id: <20081122111258.31EEC55A06@devel5.precedence.co.uk>
Date: Sat, 22 Nov 2008 11:12:58 +0000 (GMT)
From: netbsd@precedence.co.uk
Reply-To: netbsd@precedence.co.uk
To: gnats-bugs@gnats.NetBSD.org
Subject: Adding wpa_cli to a ramdisk has duplicate symbols
X-Send-Pr-Version: 3.95

>Number:         40003
>Category:       bin
>Synopsis:       Adding wpa_cli to a ramdisk breaks linking with duplicate symbols
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    sborrill
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 22 11:00:01 +0000 2008
>Closed-Date:    Fri Nov 28 19:42:52 +0000 2008
>Last-Modified:  Sat Nov 29 20:55:03 +0000 2008
>Originator:     Stephen Borrill
>Release:        NetBSD 5.0_BETA
>Organization:
Precedence Technologies Ltd
>Environment:


System: NetBSD devel5.precedence.co.uk 5.0_BETA NetBSD 5.0_BETA (XEN3_DOMU) #1: Mon Nov 17 11:18:55 GMT 2008 root@ugly:/usr/src/5.0/obj.i386/sys/arch/i386/compile/XEN3_DOMU i386
Architecture: i386
Machine: i386
>Description:
I need to get wpa_supplicant and wpa_cli into an embededded ramdisk. When
wpa_cli is added to the list, linking fails with duplicate symbols:
#      link  ramdisk-rescuetiny/ramdiskbin
/root/thinit/work/tools/bin/i386--netbsdelf-gcc  -B/root/thinit/work/obj/destdir.i386/usr/lib/ -B/root/thinit/work/obj/destdir.i386/usr/lib/  -Wl,-nostdlib  -Wl,-Map,ramdiskbin.map,--cref   -static  -o ramdiskbin  ramdiskbin.o cat.cro chmod.cro cp.cro ln.cro ls.cro mkdir.cro mv.cro pax.cro pwd.cro rm.cro sh.cro stty.cro disklabel.cro dmesg.cro fsck.cro fsck_ffs.cro ifconfig.cro init.cro mknod.cro mount.cro mount_cd9660.cro mount_ffs.cro mount_msdos.cro mount_nfs.cro mount_tmpfs.cro newfs.cro ping.cro reboot.cro route.cro swapctl.cro umount.cro ftp.cro gzip.cro sed.cro chown.cro chroot.cro dd.cro df.cro ed.cro mt.cro rcmd.cro sync.cro fdisk.cro restore.cro more.cro wpa_cli.cro  libhack.o -lbz2 -ledit -lutil -lcurses -ltermcap -lrmt -lcrypt -ll -lm -lz -lprop       -L/root/thinit/work/obj/destdir.i386/usr/lib   -Wl,-rpath-link,/root/thinit/work/obj/destdir.i386/lib  -L/root/thinit/work/obj/destdir.i386/lib -Wl,-rpath-link,/root/thinit/work/obj/destdir.i386/usr/lib  -L/root/thin
 it/work/obj/destdir.i386/usr/lib
/root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o): In function `_endpwent':
getpwent.c:(.text+0x110): multiple definition of `_endpwent'
libhack.o:: first defined here
/root/thinit/work/tools/lib/gcc/i386--netbsdelf/4.1.3/../../../../i386--netbsdelf/bin/ld: Warning: size of symbol `_endpwent' changed from 49 in libhack.o to 63 in /root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o)
/root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o): In function `_getpwent':
getpwent.c:(.text+0x378): multiple definition of `_getpwent'
libhack.o:: first defined here
/root/thinit/work/tools/lib/gcc/i386--netbsdelf/4.1.3/../../../../i386--netbsdelf/bin/ld: Warning: size of symbol `_getpwent' changed from 69 in libhack.o to 88 in /root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o)
/root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o): In function `_getpwnam':
getpwent.c:(.text+0x2a4): multiple definition of `_getpwnam'
libhack.o:: first defined here
/root/thinit/work/tools/lib/gcc/i386--netbsdelf/4.1.3/../../../../i386--netbsdelf/bin/ld: Warning: size of symbol `_getpwnam' changed from 49 in libhack.o to 92 in /root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o)
/root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o): In function `_getpwnam_r':
getpwent.c:(.text+0x228): multiple definition of `_getpwnam_r'
libhack.o:: first defined here
/root/thinit/work/tools/lib/gcc/i386--netbsdelf/4.1.3/../../../../i386--netbsdelf/bin/ld: Warning: size of symbol `_getpwnam_r' changed from 102 in libhack.o to 123 in /root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o)
/root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o): In function `_getpwuid':
getpwent.c:(.text+0x1cc): multiple definition of `_getpwuid'
libhack.o:: first defined here
/root/thinit/work/tools/lib/gcc/i386--netbsdelf/4.1.3/../../../../i386--netbsdelf/bin/ld: Warning: size of symbol `_getpwuid' changed from 49 in libhack.o to 92 in /root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o)
/root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o): In function `_getpwuid_r':
getpwent.c:(.text+0x150): multiple definition of `_getpwuid_r'
libhack.o:: first defined here
/root/thinit/work/tools/lib/gcc/i386--netbsdelf/4.1.3/../../../../i386--netbsdelf/bin/ld: Warning: size of symbol `_getpwuid_r' changed from 102 in libhack.o to 123 in /root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o)
/root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o): In function `_setpassent':
getpwent.c:(.text+0xb4): multiple definition of `_setpassent'
libhack.o:: first defined here
/root/thinit/work/tools/lib/gcc/i386--netbsdelf/4.1.3/../../../../i386--netbsdelf/bin/ld: Warning: size of symbol `_setpassent' changed from 30 in libhack.o to 92 in /root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o)
/root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o): In function `_setpwent':
getpwent.c:(.text+0x74): multiple definition of `_setpwent
libhack.o:: first defined here
/root/thinit/work/tools/lib/gcc/i386--netbsdelf/4.1.3/../../../../i386--netbsdelf/bin/ld: Warning: size of symbol `_setpwent' changed from 18 in libhack.o to 63 in /root/thinit/work/obj/destdir.i386/usr/lib/libc.a(getpwent.o)
collect2: ld returned 1 exit status
>How-To-Repeat:
1) cd src/distrib/i386/ramdisks/ramdisk-rescuetiny

2) Add the following lines to list:
SRCDIRS usr.sbin/wpa
PROG	usr/sbin/wpa_cli

3) make
>Fix:


>Release-Note:

>Audit-Trail:
From: Stephen Borrill <netbsd@precedence.co.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/40003: Adding wpa_cli to a ramdisk has duplicate symbols
Date: Sun, 23 Nov 2008 21:34:53 +0000 (GMT)

 dholland pointed out that thisproblem is due to a missing symbol in 
 the libhack version of the source file meaning that the libc version was 
 being pulled in.

 Here's a fix:

 Index: distrib/utils/libhack/getpwent.c
 ===================================================================
 RCS file: /cvsroot/src/distrib/utils/libhack/getpwent.c,v
 retrieving revision 1.9
 diff -u -r1.9 getpwent.c
 --- distrib/utils/libhack/getpwent.c	31 Mar 2005 12:56:49 -0000	1.9
 +++ distrib/utils/libhack/getpwent.c	23 Nov 2008 19:36:40 -0000
 @@ -40,6 +40,7 @@
   #ifdef __weak_alias
   #define endpwent		_endpwent
   #define getpwent		_getpwent
 +#define getpwent_r		_getpwent_r
   #define getpwuid		_getpwuid
   #define getpwnam		_getpwnam
   #define setpwent		_setpwent
 @@ -49,6 +50,7 @@

   __weak_alias(endpwent,_endpwent)
   __weak_alias(getpwent,_getpwent)
 +__weak_alias(getpwent_r,_getpwent_r)
   __weak_alias(getpwuid,_getpwuid)
   __weak_alias(getpwnam,_getpwnam)
   __weak_alias(setpwent,_setpwent)
 @@ -90,6 +92,22 @@
   	return (&_pw_passwd);
   }

 +int
 +getpwent_r(struct passwd *pwres, char *buf, size_t bufsiz,
 +    struct passwd **pwd)
 +{
 +	int rval;
 +
 +	if (!_pw_fp && !pwstart())
 +		return 1;
 +	rval = !pwscan(0, 0, NULL, pwres, buf, bufsiz);
 +	if (rval)
 +		*pwd = NULL;
 +	else
 +		*pwd = pwres;
 +	return rval;
 +}
 +
   struct passwd *
   getpwnam(const char *name)
   {

Responsible-Changed-From-To: bin-bug-people->sborrill
Responsible-Changed-By: sborrill@NetBSD.org
Responsible-Changed-When: Fri, 28 Nov 2008 08:19:12 +0000
Responsible-Changed-Why:
I reported it, so I'll fix it


From: Stephen Borrill <sborrill@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/40003 CVS commit: src/distrib/utils/libhack
Date: Fri, 28 Nov 2008 19:39:00 +0000 (UTC)

 Module Name:	src
 Committed By:	sborrill
 Date:		Fri Nov 28 19:39:00 UTC 2008

 Modified Files:
 	src/distrib/utils/libhack: getpwent.c

 Log Message:
 Add cut-down getpwent_r() to join existing getpwent() and friends. This
 fixes PR 40003


 To generate a diff of this commit:
 cvs rdiff -r1.9 -r1.10 src/distrib/utils/libhack/getpwent.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: sborrill@NetBSD.org
State-Changed-When: Fri, 28 Nov 2008 19:42:52 +0000
State-Changed-Why:
Fixed by applying included patch


From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/40003 CVS commit: [netbsd-5] src/distrib/utils/libhack
Date: Sat, 29 Nov 2008 20:52:49 +0000 (UTC)

 Module Name:	src
 Committed By:	bouyer
 Date:		Sat Nov 29 20:52:49 UTC 2008

 Modified Files:
 	src/distrib/utils/libhack [netbsd-5]: getpwent.c

 Log Message:
 Pull up following revision(s) (requested by sborrill in ticket #141):
 	distrib/utils/libhack/getpwent.c: revision 1.10
 Add cut-down getpwent_r() to join existing getpwent() and friends. This
 fixes PR 40003


 To generate a diff of this commit:
 cvs rdiff -r1.9 -r1.9.28.1 src/distrib/utils/libhack/getpwent.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.