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>
Cc: Thomas Kellerer <shammat@gmx.net>, pgsql-hackers@lists.postgresql.org
Date: 2020-07-09T13:43:53Z
Lists: pgsql-hackers, pgsql-general
Attachments
- IPC-Run-Win-0.94.tgz (application/x-compressed-tar)
On 7/8/20 10:40 PM, Tom Lane wrote:
> I wrote:
>> Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
>>> 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?
> So I did that, and the first report is from bowerbird and it's still
> green. Unless I'm completely misinterpreting what's happening (always
> a possibility), that means we're still managing to remove "data"
> occurrences of \r.
>
> The most likely theory about that, I think, is that IPC::Run::run already
> translated any \r\n occurrences in the psql command's output to plain \n.
> Then, the \r generated by pg_current_logfile() would butt up against the
> line-ending \n, allowing the "fix" in sub psql to remove valid data.
It's possible. I do see some mangling of that kind in IPC::Run's
Win32IO.pm and Win32Pump.pm.
Attached for reference is the IPC::Run package I usually use on Windows.
>
> One thing I noticed while making 91bdf499b is that some of these
> substitutions are conditioned on "if $TestLib::windows_os" while others
> are conditioned on "if $Config{osname} eq 'msys'". What is the reason
> for this difference? Is it possible that we only really need to do it
> in the latter case?
>
>
In general I make the condition for such hacks as restrictive as
possible. I don't guarantee that I have been perfectly consistent about
that, though.
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