Red Hat Bugzilla – Bug 111827
--enable-static-nss does not support nsswitch "compat"
Last modified: 2016-11-24 10:13:06 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030701
Description of problem:
and program compiled using "-static" (->.a) currently supports
/etc/nsswitch.conf fields "files" and "dns". It does not support "compat".
Some distributions such as VectorLinux define "compat" for "passwd"
and "group" nsswitch items. getpwuid(2) etc. fails there for
--enable-static-nss built binaries.
I am not aware of any incompatibilities brought by this patch.
Sure the "nis" part of "compat" feature is still missing if
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. /etc/nsswitch.conf: passwd: compat
2. glibc/configure --enable-static-nss
3. echo 'getpwuid(0);' >>program.c
4. gcc -static -o program program.c
Actual Results: ./program getpwuid(0) returns NULL
Expected Results: ./program getpwuid(0) returns "root"
Created attachment 96447 [details]
Patch translating "compat" to "files" for libc.a in --enable-static-nss case (where no "compat" is supported anyway).
Why have you filed this bug against RHL9 though?
We don't ship glibc built with --enable-static-nss, nor recommend it in any way
(that option is solely for glibc bootstrapping purposes).
And for bootstrapping purposes you can easily edit your nsswitch.conf.
I use --enable-static-nss rebuilt glibc to build Linux distribution
independent fully-static binaries of a product on RHL9 build host.
You can consider this patch as RFE instead.
I do not mind the patch import, my separate patch is OK for my purposes.