Description of problem: initgroup() function does not work when linked in statically. The following bug.c file demonstrates the problem. Version-Release number of selected component (if applicable): glibc-2.3.2-95.6 How reproducible: a.out username Steps to Reproduce: 1. gcc -g bug.c -static 2. ./a.out username 3. (use a username that exists above) Actual results: segmantation fault Expected results: Starting test Test finished successfully! Additional info:
Created attachment 98200 [details] A test case Just by removing -static at the compilation line will make it work. The same source compiled with -static switch works on regular x86 Linux platforms it seems. A bug in static library where initgroup() is defined..?
Cannot reproduce here with glibc-2.3.2-95.14. What kind of NSS modules you're using? Has the binary been linked against the same glibc version as it has been run?
I don't have access to this machine anymore, but it should be the standard installation from that RH distribution, which comes with glibc-2.3.2-95.6. The machine was setup with standard installation so that support for it is valid. Yes, the test case was compiled on the machine on which it was run on. I tested on regular x86 Linuxes and with the RH EL3, It works on all platforms, including RH EL3, but adding the -static to the compilation line will make it fail on RH EL3, and only there and only in that case. It could be related to that 2.3.2-95.6 glibc version. In short, I made the exact 3 steps as in the example above in all machines where I tested it. The test case was always compiled on the same platform which it was run on, in both cases with and without -static.
Changing product and version.
You failed to answer the question. The issue here is the initgroups call which uses NSS. NSS requires dynamic linking and dynamic linking support in statically linked bianries is very limited. If you do not run nscd, then the only NSS module you can use is libnss_files. If this is not enough, use nscd. Nothing else is supported. Since we cannot reproduce any problem I'll close it. Reopen in case you can provide a test case which fails.