public inbox for [email protected]  
help / color / mirror / Atom feed
From: Álvaro Herrera <[email protected]>
To: Robert Haas <[email protected]>
Cc: Gurjeet Singh <[email protected]>
Cc: Postgres Hackers <[email protected]>
Subject: Re: lwlocknames.h beautification attempt
Date: Mon, 17 Mar 2025 16:38:52 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+TgmoaZssHgnrp1ZscrBz4Z76G966Q5oMrmS_T4T+wkfTsn6g@mail.gmail.com>

On 2025-Mar-17, Robert Haas wrote:

> On Mon, Mar 17, 2025 at 2:43 AM Álvaro Herrera <[email protected]> wrote:
> > Tom didn't say he didn't like this change.  He said he didn't like a
> > different change, which is not the one I committed.
> 
> Sorry, I should have read the emails more carefully. I missed the fact
> that there were two different proposals. It was the idea of
> right-aligning things that I was unhappy about.

Ah, okay.

> So, no objection to what you actually committed... except that I don't
> think that using % specifiers in SOME places in a format string is
> better than using them in ALL the places. It's not broken because
> $lockidx can't contain a % sign, but in general I think when we switch
> from print to printf it's better for us to have the format string be a
> constant so that it's clear that we can't accidentally get an extra %
> escape in there depending on the values of variables being
> interpolated.

I suppose this is a reasonable complaint; however, I don't see an actual
problem here.  Even if I hack the regexp in generate-lwlocknames.pl to
accept a %-sign in the lock name (and introduce a matching % in
wait_event_names.txt), then that % is emitted verbatim rather than
attempted to further expand.  Is this because this is Perl rather than
C?  I'm not sure.

Note that a % in the lock number (which also needs a regexp hack) can't
cause a problem either, because of the check that the lock numbers are
an ordered sequence.

I think it's quite difficult to cause actual problems here.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/





view thread (10+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: lwlocknames.h beautification attempt
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox