public inbox for [email protected]  
help / color / mirror / Atom feed
From: Jianghua Yang <[email protected]>
To: David G. Johnston <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] initdb: Treat empty -U argument as unset username
Date: Tue, 1 Jul 2025 20:30:53 -0700
Message-ID: <CAAZLFmSKrcovMSauueWg=8VdZN-fHPH2ZengZRKA8AfgST6o6w@mail.gmail.com> (raw)
In-Reply-To: <CAKFQuwbVK=oANp9XLdQknd7o9jJOUFQanUtG3QAh-3kuaM5tJw@mail.gmail.com>
References: <CAAZLFmRK+XFp=mqCeruyNVkqGq5mH45CP+e-8oNttPRtLuB5eQ@mail.gmail.com>
	<CAKFQuwbVK=oANp9XLdQknd7o9jJOUFQanUtG3QAh-3kuaM5tJw@mail.gmail.com>

git show 8e673801262c66af4a54837f63ff596407835c20


        effective_user = get_id();

-       if (strlen(username) == 0)

+       if (!username)

                username = effective_user;

The previous code already intended to treat a missing username as falling
back to the system user.
The check was changed from strlen(username) == 0 to !username, but this
inadvertently stopped handling the empty-string case. This patch restores
the original intent and makes the behavior consistent.

David G. Johnston <[email protected]> 于2025年7月1日周二 20:12写道:

> On Tue, Jul 1, 2025 at 7:56 PM Jianghua Yang <[email protected]> wrote:
>
>> Let me know if this approach seems reasonable or if you’d prefer we
>> explicitly reject empty usernames with an error instead.
>>
>>
> I'd rather we reject the ambiguous input.
>
> David J.
>
>


view thread (16+ messages)  latest in thread

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: [PATCH] initdb: Treat empty -U argument as unset username
  In-Reply-To: <CAAZLFmSKrcovMSauueWg=8VdZN-fHPH2ZengZRKA8AfgST6o6w@mail.gmail.com>

* 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