public inbox for [email protected]
help / color / mirror / Atom feedFrom: Dagfinn Ilmari Mannsåker <[email protected]>
To: Jianghua Yang <[email protected]>
Cc: [email protected]
Cc: Robert Treat <[email protected]>
Cc: David G. Johnston <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] initdb: Treat empty -U argument as unset username
Date: Wed, 02 Jul 2025 15:09:26 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAAZLFmSY_s6TOsiTwjzqrc2Y4uShATuWcEEN8O8cdtpkS=zfLg@mail.gmail.com>
References: <CAAZLFmRK+XFp=mqCeruyNVkqGq5mH45CP+e-8oNttPRtLuB5eQ@mail.gmail.com>
<CAKFQuwbVK=oANp9XLdQknd7o9jJOUFQanUtG3QAh-3kuaM5tJw@mail.gmail.com>
<CAAZLFmSKrcovMSauueWg=8VdZN-fHPH2ZengZRKA8AfgST6o6w@mail.gmail.com>
<CAKFQuwaCPkb8=2_V3121Ei0MBrg02FLRNQbcAcyzCO3dAha=Gw@mail.gmail.com>
<CABV9wwOOpOijL9sY03KV3WNvgMxVFsyfvfYbfy2MYfn40z0yyQ@mail.gmail.com>
<[email protected]>
<CAAZLFmSY_s6TOsiTwjzqrc2Y4uShATuWcEEN8O8cdtpkS=zfLg@mail.gmail.com>
Jianghua Yang <[email protected]> writes:
> - A regression test is added to `src/bin/initdb/t/001_initdb.pl` to verify
> that the case `initdb -U ''` fails as expected.
[ ... ]
> diff --git a/src/bin/initdb/t/001_initdb.pl b/src/bin/initdb/t/001_initdb.pl
> index 15dd10ce40a..67eb53064f6 100644
> --- a/src/bin/initdb/t/001_initdb.pl
> +++ b/src/bin/initdb/t/001_initdb.pl
> @@ -37,6 +37,10 @@ command_fails(
> command_fails([ 'initdb', '--username' => 'pg_test', $datadir ],
> 'role names cannot begin with "pg_"');
>
> +command_fails(
> + [ 'initdb', '-U', '', $datadir ],
> + 'empty username not allowed');
> +
This only tests that it fails, not that it fails as expected. It should
use command_fails_like() to check that stderr contains the expected
error. Also, it shoud use => between the -U option and its argument, as
seen in the above test with --username.
- ilmari
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], [email protected], [email protected], [email protected]
Subject: Re: [PATCH] initdb: Treat empty -U argument as unset username
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