Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lU07V-0007Pb-UI for pgsql-committers@arkaria.postgresql.org; Wed, 07 Apr 2021 04:48:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lU07T-00034G-T9 for pgsql-committers@arkaria.postgresql.org; Wed, 07 Apr 2021 04:48:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lU07R-000349-Vx for pgsql-committers@lists.postgresql.org; Wed, 07 Apr 2021 04:48:47 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lU07J-0006C0-UC for pgsql-committers@lists.postgresql.org; Wed, 07 Apr 2021 04:48:44 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 0A46C5C0161; Wed, 7 Apr 2021 00:48:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 07 Apr 2021 00:48:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=uimvWq66cogRnnkrIjSqrTEYCG+ O86JObCzVkihGI+o=; b=rAAWlSadjwqjrfEx55Q0JCIFrHuHAKxq3xXVre9Pss4 d2mxqsD3REcK27bfCv4a2d+CJchRWOvwILTkMD0jQiLttiJTlvbaV89Bk7AFx/nJ U7nVT3e2EjcNAW/2CtZ6nbqrdWCiqQeYQFrANmzMxpliS4d8le+9yQ24d+3Ignw/ f/3E8GhKl5JiCQPVbbA8dUpwNHxrXMZyGBx8OIRdzHOReSaQ0YLoW5jSjw3dIocW qFRTdYAQIHtiMSX0HKCNizqjVb5bmm+rDzIPkP2oFuPhR7SHwWCruxoAY5zZD4y1 cPTjAOolAdW21aPkgD1EeE/EoL3I2uoDdrUytuDSj2A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=uimvWq 66cogRnnkrIjSqrTEYCG+O86JObCzVkihGI+o=; b=eBkFEnXCYmv53oNoAIJnTG nuWUs1A5Djol93QiZHxpyBiklzqBbM5Ju2W/DRHTUZxZiPleQL3e1i4rqLra+GL3 QQ6aWDWajrXDNPStLm8UP0a1Ca8Jf7wimUAuJXdbPyg1gapWlJDOExUMpk6J1Ej5 Sh4QwbWe/hr+pkv8wxFosA73QCiucuRyxslYZC4JdOVFd0IvD5WP+IP4Hbcos1SO v4LsfXM1jTTxJlSkXWIwhakGQo4vi6YzPXfh24U/4oJvzuOWxxhDfY+XtYVD8e8G hiYoCSw+aIOCgHF0g+io7OceePAQaXUS7ROf5dw78ZFiVDS3E90QJ57Pzfabpnlg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudejiedgkeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdlfeehmdenucfjughrpeffhf fvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhu ihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrh hnpeffudeffeelgffhkedukeekvedvudfgieetkeekudelfeevhffhffdtudffieeutden ucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecukfhppeduuddurddutddvrd dukedtrddukeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhf rhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 7A1B1108005F; Wed, 7 Apr 2021 00:48:33 -0400 (EDT) Date: Wed, 7 Apr 2021 13:48:28 +0900 From: Michael Paquier To: pgsql-committers@lists.postgresql.org Cc: pchampion@vmware.com Subject: Re: pgsql: Add some information about authenticated identity via log_connec Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="4hVcpHcj+chlAQbP" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --4hVcpHcj+chlAQbP Content-Type: multipart/mixed; boundary="sJRZZxuEWuDRBtA3" Content-Disposition: inline --sJRZZxuEWuDRBtA3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 07, 2021 at 01:17:34AM +0000, Michael Paquier wrote: > Add some information about authenticated identity via log_connections >=20 > The "authenticated identity" is the string used by an authentication > method to identify a particular user. In many common cases, this is the > same as the PostgreSQL username, but for some third-party authentication > methods, the identifier in use may be shortened or otherwise translated > (e.g. through pg_ident user mappings) before the server stores it. So, fairywren, that is able to run the SSL tests on Windows, has been complaining here: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=3Dfairywren&dt=3D20= 21-04-07 03%3A04%3A44 The issue happens for 4 tests that check if some logs are not generated in the backend after an authentication failure, but the origin of the issue is that the truncation of the log file used to prevent a check of some previous connection's logs does not work properly, as fairywren shows a full-fledged log file in its output. The method used by connect_ok() and connect_fails() is the same as issues_sql_like() in PostgresNode.pm, so it seems to me that there is a pending issue with the latter, no? I think that this could lead to some false positives in tests expecting some general SQL query patterns, with a risk of overlap. A safe solution to this stuff is just to rotate the log file once before restarting the server, like in the attached. I would do that just on Windows to not slow down other systems. Thoughts? -- Michael --sJRZZxuEWuDRBtA3 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="fix-tap-rotate-log.patch" Content-Transfer-Encoding: quoted-printable diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm index 598906ad64..0773287e59 100644 --- a/src/test/perl/PostgresNode.pm +++ b/src/test/perl/PostgresNode.pm @@ -1920,7 +1920,17 @@ sub connect_ok if (@log_like or @log_unlike) { # Don't let previous log entries match for this connection. - truncate $self->logfile, 0; + # On Windows, the truncation would not work, so rotate the log + # file before restarting the server afresh. + if ($TestLib::windows_os) + { + $self->rotate_logfile; + $self->restart; + } + else + { + truncate $self->logfile, 0; + } } =20 # Never prompt for a password, any callers of this routine should @@ -1994,7 +2004,17 @@ sub connect_fails if (@log_like or @log_unlike) { # Don't let previous log entries match for this connection. - truncate $self->logfile, 0; + # On Windows, the truncation would not work, so rotate the log + # file before restarting the server afresh. + if ($TestLib::windows_os) + { + $self->rotate_logfile; + $self->restart; + } + else + { + truncate $self->logfile, 0; + } } =20 # Never prompt for a password, any callers of this routine should @@ -2175,7 +2195,9 @@ Run a command on the node, then verify that $expected= _sql appears in the server log file. =20 Reads the whole log file so be careful when working with large log outputs. -The log file is truncated prior to running the command, however. +The log file is truncated prior to running the command, however. On Windo= ws, +the truncation would not work, so rotate to a new log file and restart the +server. =20 =3Dcut =20 @@ -2187,7 +2209,16 @@ sub issues_sql_like =20 local %ENV =3D $self->_get_env(); =20 - truncate $self->logfile, 0; + if ($TestLib::windows_os) + { + $self->rotate_logfile; + $self->restart; + } + else + { + truncate $self->logfile, 0; + } + my $result =3D TestLib::run_log($cmd); ok($result, "@$cmd exit code 0"); my $log =3D TestLib::slurp_file($self->logfile); --sJRZZxuEWuDRBtA3-- --4hVcpHcj+chlAQbP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmBtOZwACgkQnvQgOdby QH3+DQ//VjkC7f/1zkzhDP3+ARSdEtWTuXbXEzQ1y0QbKAOf1UrghmbEsMVPDOsg t6pwhplAD9azNr56k9LpOOD2cFcWWEoRNg7LXswNRKYPKceztCnSvNJV3SPiSDpn 461LNYNHhq9hWivOQnj/uXOOEBnm4oiy40dfI8Z5w23FrR+XfqpXICwBjdLdMHKs HXNJO1938DWEma0S2ie77HOwqKaSFnZTP+VElPdGB8GqbxUU05Nx7R0q215FmGjI 36zXTebtpZci7a0duPti6hrKjKUVL0A6bxjtAHLk3GZxUwwvg7WNQC2PXG+JOyz1 bZ9DojiPGj0PCK/Y9gVckHLD4S02CBkhy4q5QK12YpFKPx/i1qokSl+7dSVJdZPH EnmREetM0PoFmpBv4GlkEtE+3Vm8Yta39Xo8DLSC3nxsWzYRsmua4CCIG56jlo4n MRzIhSqtomkT72MLVw2hrBxhFkmvBQSosH7Pr4IYnjqBf6Yk1ZfUVTyqSkz/njJR 5eqFTlMurZJMuJa5qFZ48ms2XbbWzm0p7Hg58wRJCxxnKif0fHY256W79S7nUfcv wHoauXoR+baa39sQKWfHo6iUvFwqcntHN5TPn/si1kkjW2gPTkdTuVHiKhJ1+V0M 6o2/wqctVrsAImi3PHGL9jBD5oaLfle8yv5Zve4SHg92+GzsyFE= =wtAN -----END PGP SIGNATURE----- --4hVcpHcj+chlAQbP--