CVS Head: Pg_ctl bug?

Started by Dave Pageover 20 years ago13 messagesbugs
Jump to latest
#1Dave Page
dpage@pgadmin.org

I just noticed that if I don't specify a data directory either on the
command line or in $PGDATA,, pg_ctl fails silently on Windows (haven't
been able to test other platforms atm). Is this a bug or an oversight -
an error message would seem appropriate?

/D

postgres@PC30:/usr/local/pgsql$ bin/pg_ctl start
postgres@PC30:/usr/local/pgsql$ bin/pg_ctl -D data start
postmaster starting
postgres@PC30:/usr/local/pgsql$ LOG: database system was interrupted at
2005-08-29 00:34:07 GMT Standard Time
LOG: checkpoint record is at 0/39F218
LOG: redo record is at 0/39F218; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 1478; next OID: 16392
LOG: next MultiXactId: 1; next MultiXactOffset: 0
LOG: database system was not properly shut down; automatic recovery in
progress
LOG: record with zero length at 0/39F260
LOG: redo is not required
LOG: database system is ready
LOG: transaction ID wrap limit is 2147484144, limited by database
"postgres"

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dave Page (#1)
Re: CVS Head: Pg_ctl bug?

"Dave Page" <dpage@vale-housing.co.uk> writes:

I just noticed that if I don't specify a data directory either on the
command line or in $PGDATA,, pg_ctl fails silently on Windows (haven't
been able to test other platforms atm). Is this a bug or an oversight -
an error message would seem appropriate?

On my machine it does this:

$ bin/pg_ctl start
pg_ctl: no database directory specified and environment variable PGDATA unset
Try "pg_ctl --help" for more information.
$

Is write_stderr() broken on Windows?

regards, tom lane

#3Magnus Hagander
magnus@hagander.net
In reply to: Tom Lane (#2)
Re: CVS Head: Pg_ctl bug?

I just noticed that if I don't specify a data directory

either on the

command line or in $PGDATA,, pg_ctl fails silently on

Windows (haven't

been able to test other platforms atm). Is this a bug or an

oversight

- an error message would seem appropriate?

On my machine it does this:

$ bin/pg_ctl start
pg_ctl: no database directory specified and environment
variable PGDATA unset Try "pg_ctl --help" for more information.
$

Is write_stderr() broken on Windows?

In some cases it writes to the eventlog instead of stderr. Dave, can you
check if this is what's happening to you?

//Magnus

#4Dave Page
dpage@pgadmin.org
In reply to: Magnus Hagander (#3)
Re: CVS Head: Pg_ctl bug?

-----Original Message-----
From: Magnus Hagander [mailto:mha@sollentuna.net]
Sent: 29 August 2005 20:58
To: Tom Lane; Dave Page
Cc: pgsql-bugs@postgresql.org
Subject: RE: [BUGS] CVS Head: Pg_ctl bug?

Is write_stderr() broken on Windows?

In some cases it writes to the eventlog instead of stderr.
Dave, can you
check if this is what's happening to you?

Bah, no coffee for 2 weeks dulls the mind :-(

Yes, this is what's happening. Odd though, considering that I have:

#log_destination = 'stderr'

In my out-of-the-box config.

Regards, Dave.

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dave Page (#4)
Re: CVS Head: Pg_ctl bug?

"Dave Page" <dpage@vale-housing.co.uk> writes:

In some cases it writes to the eventlog instead of stderr.

Yes, this is what's happening. Odd though, considering that I have:
#log_destination = 'stderr'
In my out-of-the-box config.

pg_ctl doesn't read the config file, though. Probably we need to
make write_stderr aware that it's running in an interactive program
rather than in the postmaster, and never use the eventlog in this context.

regards, tom lane

#6Magnus Hagander
magnus@hagander.net
In reply to: Tom Lane (#5)
Re: CVS Head: Pg_ctl bug?

Is write_stderr() broken on Windows?

In some cases it writes to the eventlog instead of stderr.
Dave, can you
check if this is what's happening to you?

Bah, no coffee for 2 weeks dulls the mind :-(

Yes, this is what's happening. Odd though, considering that I have:

#log_destination = 'stderr'

In my out-of-the-box config.

This is output from pg_ctl, right? pg_ctl doesn't look at
postgresql.conf...

pg_ctl has:
if (!isatty(fileno(stderr))) /* Running as a service */
... write to eventlog ...

That check appears to be failing. The backend has a lot more elaborate
check (in port/backend/security.c). Perhaps we need to make that kind of
advanced check in pg_ctl as well?

Though I don't see any of this code changing lately, so I don't see why
it's failing now. Are you running it under some kind of different
environment than you used to? Any other ideas on why it would claim your
console is not a tty?

//Magnus

#7Magnus Hagander
magnus@hagander.net
In reply to: Magnus Hagander (#6)
Re: CVS Head: Pg_ctl bug?

In some cases it writes to the eventlog instead of stderr.

Yes, this is what's happening. Odd though, considering that I have:
#log_destination = 'stderr'
In my out-of-the-box config.

pg_ctl doesn't read the config file, though. Probably we
need to make write_stderr aware that it's running in an
interactive program rather than in the postmaster, and never
use the eventlog in this context.

It must sitll use the eventlog when called as a service control process,
otherwise any error output from pg_ctl in that scenario would go to
/dev/null...
There is code that attempts to check this, but it's apparantly failing.

//Magnus

#8Dave Page
dpage@pgadmin.org
In reply to: Magnus Hagander (#7)
Re: CVS Head: Pg_ctl bug?

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: 29 August 2005 21:12
To: Dave Page
Cc: Magnus Hagander; pgsql-bugs@postgresql.org
Subject: Re: [BUGS] CVS Head: Pg_ctl bug?

"Dave Page" <dpage@vale-housing.co.uk> writes:

In some cases it writes to the eventlog instead of stderr.

Yes, this is what's happening. Odd though, considering that I have:
#log_destination = 'stderr'
In my out-of-the-box config.

pg_ctl doesn't read the config file, though. Probably we need to
make write_stderr aware that it's running in an interactive program
rather than in the postmaster, and never use the eventlog in
this context.

Which makes sense given that the entire problem is that it doesn't know
where to find the config file!

/D

#9Dave Page
dpage@pgadmin.org
In reply to: Dave Page (#8)
Re: CVS Head: Pg_ctl bug?

-----Original Message-----
From: Magnus Hagander [mailto:mha@sollentuna.net]
Sent: 29 August 2005 21:13
To: Dave Page; Tom Lane
Cc: pgsql-bugs@postgresql.org
Subject: RE: [BUGS] CVS Head: Pg_ctl bug?

Though I don't see any of this code changing lately, so I
don't see why
it's failing now. Are you running it under some kind of different
environment than you used to? Any other ideas on why it would
claim your
console is not a tty?

The only change is a new install of msys a month or so back, so nothing
major ;-). I can't think of anything that /should/ have changed that
behaviour.

Regards, Dave

#10Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#6)
Re: CVS Head: Pg_ctl bug?

"Magnus Hagander" <mha@sollentuna.net> writes:

Though I don't see any of this code changing lately, so I don't see why
it's failing now. Are you running it under some kind of different
environment than you used to?

Well, are we sure that it was working for Dave before? Maybe it's a
long-standing problem. If you didn't happen to mistype a command you'd
not know it wasn't working.

regards, tom lane

#11Dave Page
dpage@pgadmin.org
In reply to: Tom Lane (#10)
Re: CVS Head: Pg_ctl bug?

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: 29 August 2005 21:32
To: Magnus Hagander
Cc: Dave Page; pgsql-bugs@postgresql.org
Subject: Re: [BUGS] CVS Head: Pg_ctl bug?

"Magnus Hagander" <mha@sollentuna.net> writes:

Though I don't see any of this code changing lately, so I

don't see why

it's failing now. Are you running it under some kind of different
environment than you used to?

Well, are we sure that it was working for Dave before? Maybe it's a
long-standing problem. If you didn't happen to mistype a
command you'd
not know it wasn't working.

I couldn't say whether it was or wasn't working before. On further
investigation though, it does seem to work from a Windows command
prompt, just not an msys console.

Regards, Dave.

#12Bruce Momjian
bruce@momjian.us
In reply to: Dave Page (#11)
Re: CVS Head: Pg_ctl bug?

Dave Page wrote:

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: 29 August 2005 21:32
To: Magnus Hagander
Cc: Dave Page; pgsql-bugs@postgresql.org
Subject: Re: [BUGS] CVS Head: Pg_ctl bug?

"Magnus Hagander" <mha@sollentuna.net> writes:

Though I don't see any of this code changing lately, so I

don't see why

it's failing now. Are you running it under some kind of different
environment than you used to?

Well, are we sure that it was working for Dave before? Maybe it's a
long-standing problem. If you didn't happen to mistype a
command you'd
not know it wasn't working.

I couldn't say whether it was or wasn't working before. On further
investigation though, it does seem to work from a Windows command
prompt, just not an msys console.

I assume we are OK on this item.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#13Dave Page
dpage@pgadmin.org
In reply to: Bruce Momjian (#12)
Re: CVS Head: Pg_ctl bug?

-----Original Message-----
From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
Sent: 23 September 2005 20:56
To: Dave Page
Cc: Tom Lane; Magnus Hagander; pgsql-bugs@postgresql.org
Subject: Re: [BUGS] CVS Head: Pg_ctl bug?

Dave Page wrote:

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: 29 August 2005 21:32
To: Magnus Hagander
Cc: Dave Page; pgsql-bugs@postgresql.org
Subject: Re: [BUGS] CVS Head: Pg_ctl bug?

"Magnus Hagander" <mha@sollentuna.net> writes:

Though I don't see any of this code changing lately, so I

don't see why

it's failing now. Are you running it under some kind of

different

environment than you used to?

Well, are we sure that it was working for Dave before?

Maybe it's a

long-standing problem. If you didn't happen to mistype a
command you'd
not know it wasn't working.

I couldn't say whether it was or wasn't working before. On further
investigation though, it does seem to work from a Windows command
prompt, just not an msys console.

I assume we are OK on this item.

Yeah, I think so.

Regards, Dave.