This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
- From: "vapier at gentoo dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Sun, 10 Aug 2014 12:35:26 +0000
- Subject: [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=17250
Bug ID: 17250
Summary: static linking breaks nss loading
(getaddrinfo/getpwnam/etc...)
Product: glibc
Version: 2.19
Status: NEW
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: vapier at gentoo dot org
CC: drepper.fsp at gmail dot com, macro@linux-mips.org
it looks like the change landed for bug 16046 broke static dlopening of nss
modules. if you try to use getaddrinfo/getpwnam/etc..., they just return
errors immediately.
example tests:
$ cat test.c
#include <sys/types.h>
#include <pwd.h>
#include <stdio.h>
int main() {
void *p = getpwnam("root");
printf("%p\n", p);
return p == NULL ? 1 : 0;
}
$ gcc test.c && ./a.out
0x7f6aec59a0e0
$ gcc -static test.c && ./a.out
(nil)
$ cat test.c
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <net/if.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
#include <string.h>
int main(int argc, char *argv[])
{
const char *host = argv[1];
int rc;
struct addrinfo *result = NULL;
struct addrinfo hint;
memset(&hint, 0 , sizeof(hint));
hint.ai_family = AF_INET;
hint.ai_socktype = SOCK_STREAM;
hint.ai_flags = AF_UNSPEC;
rc = getaddrinfo(host, NULL, &hint, &result);
if (rc || !result) {
printf("bad address '%s'\n", host);
return 1;
} else
return 0;
}
$ gcc test.c && ./a.out localhost
$ gcc -static test.c && ./a.out localhost
bad address 'localhost'
--
You are receiving this mail because:
You are on the CC list for the bug.