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 1jtJVv-0004Mg-7r for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Jul 2020 23:30:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jtJVu-0000gD-3v for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Jul 2020 23:30:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jtJVt-0000g5-TX for pgsql-hackers@lists.postgresql.org; Wed, 08 Jul 2020 23:30:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jtJVr-00051N-8z for pgsql-hackers@lists.postgresql.org; Wed, 08 Jul 2020 23:30:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 068NTvcN1739105; Wed, 8 Jul 2020 19:29:57 -0400 From: Tom Lane To: Andrew Dunstan cc: Thomas Kellerer , pgsql-hackers@lists.postgresql.org Subject: Re: Is this a bug in pg_current_logfile() on Windows? In-reply-to: <252f062c-2b75-1bc3-e08a-3541719b27c0@2ndQuadrant.com> References: <412ae8da-76bb-640f-039a-f3513499e53d@gmx.net> <1716646.1594226496@sss.pgh.pa.us> <1733826.1594243608@sss.pgh.pa.us> <252f062c-2b75-1bc3-e08a-3541719b27c0@2ndQuadrant.com> Comments: In-reply-to Andrew Dunstan message dated "Wed, 08 Jul 2020 19:12:40 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1739103.1594250997.1@sss.pgh.pa.us> Date: Wed, 08 Jul 2020 19:29:57 -0400 Message-ID: <1739104.1594250997@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andrew Dunstan writes: > On 7/8/20 5:26 PM, Tom Lane wrote: >> However ... I put in a test case to try to expose this failure, and >> our Windows buildfarm critters remain perfectly happy. So what's up >> with that? After some digging around, I believe the reason is that >> PostgresNode::psql is stripping the \r from pg_current_logfile()'s >> result, here: >> $$stdout =~ s/\r//g if $TestLib::windows_os; >> I'm slightly tempted to extend the test case by verifying on the >> server side that the result ends in ".log" with no extra characters. >> More generally, I wonder if the above behavior is really a good idea. >> It seems to have been added in commit 33f3bbc6d as a hack to avoid >> having to think too hard about mingw's behavior, but now I wonder if >> it isn't masking other bugs too. At the very least I think we ought >> to tighten the coding to >> $$stdout =~ s/\r\n/\n/g if $TestLib::windows_os; >> so that it won't strip carriage returns at random. > Seems reasonable. If we rip it out completely we'll have to find all the > places it breaks and fix them. And we'll almost certainly get new > breakage. If it's hiding a real bug we'll have to do that, but I'd be > reluctant unless there's actual proof. Hard to tell. What I propose to do right now is change the \r filters as shown above, and see if the test I added in 004_logrotate.pl starts to show failures on Windows. If it does, and no other place does, I'm willing to be satisfied with that. If we see *other* failures then that'd prove that the problem is real, no? regards, tom lane