Re: Is this a bug in pg_current_logfile() on Windows?
Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
From: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>, Thomas Kellerer <shammat@gmx.net>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2020-07-08T23:12:40Z
Lists: pgsql-hackers, pgsql-general
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. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Tighten up Windows CRLF conversion in our TAP test scripts.
- d0390509a182 9.5.23 landed
- ce9d053423fd 9.6.19 landed
- a3cfb10764bb 12.4 landed
- 89162b7364bf 11.9 landed
- 4c17c5a8529c 10.14 landed
- 17b87b3049fa 13.0 landed
- 91bdf499b37b 14.0 landed
-
Fix pg_current_logfile() to not emit a carriage return on Windows.
- 90b418f81645 11.9 landed
- 765ad260a18f 10.14 landed
- 601d419b2b5d 13.0 landed
- 2564e2d08546 12.4 landed
- 183926da3162 14.0 landed
-
Further tighten Windows CRLF conversion in our TAP test scripts.
- ffb4cee43bdc 14.0 landed
-
Add test coverage for pg_current_logfile() function.
- 1c4e88e2fe41 14.0 landed
-
Fix failures to ignore \r when reading Windows-style newlines.
- b654714f9bcf 13.0 cited
-
Fix TAP infrastructure to support Mingw better
- 33f3bbc6d37d 10.0 cited