Subject: Re: FreeBSD hosted build problem: mtree and user_from_uid()
To: Luke Mewburn <lukem@NetBSD.org>
From: Mark Valentine <mark@valentine.me.uk>
List: current-users
Date: 10/08/2003 12:01:32
> From: Luke Mewburn <lukem@NetBSD.org>
> Date: Wed 8 Oct, 2003
> Subject: Re: FreeBSD hosted build problem: mtree and user_from_uid()

> I have no idea why the user_from_uid() in the tools/compat library isn't 
> being correctly linked into nbmtree... :(

Because the configure script is testing for its presence on the host
separately, and pwcache.c has:

    #if !HAVE_PWCACHE_USERDB
    #if !HAVE_USER_FROM_UID
    const char *
    user_from_uid(uid_t uid, int noname)
    {
    ...
    }
    #endif /* HAVE_USER_FROM_UID */

    int
    pwcache_userdb(
	    int             (*a_setpassent)(int),
	    void            (*a_endpwent)(void),
	    struct passwd * (*a_getpwnam)(const char *),
	    struct passwd * (*a_getpwuid)(uid_t))
    {
    ...
    }
    #endif  /* !HAVE_PWCACHE_USERDB */

FreeBSD has user_from_uid(), but no pwcache_userdb(), and no pwcache.h.

I naively tried just editing config.h to #define HAVE_USER_FROM_UID 0 (shortcut
for just removing the test for that function from configure.ac, I think), but
then the build blows up due to a conflicting declaration of user_from_uid() in
the host's <stdlib.h> (argh!).

		Cheers,

		Mark.

-- 
"Tigers will do ANYTHING for a tuna fish sandwich."
"We're kind of stupid that way."   *munch* *munch*
  -- <http://www.calvinandhobbes.com>