Red Hat Bugzilla – Bug 51312
getpwuid() fails for uid=0 and uid=500
Last modified: 2007-04-18 12:35:39 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.2-2 i686)
Description of problem:
Steps to Reproduce:
Actual Results: See attachment
Expected Results: Should have received primed passwd structure
Created attachment 26993 [details]
debug material for bug 51312
Works just fine for me.
What's your content of nsswitch.conf, why you decided to print the
backtrace from _dl_debug_state, does it return NULL or what?
Execution of the pgm stops at the point of failure.
Here's the contents of /etc/nsswitch.conf
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
# Legal entries are:
# nisplus or nis+ Use NIS+ (NIS version 3)
# nis or yp Use NIS (NIS version 2), also called YP
# dns Use DNS (Domain Name Service)
# files Use the local files
# db Use the local database (.db) files
# compat Use NIS on compat mode
# hesiod Use Hesiod for user lookups
# [NOTFOUND=return] Stop searching if not found so far
# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
#passwd: db files nisplus nis
#shadow: db files nisplus nis
#group: db files nisplus nis
passwd: files nisplus
shadow: files nisplus
group: files nisplus
#hosts: db files nisplus nis dns
hosts: files nisplus dns
# Example - obey only what nisplus tells us...
#services: nisplus [NOTFOUND=return] files
#networks: nisplus [NOTFOUND=return] files
#protocols: nisplus [NOTFOUND=return] files
#rpc: nisplus [NOTFOUND=return] files
#ethers: nisplus [NOTFOUND=return] files
#netmasks: nisplus [NOTFOUND=return] files
bootparams: nisplus [NOTFOUND=return] files
protocols: files nisplus
services: files nisplus
netgroup: files nisplus
automount: files nisplus
aliases: files nisplus
It's looking more like a bug in the KDevelop debugger. My function A calls a function B which in turn calls getpwuid(). If I set breakpoints on either sided
of the call to function B and do a "run to cursor" then I don't appear to have any problems. But if I step into function B and attempt to step over the call to
getpwuid() or if I step over the call to function B, then the problem occurs.
I appear to have a similar problem with the gethostbyname() api. Any chance I have some kind of corruption or authority problem that would be causing
these calls to fail while debugging?
We (Red Hat) should really try to this this before next release.
Please attach the code that fails.
Here's a small program that causes the problem when stepping over getpwuid() statement using kdevelop's debugger.
int main(int argc, char *argv)
uid_t nUserID = getuid();
struct passwd *pPasswd = NULL;
pPasswd = (struct passwd *)getpwuid(nUserID);
I just tried it with kdbg here; I broke at main and stepped over all function
calls. It worked fine.