Re: [EXTERNAL] Re: BUG #18707: Installation issue

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com>
Cc: PANESAR Gursharan <gursharan(dot)panesar(at)bnpparibas(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: [EXTERNAL] Re: BUG #18707: Installation issue
Date: 2024-11-19 23:15:59
Message-ID: CA+hUKG+18+0PbhKzmkj=9O52jLMVuwj4sKDGRqnABBuuueeU3Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Nov 19, 2024 at 8:02 PM Sandeep Thakkar
<sandeep(dot)thakkar(at)enterprisedb(dot)com> wrote:
> On Tue, Nov 19, 2024 at 6:39 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
>> a wild guess: would it help to use numerical SIDs instead of account
>> names when invoking shell commands like icacls?
>
> Yes, I tried that recently. It works well for init cluster, but pg_ctl fails to register the service:

I suppose the SID-vs-username thing is just one case anyway, and even
if we taught pg_ctl -U to accept SIDs (looks doable), I bet you could
have the same problem with paths with funky characters in them.

Let's see... so you pass shell commands to DoCmd[1] which injects them
into a wrapper batch file, after setting the codepage to match the
ACP[2]. After reading lots of horrible details on the internet, that
looks like the right idea to me, as it means that the rest of the
batch file should match what the Visual Basic program is using when it
writes out the command line, instead of the old MS-DOS OEM codepage
assumed by cmd.exe batch files. I assume that is working OK for
some/most people and must have worked OK for some non-ASCII stuff on
some configurations as that's why you added it, many years ago. So
what is different in these cases?

Idea: could the Visual Basic program actually be using a different
ACP, not the one in the registry, due to some explicit locale setting
or environment variable somewhere? Would it be better to call
GetACP() instead of that registry lookup[2]?

Some assumptions: I think VBA works entirely with wchar_t strings, and
I think objBatchFile.WriteLine must be the point of implicit
transcoding to char if the file wasn't opened in "Unicode mode"
(Unicode here meaning wchar_t, which sounds potentially useful for
sidestepping all this stuff but apparently it wouldn't work for batch
files), and surely that transcoding is done with the value from
GetACP(). I couldn't find where that is written down, though.

[1] https://github.com/EnterpriseDB/edb-installers/blob/5721b7804676fe1b74f5a4287692f56bd52e8b8f/server/scripts/windows/initcluster.vbs#L173
[2] https://github.com/EnterpriseDB/edb-installers/blob/5721b7804676fe1b74f5a4287692f56bd52e8b8f/server/scripts/windows/initcluster.vbs#L75

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Erik Wienhold 2024-11-19 23:31:12 Re: BUG #18715: replace() function silently fails if 3rd argument is null
Previous Message Tom Lane 2024-11-19 23:09:44 Re: BUG #18711: Attempting a connection with a database name longer than 63 characters now fails