Re: pgsql: pg_logicalinspect: Fix possible crash when passing a directory p

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: pg_logicalinspect: Fix possible crash when passing a directory p
Date: 2025-03-12 21:26:37
Message-ID: CAD21AoA-W2nsKvB+eSUvGeJqxocJhwEWLhgGNC=o+G22s5LJcw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Tue, Mar 11, 2025 at 10:18 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> writes:
> > On Tue, Mar 11, 2025 at 7:08 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> >> This introduces a new compiler warning for compilers that don't know
> >> the ereport(ERROR) does not return.
>
> > Thank you for the report. Can we generate the warning using some gcc's
> > warning flags? I'd like to add a check to my personal pre-commit test.
>
> I don't know of an easy way. I experimented with doing this:
>
> diff --git a/src/include/c.h b/src/include/c.h
> index a14c6315162..467b1f58ae8 100644
> --- a/src/include/c.h
> +++ b/src/include/c.h
> @@ -315,7 +315,7 @@
> #elif defined(_MSC_VER) && !defined(USE_ASSERT_CHECKING)
> #define pg_unreachable() __assume(0)
> #else
> -#define pg_unreachable() abort()
> +#define pg_unreachable() ((void) 0)
> #endif
>
> /*
>
> which seems like it ought to be enough to provoke such warnings
> (in assert-enabled builds). I got upwards of sixty build warnings
> this way, but the place David mentions was *not* among them.
> So I'm confused.

Thanks. In my environment, I got the warning by this way.

And I've pushed the fix.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2025-03-12 23:50:17 pgsql: Add b955df443 to .git-blame-ignore-revs
Previous Message Masahiko Sawada 2025-03-12 21:24:05 pgsql: Fix compiler warning in pg_logicalinspect.