Re: Documentation of .pgpass for Unix is incomplete

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: marc(at)msys(dot)ch, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Documentation of .pgpass for Unix is incomplete
Date: 2024-10-16 20:54:43
Message-ID: ZxAoE-V74KRR26Jb@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Mon, Aug 19, 2024 at 05:42:33PM -0700, David G. Johnston wrote:
> On Mon, Aug 19, 2024 at 5:06 PM Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> Well, it is more complicated than checking just HOME because it calls
> getpwuid_r() if HOME is not set:
>
>         https://doxygen.postgresql.org/fe-connect_8c.html#
> a3f49cbb20595c1765bd0db5ff434c9c3
>
> Is it worth going into that detail in the docs?
>
>
>
> Yes, "the user's home directory" and the "HOME" environment variable are
> distinct things.  The current docs are wrong.
>
> The .pgpass file, located in $HOME (a.k.a. ~) on non-Microsoft Windows systems,
> can contain passwords...  In the absence of the HOME environment variable, the
> path recorded as the user's home directory in the operating system's passwd
> file will be checked.  This is not a fallback mechanism - if HOME is set, and
> the file is not present there, this directory will not be checked).  On
> Microsoft Windows... Alternatively, the password file to use ...
>
> I"m somewhat loath to repeat that in:
> https://www.postgresql.org/docs/16/libpq-connect.html#LIBPQ-CONNECT-PASSFILE
>
> passfile
> Specifies the name of the file used to store passwords (see Section 34.16).
> Defaults to ~/.pgpass, or %APPDATA%\postgresql\pgpass.conf on Microsoft
> Windows. (No error is reported if this file does not exist.)
>
> So I'd suggest just removing the talk of defaults, changing it to:
>
> "Specifies the name of the file used to store passwords.  See Section 34.16 for
> details, including the default file name and path resolution mechanics."

I have written the attached patch to add the home directory details. I
specified in one place and referenced it to two others. Did I miss any
places?

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

When a patient asks the doctor, "Am I going to die?", he means
"Am I going to die soon?"

Attachment Content-Type Size
home.diff text/x-diff 2.3 KB

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2024-10-16 21:11:54 Re: incorrect (incomplete) description for "alter domain"
Previous Message Daniel Gustafsson 2024-10-16 09:49:57 Re: missing command?