Re: md5 issues Postgres14 on OL7 - Mailing list pgsql-general

From Tom Lane
Subject Re: md5 issues Postgres14 on OL7
Date
Msg-id 1521801.1641668416@sss.pgh.pa.us
Whole thread Raw
In response to Re: md5 issues Postgres14 on OL7  (Michael Paquier <michael@paquier.xyz>)
Responses Re: md5 issues Postgres14 on OL7  (Michael Paquier <michael@paquier.xyz>)
List pgsql-general
Michael Paquier <michael@paquier.xyz> writes:
> [ v3-0001-Improve-error-reporting-for-cryptohashes.patch ]

This is looking pretty solid to me.  Just a couple of nitpicks:

* In most places you initialize variables holding error strings to NULL:

+    const char *logdetail = NULL;

but there are three or so spots that don't, eg PerformRadiusTransaction.
They should be consistent.  (Even if there's no actual bug, I'd be
unsurprised to see Coverity carp about the inconsistency.)

* The comments for md5_crypt_verify and plain_crypt_verify claim that
the error string is "optionally" stored, but I don't see anything
optional about it.  To me, "optional" would imply coding like

    if (logdetail)
        *logdetail = errstr;

which we don't have here, and I don't think we need it.  But the
comments need adjustment.  (They were wrong before too, but no
time like the present to clean them up.)

* I'd be inclined to just drop the existing comments like

-     * We do not bother setting logdetail for any pg_md5_encrypt failure
-     * below: the only possible error is out-of-memory, which is unlikely, and
-     * if it did happen adding a psprintf call would only make things worse.

rather than modify them.   Neither the premise nor the conclusion
of these comments is accurate anymore.  (I think that the psprintf
they are talking about is the one that will happen inside elog.c
to construct an errdetail string.  Yeah, there's some risk there,
but I think it's minimal because of the fact that we preallocate
some space in ErrorContext.)

Other than those things, I think v3 is good to go.

            regards, tom lane



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: The postgres server don't work
Next
From: Thomas Munro
Date:
Subject: Re: create database hangs forever on WSL - autovacuum deadlock?