public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Jacob Champion <[email protected]>
Cc: [email protected]
Cc: [email protected]
Subject: Re: BUG #19388: Failing to connect to postgres with EACCES error
Date: Fri, 23 Jan 2026 15:31:48 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAOYmi+ki-_iH6-r-JzXQGur8Jt-iefMhKPhFZWWatrqt0RpFBg@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<CAOYmi+ki-_iH6-r-JzXQGur8Jt-iefMhKPhFZWWatrqt0RpFBg@mail.gmail.com>

Jacob Champion <[email protected]> writes:
> On Fri, Jan 23, 2026 at 7:35 AM Tom Lane <[email protected]> wrote:
>> If anything, I'd lean towards removing the special exception for
>> ENOTDIR ... I wonder why that's there.

> I think removing that would take some adjustments to
> pqGetHomeDirectory(), so that it actually checks for the existence of
> that directory before returning true. `have_homedir` is kind of a
> misleading name in this context.

I dug into our git history and traced the appearance of ENOTDIR to

commit 5b40677986984d450a2a16e515fe44d90dfeef02
Author: Magnus Hagander <[email protected]>
Date:   Sat Dec 3 15:02:53 2011 +0100

    Treat ENOTDIR as ENOENT when looking for client certificate file
    
    This makes it possible to use a libpq app with home directory set
    to /dev/null, for example - treating it the same as if the file
    doesn't exist (which it doesn't).
    
    Per bug #6302, reported by Diego Elio Petteno

We could imagine pushing the stat() test into pqGetHomeDirectory,
which might be a more sensible factorization, but I don't think
it'd move the behavior much.

			regards, tom lane






reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: BUG #19388: Failing to connect to postgres with EACCES error
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox