From: | Jianghua Yang <yjhjstz(at)gmail(dot)com> |
---|---|
To: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> |
Cc: | daniel(at)yesql(dot)se, Robert Treat <rob(at)xzilla(dot)net>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: [PATCH] initdb: Treat empty -U argument as unset username |
Date: | 2025-07-02 14:17:28 |
Message-ID: | CAAZLFmRX6ekqhUy+zjEzugnS=hGjoU359atjCZC3yxnFRZ6c6g@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Thanks for the feedback!
I've updated the test to use `command_fails_like()` instead of
`command_fails()`, so it now asserts that the error message matches the
expected stderr output.
I also changed the test invocation to use the `-U => ''` syntax for
consistency, as seen in the adjacent `--username` test.
Let me know if any further adjustments are needed.
Best regards,
Jianghua Yang
Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> 于2025年7月2日周三 07:09写道:
> Jianghua Yang <yjhjstz(at)gmail(dot)com> 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
>
Attachment | Content-Type | Size |
---|---|---|
0001-initdb-Reject-empty-string-for-U-username-option-v3.patch | application/octet-stream | 1.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2025-07-02 14:19:44 | Re: Add progressive backoff to XactLockTableWait functions |
Previous Message | Fujii Masao | 2025-07-02 14:15:09 | Re: Add progressive backoff to XactLockTableWait functions |