Re: fairywren is generating bogus BASE_BACKUP commands

Andrew Dunstan <andrew@dunslane.net>

From: Andrew Dunstan <andrew@dunslane.net>
To: Thomas Munro <thomas.munro@gmail.com>, Robert Haas <robertmhaas@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-01-23T17:20:05Z
Lists: pgsql-hackers

Attachments

On 1/21/22 22:43, Thomas Munro wrote:
> On Sat, Jan 22, 2022 at 3:55 PM Robert Haas <robertmhaas@gmail.com> wrote:
>> On Fri, Jan 21, 2022 at 5:35 PM Andrew Dunstan <andrew@dunslane.net> wrote:
>>>     # See https://www.msys2.org/wiki/Porting/#filesystem-namespaces
>>>     local $ENV{MSYS2_ARG_CONV_EXCL} = $source_ts_prefix;
>>> Probably in this case just setting it to 'server:' would do the trick.
>> Oh, thanks for the tip. Do you want to push a commit that does that,
>> or ... should I do it?
> Just a thought:  Would it prevent the magic path translation and all
> just work if the path were already in Windows form?  So, if we did
> just this change at the top:
>
> -my $tempdir = PostgreSQL::Test::Utils::tempdir;
> +my $tempdir = PostgreSQL::Test::Utils::perl2host(PostgreSQL::Test::Utils::tempdir);


It's not as simple as that :-(  But you're on the right track. My
suggestion above doesn't work.

The rule for paths is: when you're passing a path to an external program
that's not msys aware (typically, one of our build artefacts like psql
or pg_basebackup) it needs to be a native path. But when you're passing
it to a perl function (e.g. mkdir) or to an external program that's msys
aware it needs to be a virtual path, i.e. one not mangled by perl2host.

Some recent commits to this file especially have not obeyed this rule.
Here's a patch that does it consistently for the whole file. I have
tested it on a system very like fairywren, and the test passes.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com

Commits

  1. Remove PostgreSQL::Test::Utils::perl2host completely

  2. Unbreak pg_basebackup/t/010_pg_basebackup.pl on msys

  3. On Windows, also call shutdown() while closing the client socket.

  4. On Windows, close the client socket explicitly during backend shutdown.