public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...)
@ 2014-08-10 12:35 vapier at gentoo dot org
  2014-08-10 12:35 ` [Bug libc/17250] " vapier at gentoo dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: vapier at gentoo dot org @ 2014-08-10 12:35 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-09-26 18:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-10 12:35 [Bug libc/17250] New: static linking breaks nss loading (getaddrinfo/getpwnam/etc...) vapier at gentoo dot org
2014-08-10 12:35 ` [Bug libc/17250] " vapier at gentoo dot org
2014-08-10 13:13 ` vapier at gentoo dot org
2014-10-21  8:50 ` aurelien at aurel32 dot net
2014-10-21  8:51 ` aurelien at aurel32 dot net
2014-10-21  8:57 ` aurelien at aurel32 dot net
2014-10-22 10:58 ` aurelien at aurel32 dot net
2015-08-27 21:54 ` [Bug nss/17250] " jsm28 at gcc dot gnu.org
2015-09-25  9:15 ` cvs-commit at gcc dot gnu.org
2015-09-25  9:21 ` [Bug dynamic-link/17250] " macro@linux-mips.org
2015-09-25 14:04 ` vapier at gentoo dot org
2015-09-26 18:42 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).