Subject: Re: pkgtools on NetBSD 1.3.2
To: Paul Hoffman <phoffman@proper.com>
From: Simon Burge <simonb@netbsd.org>
List: tech-pkg
Date: 06/07/2000 12:08:14
Paul Hoffman wrote:

> Greetings. I'm running 1.3.2 on a system because it is the only one 
> that will build there (without me having to do a *bunch* of work). 
> I'd really like to build some of the packages there. I got the latest 
> pkgsrc tarball just fine. However, I have to build 
> pkgtoos/pkg_install first, and that build fails with:
> 
> all ===> delete
> cc  -Wl,-R/usr/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/lib  -o 
> pkg_delete main.o perform.o 
> -L/usr/pkgsrc/pkgtools/pkg_install/work/pkg_install/lib -linstall
> main.o: undefined symbol `_asprintf' referenced from text segment
> pen.o: warning: mktemp() possibly used unsafely, consider using mkstemp()
> *** Error code 1

asprintf() mallocs storage for you.  Probably the quickest way to work
around this would be to change the functions that use asprintf() (both
are the same) to something like:

	int
	find_fn(const char *pkg, char *data)
	{
		lpkg_t *lpp;
		char fn[1024]

		snprintf(fn, sizeof(fn), "%s/%s", _pkgdb_getPKGDB_DIR(), pkg);
		if (!isfile(fn)) {	/* might as well use sanity_check() */
			lpp = alloc_lpkg(pkg);
			TAILQ_INSERT_TAIL(&pkgs, lpp, lp_link);
		}
		return 0;
	}

The 1024 should be PATH_MAX, but I'm not sure if the right files are
included for this to be available (you'd need <limits.h>).  Note that
the above hasn't been tried, so it might not even compile...

Simon.