Bug 117301

Summary: A bug in static library
Product: Red Hat Enterprise Linux 3 Reporter: Jani Tolonen <jani>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED WORKSFORME QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: drepper
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-09-28 11:12:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
A test case none

Description Jani Tolonen 2004-03-02 18:04:27 UTC
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:

Comment 1 Jani Tolonen 2004-03-02 18:06:50 UTC
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..?

Comment 2 Jakub Jelinek 2004-03-02 23:43:34 UTC
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?

Comment 3 Jani Tolonen 2004-03-09 17:53:44 UTC
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.

Comment 4 David Lawrence 2004-03-15 18:56:58 UTC
Changing product and version.

Comment 5 Ulrich Drepper 2004-09-28 11:12:12 UTC
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.