Skip site navigation (1) Skip section navigation (2)

Re: win2k, service, pg_ctl, popen, etc

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Claudio Natoli <claudio(dot)natoli(at)memetrics(dot)com>
Cc: "'Magnus Hagander'" <mha(at)sollentuna(dot)net>,pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: win2k, service, pg_ctl, popen, etc
Date: 2004-07-21 14:20:57
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers-win32
Claudio Natoli wrote:
> > If we don't know why, sign one more down as a bug in mingw (hardly
> > surprising - just the area of pipes and consoles seems to be 
> > where it's weak). In that case, why not just recode pg_ctl to execute
> > postmaster.exe from the same directory it found pg_ctl.exe 
> > in. This can easily be done using GetModuleFileName(). Is a pipe opened at
> > any other place? Or does other places need to be fixed as well (I haven't
> gone
> > through the whole code).
> Moreover, all the find_*_exec calls could (and IMHO, should) make use of
> GetModuleFileName. Win32 has an API to find the running file name; *nix does
> not and so we have to jump through a few hoops. I just don't see the sense
> in jumping through the same hoops under Win32.
> Sure, the functions also make certain that the version is as expected, but
> to my mind this is just a safety check to make sure the hoops we just jumped
> through were all in order. Of course, we'd also lose the ability to protect
> people who mix versions in the same directory, but such people need a lot
> more protection from themselves than we can provide. ;-)
> Does there continue to be any resistance to this approach? If not, I'll
> gladly provide a patch.

GetModuleFileName() doesn't solve our problem here.  We already know
what we think is the right path, but we have to be sure that we are
calling a matching version binary.  For example, initdb wants to call a
postgres that is the right version, as does pg_ctl.  We have had
mismatches reported in the past, and with relocatable installs it is
even more likely.

The version check is centralized in one place, exec.c, and I don't want
to have different behaviors on Win32 and Unix if we can help it.  Let's
go with the system() into a temp file.

  Bruce Momjian                        |
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to


pgsql-hackers-win32 by date

Next:From: Magnus HaganderDate: 2004-07-21 14:31:57
Subject: Re: win2k, service, pg_ctl, popen, etc
Previous:From: Andreas PflugDate: 2004-07-21 14:10:58
Subject: Re: win2k, service, pg_ctl, popen, etc

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group