Re: [PATCH] Bug fix in initdb output - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: [PATCH] Bug fix in initdb output
Date
Msg-id 435ad822-aee8-f98e-02ab-de09167cb8ce@dunslane.net
Whole thread Raw
Responses Re: [PATCH] Bug fix in initdb output
List pgsql-hackers
On 3/2/21 9:32 AM, Alvaro Herrera wrote:
> On 2021-Mar-02, Nitin Jadhav wrote:
>
>>> FWIW, I don't think that it is a good idea to come back to this
>>> decision for *nix platforms, so I would let it as-is, and use
>>> relative paths if initdb is called using a relative path.
>> The command to be displayed either in absolute path or relative path
>> depends on the way the user is calling initdb. I agree with the above
>> comment to keep this behaviour as-is, that is if the initdb is called
>> using relative path, then it displays relative path otherwise absolute
>> path.
> Yeah.
>
>>> However, if you can write something that makes the path printed
>>> compatible for a WIN32 terminal while keeping the behavior
>>> consistent with other platforms, people would have no objections to
>>> that.
>> I feel the patch attached above handles this scenario.
> Agreed.  I'll push the original patch then.  Thanks everybody for the
> discussion.
>


I'm late to the party on this which is my fault, I had my head down on
other stuff. But I just noticed this commit. Unfortunately the commit
message and this thread contain suggestions that aren't true. How do I
know? Because the buildfarm has for years called pg_ctl via cmd.exe with
a relative path with forward slashes. here's the relevant perl code that
runs on all platforms:


        chdir($installdir);
        my $cmd =
          qq{"bin/pg_ctl" -D data-$locale -l logfile -w start >startlog
2>&1};
        system($cmd);


Note that the pg_ctl path is quoted, and those quotes are passed through
to cmd.exe. That's what makes it work. It's possibly not worth changing
it now, but if anything that's the change that should have been made here.


Just wanted that on the record in case people got this wrong idea that
you can't use forward slashes when calling a program in cmd.exe.


cheers


andrew

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




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Custom compression methods (mac+lz4.h)
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Custom compression methods