Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-25 Thread Bruce Momjian
DosError(). --- > > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Bruce Momjian > Sent: Tuesday, January 23, 2007 7:35 AM > To: Tom Lane > Cc: Magnus Haga

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Andrew Dunstan
Chuck McDevitt wrote: Win32 exception codes start with a two-bit severity indication. 00 means "success", so nothing is wrong. 01 is an "informational" messages. 10 is a "warning" message. 11 is an "error". That's why the common exception codes you see start with hex C0, as they are "errors". T

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Chuck McDevitt
FormatMessage and it will work. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bruce Momjian Sent: Tuesday, January 23, 2007 7:35 AM To: Tom Lane Cc: Magnus Hagander; Takayuki Tsunakawa; PostgreSQL-patches; Alvaro Herrera; ITAGAKI Takahiro Subject: Re

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Bruce Momjian
I worked with Magnus and it seems pulling message text from ntdll.dll doesn't work for all cases, so we are left just suggesting /include/ntstatus.h, which is what we have now. Magnus concurs. --- Magnus Hagander wrote: > O

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Bruce Momjian
Magnus Hagander wrote: > > The major place we use it is for backend termination checking, and we > > know the return values there. The other place is for the return value > > of pipe(). > > I assume you mean popen()/pclose()? Because pipe() is implemented using > sockets in our win32 ports layer.

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Magnus Hagander
On Tue, Jan 23, 2007 at 10:40:40AM -0500, Bruce Momjian wrote: > > > > Depends on what you mean with OS. > > There are a *lot* of tools that will return exitcodes >0x100 that are > > part of the OS. As a relevant example, Windows installer will return > > exitcode 3010 means "needs to reboot but d

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Bruce Momjian
Magnus Hagander wrote: > > This says you can get text for exceptions, but it didn't work for me, > > but I didn't try loading ntdll.dll: > > > > http://support.microsoft.com/kb/259693 > > Loading ntdll.dll lets you see Kernel mode API errors. If these are > indeed the same as userspace except

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Bruce Momjian
Magnus Hagander wrote: > On Tue, Jan 23, 2007 at 10:26:29AM -0500, Bruce Momjian wrote: > > Magnus Hagander wrote: > > > On Tue, Jan 23, 2007 at 10:11:58AM -0500, Bruce Momjian wrote: > > > > Magnus Hagander wrote: > > > > > > > I think that's incorrect information to the user :-( > > > > > > > If

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Magnus Hagander
On Tue, Jan 23, 2007 at 10:32:58AM -0500, Bruce Momjian wrote: > Takayuki Tsunakawa wrote: > > From: "Magnus Hagander" <[EMAIL PROTECTED]> > > > Are you entirely sure that ntstatus.h is where to look? Because per > > > whatever docs I've found, that contains "device driver errors" and > > *not* > >

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Magnus Hagander wrote: > >> Now, if we're only caring about exit() from *postgresqls own processes*, > >> that might hold true. In which case I withdraw that objection as long as > >> the comment i updated to reflect this ;-) But if we

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Magnus Hagander
On Tue, Jan 23, 2007 at 10:26:29AM -0500, Bruce Momjian wrote: > Magnus Hagander wrote: > > On Tue, Jan 23, 2007 at 10:11:58AM -0500, Bruce Momjian wrote: > > > Magnus Hagander wrote: > > > > > > I think that's incorrect information to the user :-( > > > > > > If the child terminates with exit(1),

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Bruce Momjian
Takayuki Tsunakawa wrote: > From: "Magnus Hagander" <[EMAIL PROTECTED]> > > Are you entirely sure that ntstatus.h is where to look? Because per > > whatever docs I've found, that contains "device driver errors" and > *not* > > exception codes. > > Yes, what you are pointing out is correct. winbas

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Magnus Hagander wrote: >> Now, if we're only caring about exit() from *postgresqls own processes*, >> that might hold true. In which case I withdraw that objection as long as >> the comment i updated to reflect this ;-) But if we're talking about >> exit(

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Bruce Momjian
Magnus Hagander wrote: > On Tue, Jan 23, 2007 at 10:11:58AM -0500, Bruce Momjian wrote: > > Magnus Hagander wrote: > > > > > I think that's incorrect information to the user :-( > > > > > If the child terminates with exit(1), we will then say "child process > > > > > was terminated by exception 1.

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Magnus Hagander
On Tue, Jan 23, 2007 at 10:11:58AM -0500, Bruce Momjian wrote: > Magnus Hagander wrote: > > > > I think that's incorrect information to the user :-( > > > > If the child terminates with exit(1), we will then say "child process > > > > was terminated by exception 1. This seems to be a bug", which is

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Bruce Momjian
Magnus Hagander wrote: > > > I think that's incorrect information to the user :-( > > > If the child terminates with exit(1), we will then say "child process > > > was terminated by exception 1. This seems to be a bug", which is clearly > > > not true. > > > > > > Unless you know a sure way of det

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Magnus Hagander
On Tue, Jan 23, 2007 at 09:29:19AM -0500, Bruce Momjian wrote: > Magnus Hagander wrote: > > On Tue, Jan 23, 2007 at 06:50:06PM +0900, Takayuki Tsunakawa wrote: > > > From: "Magnus Hagander" <[EMAIL PROTECTED]> > > > > Are you entirely sure that ntstatus.h is where to look? Because per > > > > whate

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Bruce Momjian
Magnus Hagander wrote: > On Tue, Jan 23, 2007 at 06:50:06PM +0900, Takayuki Tsunakawa wrote: > > From: "Magnus Hagander" <[EMAIL PROTECTED]> > > > Are you entirely sure that ntstatus.h is where to look? Because per > > > whatever docs I've found, that contains "device driver errors" and > > *not* >

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Magnus Hagander
On Tue, Jan 23, 2007 at 06:50:06PM +0900, Takayuki Tsunakawa wrote: > From: "Magnus Hagander" <[EMAIL PROTECTED]> > > Are you entirely sure that ntstatus.h is where to look? Because per > > whatever docs I've found, that contains "device driver errors" and > *not* > > exception codes. > > Yes, wha

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Takayuki Tsunakawa
From: "Magnus Hagander" <[EMAIL PROTECTED]> > Are you entirely sure that ntstatus.h is where to look? Because per > whatever docs I've found, that contains "device driver errors" and *not* > exception codes. Yes, what you are pointing out is correct. winbase.h and winnt.h should be consulted inst

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-23 Thread Magnus Hagander
On Mon, Jan 22, 2007 at 10:35:11PM -0500, Bruce Momjian wrote: > Takayuki Tsunakawa wrote: > > From: "Bruce Momjian" <[EMAIL PROTECTED]> > > > OK, I have tested on MinGW and found I can use FormatMessage() to > > print > > > a description for all ERROR* system() failures, rather than print a > > he

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Joshua D. Drake
Bruce Momjian wrote: > Takayuki Tsunakawa wrote: >> From: "Bruce Momjian" <[EMAIL PROTECTED]> >> Yes, you are 100% correct that I had exceptions and errors confused. >> I >>> have backed out the patch that used FormatMessage(), and instead of >>> using a URL, the message is now: >>> >>> child proc

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
Takayuki Tsunakawa wrote: > From: "Bruce Momjian" <[EMAIL PROTECTED]> > Yes, you are 100% correct that I had exceptions and errors confused. > I > > have backed out the patch that used FormatMessage(), and instead of > > using a URL, the message is now: > > > > child process was terminated by exce

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Takayuki Tsunakawa
t;[EMAIL PROTECTED]> To: "Takayuki Tsunakawa" <[EMAIL PROTECTED]> Cc: "PostgreSQL-patches" ; "Tom Lane" <[EMAIL PROTECTED]>; "Alvaro Herrera" <[EMAIL PROTECTED]>; "Magnus Hagander" <[EMAIL PROTECTED]>; "ITAGAKI Takahiro&

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
Takayuki Tsunakawa wrote: > From: "Bruce Momjian" <[EMAIL PROTECTED]> > > OK, I have tested on MinGW and found I can use FormatMessage() to > print > > a description for all ERROR* system() failures, rather than print a > hex > > value. This removes the need for a URL or lookup of hex values. > >

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Takayuki Tsunakawa
From: "Bruce Momjian" <[EMAIL PROTECTED]> > OK, I have tested on MinGW and found I can use FormatMessage() to print > a description for all ERROR* system() failures, rather than print a hex > value. This removes the need for a URL or lookup of hex values. > Attached and applied. Excuse me if I'm

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Takayuki Tsunakawa
;; "Magnus Hagander" <[EMAIL PROTECTED]>; "ITAGAKI Takahiro" <[EMAIL PROTECTED]>; "PostgreSQL-patches" Sent: Tuesday, January 23, 2007 10:37 AM Subject: Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too > Takayuki Tsunakawa wrote: >> From:

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
OK, I have tested on MinGW and found I can use FormatMessage() to print a description for all ERROR* system() failures, rather than print a hex value. This removes the need for a URL or lookup of hex values. Attached and applied. -

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
Takayuki Tsunakawa wrote: > From: "Bruce Momjian" <[EMAIL PROTECTED]> > > Tom Lane wrote: > >> Basically this whole idea is misconceived. Just print the number > and > >> have done. > > > > And how do people interpret that number? > > I understand that "people" Bruce-san is saying means PostgreSQ

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Takayuki Tsunakawa
From: "Bruce Momjian" <[EMAIL PROTECTED]> > Tom Lane wrote: >> Basically this whole idea is misconceived. Just print the number and >> have done. > > And how do people interpret that number? I understand that "people" Bruce-san is saying means PostgreSQL developers, not ordinary users. When ordin

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
Tom Lane wrote: > Alvaro Herrera <[EMAIL PROTECTED]> writes: > > Bruce Momjian wrote: > >> OK, maybe /doc or src/tools. A more radical approach would be to put > >> the list in our documentation, or have initdb install it. > > > Why not put it in techdocs or some such? > > I think we've learned

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > Bruce Momjian wrote: >> OK, maybe /doc or src/tools. A more radical approach would be to put >> the list in our documentation, or have initdb install it. > Why not put it in techdocs or some such? I think we've learned by now that putting copies of ot

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Alvaro Herrera
Bruce Momjian wrote: > Magnus Hagander wrote: > > Bruce Momjian wrote: > > > > > > Agreed. I propose we put the file in src/tools/msvc and link to our CVS > > > source tree or something. > > > > > Uh, AFAIK they're not MSVC specific, but also apply to mingw. > > src/tools/msvc is msvc only - if

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
Magnus Hagander wrote: > Bruce Momjian wrote: > > Tom Lane wrote: > >> Bruce Momjian <[EMAIL PROTECTED]> writes: > >>> FYI, here are the URL's I mention in our source code: > >>> * Wine (URL used in our error messages) - > >>> * http://source.winehq.org/source/include/ntstatus.h > >

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Magnus Hagander
Bruce Momjian wrote: > Tom Lane wrote: >> Bruce Momjian <[EMAIL PROTECTED]> writes: >>> FYI, here are the URL's I mention in our source code: >>> * Wine (URL used in our error messages) - >>> * http://source.winehq.org/source/include/ntstatus.h >>> * Descriptions - >>> http:/

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
Magnus Hagander wrote: > Bruce Momjian wrote: > > Magnus Hagander wrote: > > Even if it were the responsibility of the error message to suggest this, > > a URL seems far too transient. > I agree; more so given that the URL points to the Wine project pages. > And it's not user docu

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > FYI, here are the URL's I mention in our source code: > > > * Wine (URL used in our error messages) - > > * http://source.winehq.org/source/include/ntstatus.h > > * Descriptions - > > http://www.comp.nus.edu.sg/

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Magnus Hagander
Bruce Momjian wrote: > Magnus Hagander wrote: > Even if it were the responsibility of the error message to suggest this, > a URL seems far too transient. I agree; more so given that the URL points to the Wine project pages. And it's not user documentation, but source code, which m

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
Magnus Hagander wrote: > >>> Even if it were the responsibility of the error message to suggest this, > >>> a URL seems far too transient. > >> I agree; more so given that the URL points to the Wine project pages. > >> And it's not user documentation, but source code, which makes it less > >> appro

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > FYI, here are the URL's I mention in our source code: > * Wine (URL used in our error messages) - > * http://source.winehq.org/source/include/ntstatus.h > * Descriptions - > http://www.comp.nus.edu.sg/~wuyongzh/my_doc/ntstatus.txt

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Magnus Hagander
>>> Even if it were the responsibility of the error message to suggest this, >>> a URL seems far too transient. >> I agree; more so given that the URL points to the Wine project pages. >> And it's not user documentation, but source code, which makes it less >> appropriate. > > OK, so what suggesti

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
bruce wrote: > Tom Lane wrote: > > Bruce Momjian <[EMAIL PROTECTED]> writes: > > > Tom Lane wrote: > > >> It should not be there at all. Do you see URLs in any of our other > > >> error messages? > > > > > Sure, ideally, but how else can we give information about that hex > > > value? > > > > It

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
Alvaro Herrera wrote: > Tom Lane wrote: > > Bruce Momjian <[EMAIL PROTECTED]> writes: > > > Tom Lane wrote: > > >> It should not be there at all. Do you see URLs in any of our other > > >> error messages? > > > > > Sure, ideally, but how else can we give information about that hex > > > value? >

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Tom Lane wrote: > >> It should not be there at all. Do you see URLs in any of our other > >> error messages? > > > Sure, ideally, but how else can we give information about that hex > > value? > > It's not the responsibility of that

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> It should not be there at all. Do you see URLs in any of our other >> error messages? > Sure, ideally, but how else can we give information about that hex > value? It's not the responsibility of that error message to tell someone to

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
Tom Lane wrote: > Alvaro Herrera <[EMAIL PROTECTED]> writes: > > Bruce Momjian wrote: > >> I have applied a modified version of this patch. We now print the > >> exception value in hex, and give a URL where the exception can be looked > >> up. > > > Humm, wouldn't it be more appropriate to put th

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > Bruce Momjian wrote: >> I have applied a modified version of this patch. We now print the >> exception value in hex, and give a URL where the exception can be looked >> up. > Humm, wouldn't it be more appropriate to put the URL in a errhint() > instead

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
Alvaro Herrera wrote: > Bruce Momjian wrote: > > > > I have applied a modified version of this patch. We now print the > > exception value in hex, and give a URL where the exception can be looked > > up. > > Humm, wouldn't it be more appropriate to put the URL in a errhint() > instead? > > > +

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Alvaro Herrera
Bruce Momjian wrote: > > I have applied a modified version of this patch. We now print the > exception value in hex, and give a URL where the exception can be looked > up. Humm, wouldn't it be more appropriate to put the URL in a errhint() instead? > + ereport(lev, > + > +

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

2007-01-22 Thread Bruce Momjian
I have applied a modified version of this patch. We now print the exception value in hex, and give a URL where the exception can be looked up. --- Bruce Momjian wrote: > > I did some research on this, and found a nice Win3

Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too simplistic

2007-01-21 Thread Bruce Momjian
I did some research on this, and found a nice Win32 list of STATUS_ error values. Looking at the list, I think the non-exit() return values are much larger than just the second high bit. I am proposing the attached patch, which basically has all system() return values < 0x100 as exit() calls, an