Re: Assert name/short_desc to prevent SHOW ALL segfault - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Assert name/short_desc to prevent SHOW ALL segfault
Date
Msg-id 20220526214550.GA1513741@nathanxps13
Whole thread Raw
In response to Re: Assert name/short_desc to prevent SHOW ALL segfault  (Andres Freund <andres@anarazel.de>)
Responses Re: Assert name/short_desc to prevent SHOW ALL segfault
List 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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Patch: Don't set LoadedSSL unless secure_initialize succeeds
Next
From: Tom Lane
Date:
Subject: Re: Remove support for Visual Studio 2013