Subject: bin/36168: usr.bin/config without ecalloc/friends is harder to compile on older hosts
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Marc Tooley <netbsdMLpostNO@spam.quake.ca>
List: netbsd-bugs
Date: 04/18/2007 19:10:00
>Number:         36168
>Category:       bin
>Synopsis:       rev 1.6 removed emalloc/ecalloc from usr.bin/config (i think) improperly
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 18 19:10:00 +0000 2007
>Originator:     Marc Tooley
>Release:        NetBSD 3.99.23
>Organization:
	n/a
>Environment:
System: NetBSD shog 3.99.23 NetBSD 3.99.23 (shog) #6: Sun Aug 6 11:17:18 PDT 2006 root@shog:/v/src-current-build/sys/arch/i386/compile/shog i386
Architecture: i386
Machine: i386
>Description:
	in usr.bin/config/util.c christos removed ecalloc/emalloc from config
	However, this makes building it much more difficult: it's no longer
	quite so easy to rebuild config when updating a kernel manually

	Now, because of the missing symbols, a straight:

	make USETOOLS=no dependall

	... fails doubly. First, because of this:

	cc -O2  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare -Wno-traditional -Wno-format-y2k -Werror   -I/v/src-current/usr.bin/config -I.    -c    files.c
	cc1: warnings being treated as errors
	files.c: In function 'addfile':
	files.c:126: warning: implicit declaration of function 'ecalloc'
	files.c:126: warning: assignment makes pointer from integer without a cast
	files.c: In function 'addobject':
	files.c:178: warning: assignment makes pointer from integer without a cast
	*** Error code 1

	... but that's fixable by putting:

	NOGCCERROR=yes

	... into /etc/mk.conf

	However, the missing symbols are a bit more problematic:

	[ ... lots of: ]
	util.c:(.text+0x352): undefined reference to calloc'
	util.c:(.text+0x39e): undefined reference to malloc'
	*** Error code 1

	The CVS message from christos says:

	----[]-----
	- remove emalloc/estrdup etc. We have them in libutil.
	----[]-----

	But perhaps they were duplicated in config for a reason after all?
	
>How-To-Repeat:
	cvs update to the latest NetBSD -current in your slightly older
	build environment that doesn't have ecalloc and emalloc in -lutil.

	... then try to build usr.bin/config so you can update some kernels.
>Fix:
	Back out the removal of the functions, I guess. Tests here indicate
	it seems to work just fine.