Re: Assert name/short_desc to prevent SHOW ALL segfault

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Steve Chavez <steve(at)supabase(dot)io>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Assert name/short_desc to prevent SHOW ALL segfault
Date: 2022-05-26 21:45:50
Message-ID: 20220526214550.GA1513741@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 24, 2022 at 11:17:39PM -0700, Andres Freund wrote:
> On 2022-05-24 11:41:49 -0700, Nathan Bossart wrote:
>> I would actually ERROR on this so that we aren't relying on
>> --enable-cassert builds to catch it.
>
> How about adding pg_nonnull(...) (ending up as __attribute__((nonnull(...))?
> Then code passing NULLs would get compiler warnings? It'd be useful in quite a
> few more places.

I attached an attempt at this for the "name" and "valueAddr" arguments for
the DefineCustomXXXVariable functions. It looked like nonnull was
supported by GCC and Clang, but I haven't looked too closely to see whether
we need version checks as well.

>> That being said, if there's no strong reason to enforce that a short
>> description be provided, then why not adjust ShowAllGUCConfig() to set that
>> column to NULL when short_desc is missing?
>
> There's a bunch more places that'd need to be adjusted, if we go that way. I
> don't really have an opinion on it.

I looked around and didn't see anywhere else obvious that needed adjustment
besides what Michael pointed out (3ac7d024). Am I missing something?

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v3-0001-Handle-a-NULL-short_desc-in-ShowAllGUCConfig.patch text/x-diff 4.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-05-26 21:50:40 Re: Remove support for Visual Studio 2013
Previous Message Tom Lane 2022-05-26 21:40:14 Re: Patch: Don't set LoadedSSL unless secure_initialize succeeds