Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uWy9W-0042gu-Hv for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Jul 2025 14:09:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uWy9U-001gky-KX for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Jul 2025 14:09:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uWy9U-001gkq-3D for pgsql-hackers@lists.postgresql.org; Wed, 02 Jul 2025 14:09:32 +0000 Received: from fhigh-a8-smtp.messagingengine.com ([103.168.172.159]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uWy9S-005JYs-18 for pgsql-hackers@lists.postgresql.org; Wed, 02 Jul 2025 14:09:32 +0000 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 6DE5014001A1; Wed, 2 Jul 2025 10:09:28 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Wed, 02 Jul 2025 10:09:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilmari.org; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1751465368; x=1751551768; bh=Sh8HaBtPxa ft0C00vHN7QltZB72DDvuRObafWg2uOAU=; b=j6GWMm7BPYusbniC4gs2rkJdpr nK2Jtg1r+2oVTAjNDlBfn4Hwh4PZVuDcn905xkmct2Ik28MLEH4KWQP/PmXnOUvk SLx/oAwgKWBMP50Az/yZzi5APskjajTHs+uBHyvnijwxwUNZeirxrUWMi81pgAK9 tVRkKIcKILzEGCexeCesZvu0kfl6PD2rimkawbUvfN7AXo9n+uDxf4tXK9JIurZC qERNeTDY5wsD0HwW2EcJ1Z59eTwSVSntgWWovORzadOsTvZvbxVfaENsDrRnkTPG s5+jb90v3f8GsnQMxp+I/jWWqBJmbIp4VqLpk8f5kEEDF8cdyJSQ7tcL3eug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1751465368; x=1751551768; bh=Sh8HaBtPxaft0C00vHN7QltZB72DDvuROba fWg2uOAU=; b=cbBEMEDzKiSfngPv6JKCQMl06bCr+ijI8zW39HFaXA9bUyZGBe5 s2Nmpk7WNr+Oe3bDdRMvYIxM9V6gCLNFMvPoecZK9XHExIy0k+L78D47u16blgDv s/Ud4iPC/UDGPhUVjE0jmBaBXe2B98hCgkjOFmrWRpx82ndI1kSWkko1vVpdzjtX t3bQdmh2xBrUumd//s8HAdMwfjFY+KYAZPOSLkHyvdu+5kWqKs7RW8nAWG+05Zvb eZgqVDvsYIfOrh5r2EqsDtnxYmlyGE1xYN+kBDqMMbdM81UVCuztiXiEv+BdgCR/ TFxJOws/FlTztopa5//SO4OGqcZQQOCepKg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddujeeitdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufhfffgjkfgfgggtsehttdertddtreejnecuhfhrohhmpeffrghgfhhinhhn ucfklhhmrghrihcuofgrnhhnshonkhgvrhcuoehilhhmrghrihesihhlmhgrrhhirdhorh hgqeenucggtffrrghtthgvrhhnpeekleejueefhfffkefhkedtfeeluedvieeihfehfeef feeggeduffduheejjeeigfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehilhhmrghrihesihhlmhgrrhhirdhorhhgpdhnsggprhgtphhtthho peehpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrh hssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopegurghvihgu rdhgrdhjohhhnhhsthhonhesghhmrghilhdrtghomhdprhgtphhtthhopehrohgsseigii hilhhlrgdrnhgvthdprhgtphhtthhopegurghnihgvlheshigvshhqlhdrshgvpdhrtghp thhtohephihjhhhjshhtiiesghhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: i1ff147bf:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 2 Jul 2025 10:09:27 -0400 (EDT) From: =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= To: Jianghua Yang Cc: daniel@yesql.se, Robert Treat , "David G. Johnston" , pgsql-hackers@lists.postgresql.org Subject: Re: [PATCH] initdb: Treat empty -U argument as unset username References: <0231C713-50C8-4BE5-B7C8-106F57A79655@yesql.se> Date: Wed, 02 Jul 2025 15:09:26 +0100 In-Reply-To: (Jianghua Yang's message of "Wed, 2 Jul 2025 06:52:09 -0700") Message-ID: <87wm8q3crt.fsf@wibble.ilmari.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jianghua Yang 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