BUG #5065: pg_ctl start fails as administrator, with "could not locate matching postgres executable"

From: "Jesse Morris" <jmorris(at)coverity(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5065: pg_ctl start fails as administrator, with "could not locate matching postgres executable"
Date: 2009-09-19 02:31:49
Message-ID: 200909190231.n8J2Vniq012823@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


The following bug has been logged online:

Bug reference: 5065
Logged by: Jesse Morris
Email address: jmorris(at)coverity(dot)com
PostgreSQL version: 8.3.7, 8.4.1
Operating system: Windows Server 2003 R2
Description: pg_ctl start fails as administrator, with "could not
locate matching postgres executable"
Details:

I am logged in as domain\jmorris, a member of the local Administrators
group.

I am not running postgres as a service.

I can reproduce this with the zip file from enterprisedb for 8.3.7, or
8.4.1. I also used msys/mingw to build my own (to instrument debugging
output) and that reproduces it as well.

>From cmd.exe:
initdb.exe works fine.
pg_ctl start complains "FATAL: postgres - could not locate matching postgres
executable"

Instrumentation and investigation reveals that the failure is in
find_other_exec (exec.c) as the error text implies, but ultimately in
pipe_read_line; CreatePipe fails with error 5 (Access Denied).

HOWEVER!
If I run pg_ctl from cygwin (or a cmd process that has cygwin or cygstart or
anything cygwinish as a parent) it works as expected.

Almost certainly related: AddUserToDacl (also in exec.c) has comments
explaining that what it does is necessary because otherwise on newer windows
we'll see access denied on CreatePipe. However AddUserToDacl appears to be
working as written; none of the error paths are visited anyway.

I can reproduce this on a number of separate win2k3 R2 SP2 boxes, including
one VM that is basically a fresh OS install.

So: Two bugs:

* pg_ctl's manages to shoot itself in the foot when relinquishing
administrator rights (unless there's cygwin?)

* the error-reporting for this is extremely misleading.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tim Bunce 2009-09-19 19:21:41 BUG #5066: plperl issues with perl_destruct() and END blocks
Previous Message pwright 2009-09-19 01:40:36 Re: BUG #5062: 8.4.1 compile fails on debian can't find libdl

Browse pgsql-hackers by date

  From Date Subject
Next Message Jaime Casanova 2009-09-19 02:48:32 Re: [PATCH] Largeobject access controls
Previous Message Stephen Frost 2009-09-19 01:29:08 Re: [PATCH] Largeobject access controls