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 1lwiox-0007Lq-8N for pgsql-committers@arkaria.postgresql.org; Fri, 25 Jun 2021 10:12:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lwiow-000076-2W for pgsql-committers@arkaria.postgresql.org; Fri, 25 Jun 2021 10:12:22 +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 1lwiov-00006w-T6 for pgsql-committers@lists.postgresql.org; Fri, 25 Jun 2021 10:12:21 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwioo-0002c5-Vr for pgsql-committers@lists.postgresql.org; Fri, 25 Jun 2021 10:12:20 +0000 Received: (Authenticated sender: adsend@dunslane.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 6AC284000E; Fri, 25 Jun 2021 10:12:10 +0000 (UTC) Subject: Re: pgsql: Fix pattern matching logic for logs in TAP tests of pgbench To: Michael Paquier Cc: pgsql-committers@lists.postgresql.org References: <0f49303e-7784-b3ee-200b-cbf67be2eb9e@dunslane.net> <4a58ca30-7d79-8005-b427-9e73f004f457@dunslane.net> From: Andrew Dunstan Message-ID: <8617bf50-0a00-afdc-0bc8-41ffc7f70f39@dunslane.net> Date: Fri, 25 Jun 2021 06:12:09 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/24/21 11:08 PM, Michael Paquier wrote: > On Thu, Jun 24, 2021 at 10:26:18PM -0400, Andrew Dunstan wrote: >> Since the file isn't read in using slurp_file, that $ won't match >> because the lines will end \r\n instead of \n. > I did not remember this one with Msys, thanks. I am not sure that > there is any need for an eval block here actually once you remove > open()? What do you think about something like the attached? +        # On Msys, filter out any CRLF. +        $contents_raw =~ s/\r\n/\n/g if $Config{osname} eq 'msys'; This is completely redundant. The whole point is that slurp_file does exactly this for you. +        my @contents = split("\n", $contents_raw); Probably more idiomatic to write split(/\n/,$contents_raw), or split(/^/, $contents_raw) if you want to keep the line feeds. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com