NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/42181: pwcache compat broken in OS X



>Number:         42181
>Category:       toolchain
>Synopsis:       pwcache compat broken in OS X
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 14 09:00:00 +0000 2009
>Originator:     Julio Merino
>Release:        NetBSD-current sources as of 2009/10/14
>Organization:
        
>Environment:
        
        
System: Darwin calypso 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 
PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
        Mac OS X Leopard 10.5.8.
Architecture: i386
Machine: i386
>Description:
        Cross-compilation of NetBSD on a Mac OS X Leopard host fails because
        mtree does not correctly handle user and group name.  mtree is messing
        up the NetBSD-specific user/group databases with the host ones.

        As an example, when mtree is run to populate destdir, the METALOG ends
        up containing an entry like the following:

            ./var/db/postfix type=dir uid=12 gname=everyone mode=0755

        uid should be postfix and gname should be postfix.  However, these have
        been "corrupted" and point to 12 and everyone.  uid is 12 because 12
        does not have any valid name in the local /etc/passwd.  gname is
        everyone because /etc/group defines 12 as such.

        I don't know when this started happening.  I seem to recall that I did
        previous builds on such a host before without problems, but I'm not
        sure.

        DIAGNOSIS

        Here comes my diagnosis of the problem, which may not be completely
        correct.

        OS X has native user_to_uid and group_to_gid functions, but lacks
        pwcache_groupdb and pwcache_userdb.  When we build pwcache.c from
        tools/compat, we detect this situation.

        The problem is that we only do a "partial replacement" of the native
        pwcache.  We provide our own pwcache_groupdb/userdb functions, but the
        original user_to_uid and group_to_gid functions remain in place.

        Later on, mtree is executed with -N to specify an alternative passwd
        database, and it calls our own pwcache_* functions to internally
        switch to the alternative database.  Unfortunately, when the database
        is queried later on through user_to_uid and group_to_gid functions, we
        use the native functions which bypass our replacement.

        I assume this is not working correctly because __weak_alias is not
        defined in OS X, and thus the dynamic replacement of all the functions
        with our compat ones is not working.
>How-To-Repeat:
        Cross-compile NetBSD-current on a Mac OS X Leopard host.
>Fix:
        Don't know what the best way to resolve this is.

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index