From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, nicolas(at)marchildon(dot)net, Bugs for PostgreSQL <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #8139: initdb: Misleading error message when current user not in /etc/passwd |
Date: | 2013-12-09 21:05:32 |
Message-ID: | 20131209210532.GA2119@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Wed, Dec 4, 2013 at 04:03:39PM -0300, Alvaro Herrera wrote:
> Bruce Momjian wrote:
> > On Tue, May 7, 2013 at 02:19:05PM -0400, Alvaro Herrera wrote:
>
> > I have developed the attached patch to fix this and another instance I
> > saw.
>
> Remember to set errno = 0 before calling the getpw* function; at least
> in initdb it would be meaningful. And in the pg_upgrade case, it seems
> better to abort the upgrade if this call doesn't work. (Also, there are
> other uses of getpwuid/getpwnam elsewhere. Not sure we want to worry
> too much about them.)
Wow, that is an odd API. Once I started to look at all the errno
clearing necessary, I realized that the function in bin/scripts/common.c
could be moved to src/port and generalized to reduce code duplication.
Updated patch attached, with centralized checking for errno and more
consistent behavior for username lookups.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
Attachment | Content-Type | Size |
---|---|---|
passwd.diff | text/x-diff | 18.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2013-12-09 21:35:56 | Re: BUG #8139: initdb: Misleading error message when current user not in /etc/passwd |
Previous Message | Alvaro Herrera | 2013-12-09 19:00:32 | Re: BUG #8673: Could not open file "pg_multixact/members/xxxx" on slave during hot_standby |