Re: BUG #8139: initdb: Misleading error message when current user not in /etc/passwd

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: nicolas(at)marchildon(dot)net, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8139: initdb: Misleading error message when current user not in /etc/passwd
Date: 2013-05-07 18:19:05
Message-ID: 20130507181904.GA26800@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:
> nicolas(at)marchildon(dot)net writes:

> > The man page says:
>
> > RETURN VALUE
> > 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. If an error occurs, errno is set appropriately. If one
> > wants
> > to check errno after the call, it should be set to zero before
> > the
> > call.
>
> AFAICS, getpwuid is not honoring its specification here: it failed to
> set errno. I don't see that suppressing the strerror result would add
> anything much.

Well, in this case no error occured, but no matching entry was found.
The wording in the manpage is explicit that there not being an entry is
not an error.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Raphael 2013-05-07 20:14:45 question
Previous Message Tom Lane 2013-05-07 18:10:28 Re: BUG #8139: initdb: Misleading error message when current user not in /etc/passwd