Re: warn if GUC set to an invalid shared library

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Cary Huang <cary(dot)huang(at)highgo(dot)ca>, Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com>
Subject: Re: warn if GUC set to an invalid shared library
Date: 2024-07-22 16:28:23
Message-ID: Zp6IpxVT1U-qmMOC@pryzbyj2023
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, May 24, 2024 at 01:15:13PM -0400, Robert Haas wrote:
> + /* Note that filename was already canonicalized */
>
> I see that this comment is copied from load_libraries(), but I don't
> immediately see where the canonicalization actually happens. Do you
> know, or can you find out? Because that's crucial here, else stat()
> might not target the real filename. I wonder if it will anyway. Like,
> couldn't the library be versioned, and might not dlopen() try a few
> possibilities?

This comment made me realize that we've been fixated on the warning.
But the patch was broken, and would've always warned. I think almost
all of the previous patch versions had this issue - oops.

I added a call to expand_dynamic_library_name(), which seems to answer
your question.

And added a preparatory patch to distinguish ALTER USER/DATABASE SET
from SET in a function, to avoid warning in that case.

--
Justin

Attachment Content-Type Size
0001-change-function-SET-to-use-a-separate-GUC-source.patch text/x-diff 11.7 KB
0002-warn-when-setting-GUC-to-a-nonextant-library.patch text/x-diff 10.7 KB
0003-errcontext-if-server-fails-to-start-due-to-library-G.patch text/x-diff 4.5 KB
0004-show-the-GUC-source-in-errcontext.patch text/x-diff 3.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2024-07-22 16:34:42 Re: [18] Policy on IMMUTABLE functions and Unicode updates
Previous Message Masahiko Sawada 2024-07-22 16:07:32 Re: xid_wraparound tests intermittent failure.