From nobody@FreeBSD.org  Sun Sep 29 21:17:31 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5E91437B401
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 29 Sep 2002 21:17:31 -0700 (PDT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1EAF843E4A
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 29 Sep 2002 21:17:31 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.6/8.12.6) with ESMTP id g8U4HU7R004326
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 29 Sep 2002 21:17:30 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.6/8.12.6/Submit) id g8U4HUZK004325;
	Sun, 29 Sep 2002 21:17:30 -0700 (PDT)
Message-Id: <200209300417.g8U4HUZK004325@www.freebsd.org>
Date: Sun, 29 Sep 2002 21:17:30 -0700 (PDT)
From: John Mechalas <seagull@aracnet.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: getpwnam, getpwuid fail when linking against Berkley DB v2
X-Send-Pr-Version: www-1.0

>Number:         43501
>Category:       kern
>Synopsis:       getpwnam(3), getpwuid fail when linking against Berkley DB v2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    vwe
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 29 21:20:01 PDT 2002
>Closed-Date:    Wed Aug 18 18:55:02 UTC 2010
>Last-Modified:  Wed Aug 18 18:55:02 UTC 2010
>Originator:     John Mechalas
>Release:        4.6.2-RELEASE
>Organization:
>Environment:
FreeBSD medley 4.6.2-RELEASE FreeBSD 4.6.2-RELEASE #0: Sat Sep 28 11:05:14 PDT 2002     root@medley:/usr/src/sys/compile/MEDLEY  i386

>Description:
When linking a program against libdb2, from the Berkley DB v2 package,
calls to getpwuid(2) and getpwnam(2) fail on EINVAL.  Note that you 
don't actually have to invoke any of the DB functions...merely linking
against the library is enough to cause a failure.

This problem *may* be related to PR bin/21659.

getpw* work if you link against BDB v3 or v4.
>How-To-Repeat:
Compile this program and link with -ldb2:

#include <sys/types.h>
#include <unistd.h>
#include <pwd.h>
#include <stdio.h>
#include <db2/db.h>

int main (int argc, char **argv)
{
        struct passwd *pw;

        pw= getpwuid(getuid());
        if ( pw == NULL ) {
                perror("getpwuid");
                return 1;
        }
        printf("name= %s\n", pw->pw_name);
}


[medley] /local/export1/home/johnm/src/db > make
cc -c main.c -I/usr/local/include
cc -o main main.o -L/usr/local/lib -ldb2
[medley] /local/export1/home/johnm/src/db > ./main 
getpwuid: Invalid argument
[medley] /local/export1/home/johnm/src/db > 


>Fix:

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: vwe 
State-Changed-When: Wed Aug 18 18:19:05 UTC 2010 
State-Changed-Why:  
Chances are, this PR will get it's 10th birthday still unsolved. 
I was able to get into the same problem on a 7.3-STABLE system with databases/db2 installed. 
Test files, truss output can be found at: 
http://people.freebsd.org/~vwe/gnats/pr43501/ 
I don't think this problem is still that important, but if a developer is bored enough... ;) 
Dear submitter: If you think, this PR can be closed even while the problem is still there, please report back and we'll be happy to close. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=43501 
State-Changed-From-To: analyzed->closed 
State-Changed-By: vwe 
State-Changed-When: Wed Aug 18 18:53:16 UTC 2010 
State-Changed-Why:  
WONTFIX: submitter is happy to close this before it's 10th anniversary ;) 
Thank you for reporting back, John! 


Responsible-Changed-From-To: freebsd-bugs->vwe 
Responsible-Changed-By: vwe 
Responsible-Changed-When: Wed Aug 18 18:53:16 UTC 2010 
Responsible-Changed-Why:  
track 

http://www.freebsd.org/cgi/query-pr.cgi?pr=43501 
>Unformatted:
