Reputation: 62
I have a build of PostgreSQL's Initdb utility that was compiled and linked on a remote build server running Fedora. On my system (Ubuntu 13.04 64-bit) when the utility is run using the command initdb -D /home/me/postgres_files/ -L /home/me/postgres_init_files/
the following is returned:
initdb: could not obtain information about current user: Success
This does not occur if I build the utility locally, only with a remote build from our build farm. I have so far managed to track the issue down to the following piece of code in initdb.c
:
pw = getpwuid(geteuid());
if (!pw)
{
fprintf(stderr,
_("%s: could not obtain information about current user: %s\n"),
progname, strerror(errno));
exit(1);
}
It would seem that either the call to geteuid() or getpwuid() is failing, but errno is not being set by the failing function. Unfortunately I can't easily go in and debug the utility directly as this only occurs on a remotely build version of the utility!
I would be greatly appreciative if anyone could shed some light on this.
Thanks.
Upvotes: 0
Views: 562
Reputation: 70981
Referring the "inconsistent" error message:
If getpwuid()
returns NULL
, this not necessarilly needs to inidicate an error.
From man getpwuid
(italic emphasis by me):
The getpwuid() function returns a pointer to a structure containing the broken-out fields of the record in the password database that matches the user ID uid.
[...]
The getpwnam() and getpwuid() functions return a pointer to a passwd structure, or NULL if the matching entry is not found or an error occurs.
From the fact that errno
seems to be 0
anf those two statments above I'd conclude that the result of geteuid()
simply could not be found by getpwuid()
.
Upvotes: 1