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

9.2 beta2 - pg_ctl crashes on Win32 when neither PGDATA nor -D specified

From: Edmund Horner <ejrh00(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: 9.2 beta2 - pg_ctl crashes on Win32 when neither PGDATA nor -D specified
Date: 2012-06-11 06:40:18
Message-ID: CAMyN-kAsMj18rV9eshn4JX4Dn-JXbLMzC+eZ6wrnQ76FavaFfA@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
In 9.1, if I run "pg_ctl start" without providing way for it to find
the datadir, it prints the error:

    C:\ehorner\pgsql-old\bin>pg_ctl start
    pg_ctl: no database directory specified and environment variable
PGDATA unset
    Try "pg_ctl --help" for more information.

In 9.2 (beta1 and beta2), it runs for a couple of seconds and then
Windows pops up an error box saying it has "encountered a problem".  I
can get more detail from Windows but I'll wait 'till someone asks
(since I'd be surprised if it was useful).

The same crash occurs for any other subcommand, such as "stop" or
"register", etc., except for "pg_ctl kill" which says it needs missing
arguments; it crashes when they are provided.  (Kill does not require
a datadir and unregister does not either (according to the help, at
least) and they still crash.)

No crashes occur for plain old "pg_ctl --help" or similar.

I think it could be something in
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=aaa6e1def292cdacb6b27088898793b1b879fedf#patch5

where pg_config is NULL (due to the env var not existing), but
adjust_data_dir is called anyway.  It detects that there "must" be a
configuration directory.  I can't follow exactly where it might be
crashing but I can report that pg_ctl seems to iterate over all the
EXEs in the bin directory (the call to "find_other_exec_or_die"), and
that "postgres -C data_directory" does not appear to be executed.

I note that "postgres -C data_directory" will refuse to run on the
command line because I've got admin privileges in Windows, and that
pg_ctl normally starts postgres.exe using CreateRestrictedProcess.
But it does not do so for the popen call in adjust_data_dir.

Anyway that's enough speculating from me.  ;-)  Let me know if you
need me to test anything else.

Cheers,
Edmund.

Responses

pgsql-bugs by date

Next:From: Dave PageDate: 2012-06-11 07:10:54
Subject: Re: 9.2 beta1 libxml2 can't be loaded on Windows
Previous:From: Edmund HornerDate: 2012-06-11 05:30:16
Subject: Re: 9.2 beta1 libxml2 can't be loaded on Windows

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