Re: Patch to be verbose about being unable to read

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Sean Chittenden <sean(at)chittenden(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Patch to be verbose about being unable to read
Date: 2003-06-20 14:01:15
Message-ID: 17716.1056117675@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Sean Chittenden writes:
>> Howdy. Quick chump patch: if libpq finds a ~/.pgpass but can't stat
>> it, print something to stderr letting the user know. If someone went
>> out of their way to put a .pgpass file in place, if they can't read
>> it, it seems worth while to alert them to the fact that it's not being
>> used (ex: root creates a .pgpass file but forgets to chown it).

> You cannot assume that stderr is meaningful in all applications using
> libpq. (Consider PHP.) I think you need to report this using the normal
> error reporting mechanism.

But it's not an error; we must not fail the connection attempt just
because of this.

I'd suggest using the NOTICE mechanism, except that during connection
setup the client app has not yet had a chance to set a notice processor,
so Peter's objection still holds.

On the whole, I'm not sure we have a problem we need to fix there. If
.pgpass isn't readable, it's not going to take that long for the user to
figure it out.

OTOH --- there already is a print-to-stderr in the code for the case
where .pgpass exists and has insecure permissions. Taking Peter's
complaint into account, I wonder whether we shouldn't make that case a
hard error (connect failure) to ensure that the user notices the problem
and does something about it promptly. IIRC, the postmaster refuses to
start if $PGDATA has insecure permissions, so there's precedent.

regards, tom lane

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-06-20 14:14:58 Re: [HACKERS] Subtraction carry bug in xlog.c in 7.3 and 7.4
Previous Message J.R. Nield 2003-06-20 13:17:56 Subtraction carry bug in xlog.c in 7.3 and 7.4