Re: warn if GUC set to an invalid shared library

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, "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: 2023-07-06 20:15:19
Message-ID: ZKcg1w4FoYq/4M4V@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 29, 2022 at 10:40 AM Justin Pryzby <pryzby(at)telsasoft(dot)com> wrote:
> > > > On Fri, Sep 02, 2022 at 05:24:58PM -0500, Justin Pryzby wrote:
> > > > > It caused no issue when I changed:
> > > > >
> > > > > /* Check that it's acceptable for the indicated parameter */
> > > > > if (!parse_and_validate_value(record, name, value,
> > > > > - PGC_S_FILE, ERROR,
> > > > > + PGC_S_TEST, ERROR,
> > > > > &newval, &newextra))
> > > > >
> > > > > I'm not sure where to go from here.
> > > >
> > > > I'm hoping for some guidance ; this simple change may be naive, but I'm not
> > > > sure what a wider change would look like.

I'm still hoping.

> > PGC_S_TEST is a better fit, so my question is whether it's really that
> > simple ?
>
> I've added the trivial change as 0001 and re-opened the patch (which ended
> up in January's CF)
>
> If for some reason it's not really as simple as that, then 001 will
> serve as a "straw-man patch" hoping to elicit discussion on that point.

> From defdb57fe0ec373c1eea8df42f0e1831b3f9c3cc Mon Sep 17 00:00:00 2001
> From: Justin Pryzby <pryzbyj(at)telsasoft(dot)com>
> Date: Fri, 22 Jul 2022 15:52:11 -0500
> Subject: [PATCH v6 1/4] WIP: test GUCs from ALTER SYSTEM as PGC_S_TEST not
> FILE
>
> WIP: ALTER SYSTEM should use PGC_S_TEST rather than PGC_S_FILE
>
> Since the value didn't come from a file. Or maybe we should have
> another PGC_S_ value for this, or a flag for 'is a test'.
> ---
> src/backend/utils/misc/guc.c | 2 +-
> src/include/utils/guc.h | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
> index 6f21752b844..ae8810591d6 100644
> --- a/src/backend/utils/misc/guc.c
> +++ b/src/backend/utils/misc/guc.c
> @@ -4435,7 +4435,7 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
>
> /* Check that it's acceptable for the indicated parameter */
> if (!parse_and_validate_value(record, name, value,
> - PGC_S_FILE, ERROR,
> + PGC_S_TEST, ERROR,
> &newval, &newextra))
> ereport(ERROR,
> (errcode(ERRCODE_INVALID_PARAMETER_VALUE),

This is rebased over my own patch to enable checks for
REGRESSION_TEST_NAME_RESTRICTIONS.

--
Justin

Attachment Content-Type Size
0001-WIP-test-GUCs-from-ALTER-SYSTEM-as-PGC_S_TEST-not-FI.patch text/x-diff 1.6 KB
0002-warn-when-setting-GUC-to-a-nonextant-library.patch text/x-diff 10.8 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2023-07-06 20:18:07 Re: Disabling Heap-Only Tuples
Previous Message Daniel Gustafsson 2023-07-06 20:10:16 Re: Setting restrictedtoken in pg_regress