From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 4837 invoked from network); 27 Jun 2000 21:23:00 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 27 Jun 2000 21:23:00 -0000 Received: from ellpspace.math.ualberta.ca (michal@ellpspace.math.ualberta.ca [129.128.88.19]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id RAA30268 for ; Tue, 27 Jun 2000 17:22:59 -0400 Received: (from michal@localhost) by ellpspace.math.ualberta.ca (8.9.3/8.9.3) id PAA11429 for axp-list@redhat.com; Tue, 27 Jun 2000 15:22:54 -0600 From: Michal Jaegermann Message-Id: <200006272122.PAA11429@ellpspace.math.ualberta.ca> Subject: Problems when compiling -static To: axp-list@redhat.com Date: Tue, 27 Jun 2000 15:22:54 -0600 (MDT) X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Before I will start to tear the whole system apart - does anybody has a handle on that? I do not recall seeing something of that sort. The following program (file, say, 'name.c'): #include #include #include #include int main (int argc, char *argv[]) { struct passwd *pw; uid_t uid = 0; if (argc > 1) { uid = atoi(argv[1]); } pw = getpwuid(uid); printf("%p\n", pw); if (pw) { printf("%s\n", pw->pw_name); } return 0; } compiled on RH 6.2 on alpha with 'gcc -o name name.c' behaves like expected. That means that it prints things of that sort: $ ./name 0x2000034ff08 root $ ./name 99 0x2000034ff08 nobody But compiled with 'gcc -static -o name name.c' it will print $ ./name (nil) $ ./name 99 (nil) In other words getpwuid() always returns NULL if '-static' is present. Changing optimization levels, versions of a compiler or a version of binutils does not seem to have any effect; but when compiling on RH 6.1 distro everything looks ok. Still executables compiled 'static' on RH 6.1, and running there correctly, will exhibit the same faulty behaviour when copied to RH 6.2 installation (in other words, they are not that static; bummer!). I have reasons to suspect that libnss_... stuff is messed up here but maybe only as a side effect? I will be grateful for any hits. Oh, BTW, /etc/nsswitch.conf is sane on the system in question. Michal