Subject: Re: FreeBSD hosted build problem: mtree and user_from_uid()
To: None <current-users@NetBSD.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: current-users
Date: 10/08/2003 17:08:18
On Wed, Oct 08, 2003 at 12:01:32 +0000, Mark Valentine wrote:

> 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!).

We have an example of a workaround for this conflict in compat_pwd.h.

I think pwcache.c should not test for HAVE_USER_FROM_UID at all to
avoid schizophrenic situations like the one you describe.

I wonder if we should ever bother to test for host pwcache_userdb.
May be always using our own compat version might be a good idea.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen