Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 process was terminated by exception %X >>> See /include/ntstatus.h for a description of the hex value. >>> >>> When I search for /include/ntstatus.h, I get the Wine page first, so >>> hopefully we can mark this item as completed. >> Thank you, Bruce-san. I agree. > > The Win32 port has always been done in small steps, sometimes to the > left or right, but eventually forward. He feints to the left, he feints to the right, he ducks and POW! -- === The PostgreSQL Company: Command Prompt, Inc. === Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 Providing the most comprehensive PostgreSQL solutions since 1997 http://www.commandprompt.com/ Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate PostgreSQL Replication: http://www.commandprompt.com/products/ ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 exception %X > > See /include/ntstatus.h for a description of the hex value. > > > > When I search for /include/ntstatus.h, I get the Wine page first, so > > hopefully we can mark this item as completed. > > Thank you, Bruce-san. I agree. The Win32 port has always been done in small steps, sometimes to the left or right, but eventually forward. -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 exception %X > See /include/ntstatus.h for a description of the hex value. > > When I search for /include/ntstatus.h, I get the Wine page first, so > hopefully we can mark this item as completed. Thank you, Bruce-san. I agree. - Original Message - From: "Bruce Momjian" <[EMAIL PROTECTED]> To: "Takayuki Tsunakawa" <[EMAIL PROTECTED]> Cc: "PostgreSQL-patches" ; "Tom Lane" <[EMAIL PROTECTED]>; "Alvaro Herrera" <[EMAIL PROTECTED]>; "Magnus Hagander" <[EMAIL PROTECTED]>; "ITAGAKI Takahiro" <[EMAIL PROTECTED]> Sent: Tuesday, January 23, 2007 12:35 PM Subject: Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too > 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. >> > Attached and applied. >> >> Excuse me if I'm misunderstanding, but I'm afraid you are mixing up >> Win32 error codes and exception codes. I saw the following fragment >> in your patch: >> >> ! * On MinGW, system() returns STATUS_* values. MSVC might be >> ! * different. To test, create a binary that does *(NULL), and >> ! * then create a second binary that calls it via system(), >> ! * and check the return value of system(). On MinGW, it is >> ! * 0xC005 == STATUS_ACCESS_VIOLATION, and 0x5 is a value >> ! * FormatMessage() can look up. GetLastError() does not work; >> ! * always zero. >> >> Exception codes and error codes are different and not related. In the >> above test, 0xC005 is an "exception code". On the other hand, what >> FormatMessage() accepts is an error code. Error codes can't derived >> from exception codes. Stripping off 0xC bit from an exception code >> does not convert it to an error code. >> I suspect the reason why you misunderstood is that the descriptions >> are similar: >> the description for exception 0xC005 (STATUS_ACCESS_VIOLATION) is >> "access violation" (though the text can't be obtained). This is >> caused by an illegal memory access. This is a program bug. >> The description for 0x5 (ERROR_ACCESS_DENIED) is "Access is denied." >> This is caused by permission checks. This is not a bug, and can >> happen normally. >> >> Try "1.0 / 0.0" (devide by zero) instead of (*NULL). What would your >> patch display? The exception would be 0xC08E >> (STATUS_FLOAT_DIVIDE_BY_ZERO), I think. 0x8E is ERROR_BUSY_DRIVE. > > 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 exception %X > See /include/ntstatus.h for a description of the hex value. > > When I search for /include/ntstatus.h, I get the Wine page first, so > hopefully we can mark this item as completed. > > -- > Bruce Momjian [EMAIL PROTECTED] > EnterpriseDBhttp://www.enterprisedb.com > > + If your life is a hard drive, Christ can be your backup. + > > ---(end of broadcast)--- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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. > > Attached and applied. > > Excuse me if I'm misunderstanding, but I'm afraid you are mixing up > Win32 error codes and exception codes. I saw the following fragment > in your patch: > > ! * On MinGW, system() returns STATUS_* values. MSVC might be > ! * different. To test, create a binary that does *(NULL), and > ! * then create a second binary that calls it via system(), > ! * and check the return value of system(). On MinGW, it is > ! * 0xC005 == STATUS_ACCESS_VIOLATION, and 0x5 is a value > ! * FormatMessage() can look up. GetLastError() does not work; > ! * always zero. > > Exception codes and error codes are different and not related. In the > above test, 0xC005 is an "exception code". On the other hand, what > FormatMessage() accepts is an error code. Error codes can't derived > from exception codes. Stripping off 0xC bit from an exception code > does not convert it to an error code. > I suspect the reason why you misunderstood is that the descriptions > are similar: > the description for exception 0xC005 (STATUS_ACCESS_VIOLATION) is > "access violation" (though the text can't be obtained). This is > caused by an illegal memory access. This is a program bug. > The description for 0x5 (ERROR_ACCESS_DENIED) is "Access is denied." > This is caused by permission checks. This is not a bug, and can > happen normally. > > Try "1.0 / 0.0" (devide by zero) instead of (*NULL). What would your > patch display? The exception would be 0xC08E > (STATUS_FLOAT_DIVIDE_BY_ZERO), I think. 0x8E is ERROR_BUSY_DRIVE. 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 exception %X See /include/ntstatus.h for a description of the hex value. When I search for /include/ntstatus.h, I get the Wine page first, so hopefully we can mark this item as completed. -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 misunderstanding, but I'm afraid you are mixing up Win32 error codes and exception codes. I saw the following fragment in your patch: ! * On MinGW, system() returns STATUS_* values. MSVC might be ! * different. To test, create a binary that does *(NULL), and ! * then create a second binary that calls it via system(), ! * and check the return value of system(). On MinGW, it is ! * 0xC005 == STATUS_ACCESS_VIOLATION, and 0x5 is a value ! * FormatMessage() can look up. GetLastError() does not work; ! * always zero. Exception codes and error codes are different and not related. In the above test, 0xC005 is an "exception code". On the other hand, what FormatMessage() accepts is an error code. Error codes can't derived from exception codes. Stripping off 0xC bit from an exception code does not convert it to an error code. I suspect the reason why you misunderstood is that the descriptions are similar: the description for exception 0xC005 (STATUS_ACCESS_VIOLATION) is "access violation" (though the text can't be obtained). This is caused by an illegal memory access. This is a program bug. The description for 0x5 (ERROR_ACCESS_DENIED) is "Access is denied." This is caused by permission checks. This is not a bug, and can happen normally. Try "1.0 / 0.0" (devide by zero) instead of (*NULL). What would your patch display? The exception would be 0xC08E (STATUS_FLOAT_DIVIDE_BY_ZERO), I think. 0x8E is ERROR_BUSY_DRIVE. ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
> Well, I am thinking of cases where we the error can help the user > diagnose the problem. I have found a way to print descriptions with > FormatMessage(), and the codes without descriptions will just print as > hex. I also think this is correct. Like errno and strerror() combination on UNIX, descriptions obtained from FormatMessage() should be displayed with error codes from GetLastError(). I thought Bruce-san is trying to display descriptions (or a URL to them) for the "exception" codes, not "error" codes. Descriptions for exception codes can't be obtained with FormatMessage, can they? - Original Message - From: "Bruce Momjian" <[EMAIL PROTECTED]> To: "Takayuki Tsunakawa" <[EMAIL PROTECTED]> Cc: "Tom Lane" <[EMAIL PROTECTED]>; "Alvaro Herrera" <[EMAIL PROTECTED]>; "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: "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 ordinary users encounter an Win32 exception, what they can do is >> to report the message and the description of phenomenon to PostgreSQL >> developers. What can they do when they see the descriptive text of an >> exception code, such as "Access violation" for 0xC005? An >> exception means a bug of PostgreSQL. Win32 exceptions are different >> from errno on UNIX (counterpart of which is Win32 error code.) Can >> they avoid the exception by changing PostgreSQL settings? If luckly >> so in one case, can they think of the treatment from the message? >> >> If "people" means PostgreSQL developers, the descriptive text is not >> necessary either. I think the developers who try to solve the bug >> know where to refer to interpret the exception code. >> >> My opinion is the same as Tom-san's. > > Well, I am thinking of cases where we the error can help the user > diagnose the problem. I have found a way to print descriptions with > FormatMessage(), and the codes without descriptions will just print as > hex. > > -- > Bruce Momjian [EMAIL PROTECTED] > EnterpriseDBhttp://www.enterprisedb.com > > + If your life is a hard drive, Christ can be your backup. + > > ---(end of broadcast)--- > TIP 6: explain analyze is your friend > ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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. --- Bruce Momjian wrote: > bruce wrote: > > 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 by now that putting copies of other peoples' code > > > in our tree isn't such a hot idea; what is going to cause it to be > > > updated when things change? How do you know the values are even the > > > same across all the Windows versions we support? > > > > > > Basically this whole idea is misconceived. Just print the number and > > > have done. > > > > And how do people interpret that number? > > Ah, I found something: > > http://support.microsoft.com/kb/259693 > > Someone on IRC says that is kernel mode only, and is looking for a > user-mode version, so we would be able to print out a meaningful message > rather than a hex value that has to be looked up. > > -- > Bruce Momjian [EMAIL PROTECTED] > EnterpriseDBhttp://www.enterprisedb.com > > + If your life is a hard drive, Christ can be your backup. + > > ---(end of broadcast)--- > TIP 9: In versions below 8.0, the planner will ignore your desire to >choose an index scan if your joining column's datatypes do not >match -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + Index: src/backend/postmaster/postmaster.c === RCS file: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v retrieving revision 1.510 diff -c -c -r1.510 postmaster.c *** src/backend/postmaster/postmaster.c 22 Jan 2007 19:38:05 - 1.510 --- src/backend/postmaster/postmaster.c 23 Jan 2007 01:43:22 - *** *** 2430,2443 (errmsg("%s (PID %d) was terminated by signal %d", procname, pid, WTERMSIG(exitstatus; #else ! ereport(lev, /*-- translator: %s is a noun phrase describing a child process, such as "server process" */ ! (errmsg("%s (PID %d) was terminated by exception %X", ! procname, pid, WTERMSIG(exitstatus)), ! errhint("See http://source.winehq.org/source/include/ntstatus.h for a description of the hex value."))); #endif else ereport(lev, --- 2430,2459 (errmsg("%s (PID %d) was terminated by signal %d", procname, pid, WTERMSIG(exitstatus; #else ! { ! static char last_system_error[512]; ! ! if (WERRORCODE(exitstatus) == 0 || ! FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS | ! FORMAT_MESSAGE_FROM_SYSTEM, ! NULL, ! WERRORCODE(exitstatus), ! MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), ! last_system_error, ! sizeof(last_system_error) - 1, ! NULL) == 0) ! snprintf(last_system_error, sizeof(last_system_error) - 1, ! "Unknown error %X.", WEXITSTATUS(exitstatus)); + ereport(lev, + /*-- translator: %s is a noun phrase describing a child process, such as "server process" */ ! (errmsg("%s (PID %d) was terminated by the operating system", ! procname, pid), ! errdetail("%s", last_system_error))); ! } #endif else ereport(lev, Index: src/include/port/win32.h === RCS file: /cvsroot/pgsql/src/include/port/win32.h,v retrieving revision 1.67 diff -c -c -r1.67 win32.h *** src/include/port/win32.h 22 Jan 2007 18:32:57 - 1.67 --- src/include/port/win32.h 23 Jan 2007 01:43:23 - *** *** 140,152 * Descriptions - http://www.comp.nus.edu.sg/~wuyongzh/my_doc/ntstatus.txt * MS SDK - http://www.nologs.com/ntstatus.html * ! * Some day we might want to print descriptions for the most common ! * exceptions, rather than printing a URL. ! */ ! #define WIFEXITED(w)(((w) & 0XFF00) == 0) ! #define WIFSIGNALED(w) (!WIFEXITED(w)) ! #define WEXITSTATUS(w) (w) ! #define WTERMSIG(w) (w) #define sigmask(sig) ( 1 << ((sig)-1) ) --- 140,165 * Descriptions - http://www.comp.nus.edu.sg/~wuyongzh/my_doc/ntstatus.txt * MS SDK - http://www.nologs.com/ntstatus.html * ! * Because FormatMessage only handles NT_ERROR strings, and assumes they ! * do not have the 0xC prefix, we strip it to match this list: ! * http://msdn2.microsoft.com/en-us/library/ms681381.aspx ! * ! * When using FormatMessage(): ! * ! * On MinGW, system() returns STATUS_* v
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 PostgreSQL > developers, not ordinary users. > When ordinary users encounter an Win32 exception, what they can do is > to report the message and the description of phenomenon to PostgreSQL > developers. What can they do when they see the descriptive text of an > exception code, such as "Access violation" for 0xC005? An > exception means a bug of PostgreSQL. Win32 exceptions are different > from errno on UNIX (counterpart of which is Win32 error code.) Can > they avoid the exception by changing PostgreSQL settings? If luckly > so in one case, can they think of the treatment from the message? > > If "people" means PostgreSQL developers, the descriptive text is not > necessary either. I think the developers who try to solve the bug > know where to refer to interpret the exception code. > > My opinion is the same as Tom-san's. Well, I am thinking of cases where we the error can help the user diagnose the problem. I have found a way to print descriptions with FormatMessage(), and the codes without descriptions will just print as hex. -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 ordinary users encounter an Win32 exception, what they can do is to report the message and the description of phenomenon to PostgreSQL developers. What can they do when they see the descriptive text of an exception code, such as "Access violation" for 0xC005? An exception means a bug of PostgreSQL. Win32 exceptions are different from errno on UNIX (counterpart of which is Win32 error code.) Can they avoid the exception by changing PostgreSQL settings? If luckly so in one case, can they think of the treatment from the message? If "people" means PostgreSQL developers, the descriptive text is not necessary either. I think the developers who try to solve the bug know where to refer to interpret the exception code. My opinion is the same as Tom-san's. ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 by now that putting copies of other peoples' code > in our tree isn't such a hot idea; what is going to cause it to be > updated when things change? How do you know the values are even the > same across all the Windows versions we support? > > Basically this whole idea is misconceived. Just print the number and > have done. And how do people interpret that number? -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 other peoples' code in our tree isn't such a hot idea; what is going to cause it to be updated when things change? How do you know the values are even the same across all the Windows versions we support? Basically this whole idea is misconceived. Just print the number and have done. regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 we stick mingw stuff in there, people > > looking for mingw might miss it.. > > 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? -- Alvaro Herrerahttp://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 > >>> * Descriptions - > >>> http://www.comp.nus.edu.sg/~wuyongzh/my_doc/ntstatus.txt > >>> * MS SDK - http://www.nologs.com/ntstatus.html > >> I don't have a problem with mentioning those in a source code comment. > >> I question the wisdom of putting any of them in the error message ... > >> especially seeing that you haven't even found an "official" Microsoft > >> page to link to. None of those look to me like they're stable enough > >> to expect to still be there in three or four years. > > > > 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 we stick mingw stuff in there, people > looking for mingw might miss it.. OK, maybe /doc or src/tools. A more radical approach would be to put the list in our documentation, or have initdb install it. -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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://www.comp.nus.edu.sg/~wuyongzh/my_doc/ntstatus.txt >>> * MS SDK - http://www.nologs.com/ntstatus.html >> I don't have a problem with mentioning those in a source code comment. >> I question the wisdom of putting any of them in the error message ... >> especially seeing that you haven't even found an "official" Microsoft >> page to link to. None of those look to me like they're stable enough >> to expect to still be there in three or four years. > > 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 we stick mingw stuff in there, people looking for mingw might miss it.. //Magnus ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 documentation, but source code, which makes it less > appropriate. > >>> OK, so what suggestion do you have? I just proposed a few of them in my > >>> previous email. > >>> > >> A good place for the URL might be in the win32 specific FAQ? > > > > The list is 1160 lines long, though, so I think it deserves its own URL. > > > Yes. I meant putting the URL in the FAQ, not the contents of the list. Oh, hmmm, I don't think people like having the URL linking outside our control, and I tend to agree with that. -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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/~wuyongzh/my_doc/ntstatus.txt > > * MS SDK - http://www.nologs.com/ntstatus.html > > I don't have a problem with mentioning those in a source code comment. > I question the wisdom of putting any of them in the error message ... > especially seeing that you haven't even found an "official" Microsoft > page to link to. None of those look to me like they're stable enough > to expect to still be there in three or four years. Agreed. I propose we put the file in src/tools/msvc and link to our CVS source tree or something. -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 makes it less appropriate. >>> OK, so what suggestion do you have? I just proposed a few of them in my >>> previous email. >>> >> A good place for the URL might be in the win32 specific FAQ? > > The list is 1160 lines long, though, so I think it deserves its own URL. > Yes. I meant putting the URL in the FAQ, not the contents of the list. //Magnus ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 > >> appropriate. > > > > OK, so what suggestion do you have? I just proposed a few of them in my > > previous email. > > > > A good place for the URL might be in the win32 specific FAQ? The list is 1160 lines long, though, so I think it deserves its own URL. -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 > * MS SDK - http://www.nologs.com/ntstatus.html I don't have a problem with mentioning those in a source code comment. I question the wisdom of putting any of them in the error message ... especially seeing that you haven't even found an "official" Microsoft page to link to. None of those look to me like they're stable enough to expect to still be there in three or four years. regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
>>> 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 suggestion do you have? I just proposed a few of them in my > previous email. > A good place for the URL might be in the win32 specific FAQ? //Magnus ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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's not the responsibility of that error message to tell someone to > > go look up the error number in Microsoft documentation. If they're > > clueful enough to make any sense of the number beyond the strerror > > translation we already provide, then they already know where to look. > > Well, it took me like 25 minutes to find that list, so it isn't obvious. > Search for STATUS_CARDBUS_NOT_SUPPORTED, and you get only 75 hits on > Google, and our URL is #7. One idea Andrew Dunstan had was to print > descriptions for the most popular values. I asked him to give it a try > once I applied this patch. > > > Even if it were the responsibility of the error message to suggest this, > > a URL seems far too transient. > > It is a URL to the Wine CVS repository, so I assume it will be around for > a while. One thing we could do is copy that file to a URL on our web > site and point error messages to that. We could put the file in our CVS > and point to that too. 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 * MS SDK - http://www.nologs.com/ntstatus.html -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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? > > > > It's not the responsibility of that error message to tell someone to > > go look up the error number in Microsoft documentation. If they're > > clueful enough to make any sense of the number beyond the strerror > > translation we already provide, then they already know where to look. > > > > 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 suggestion do you have? I just proposed a few of them in my previous email. -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 error message to tell someone to > go look up the error number in Microsoft documentation. If they're > clueful enough to make any sense of the number beyond the strerror > translation we already provide, then they already know where to look. Well, it took me like 25 minutes to find that list, so it isn't obvious. Search for STATUS_CARDBUS_NOT_SUPPORTED, and you get only 75 hits on Google, and our URL is #7. One idea Andrew Dunstan had was to print descriptions for the most popular values. I asked him to give it a try once I applied this patch. > Even if it were the responsibility of the error message to suggest this, > a URL seems far too transient. It is a URL to the Wine CVS repository, so I assume it will be around for a while. One thing we could do is copy that file to a URL on our web site and point error messages to that. We could put the file in our CVS and point to that too. -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [pgsql-patches] pg_dump pretty_print
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Peter Eisentraut asked: > Could you provide a less hand-waving specification of this feature? At > the moment it sounds like "This option does something fun, but we're > not sure what it is. Sure. Perhaps after I manage to convince Tom of its usefullness. :) I can expand on what "pretty" is and add a warning akin to the one for --tables. Tom Lane asked: > Why exactly is that a good idea? Seems like a foot-gun with marginal > usefulness. If you want to look at things "pretty", the psql \d > commands are the tool to use. Because sometimes all you have is access to the dump file, or because you want to save/view a historical record; in both cases it is very hard to actually read the input when it's crammed into a single line with minimal whitespacing. Since we already do make some concessions as far as making the dump file human-readable, offering this as an *optional* flag seems (mostly) harmless. - -- Greg Sabino Mullane [EMAIL PROTECTED] PGP Key: 0x14964AC8 200701221450 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -BEGIN PGP SIGNATURE- iD8DBQFFtRV1vJuQZxSWSsgRAm4iAJ9lro5hvpbYHQB6fM06uH7wUHzLlwCgpamm wUpTmpqn4JbcEGsHmM1OTPQ= =HrpY -END PGP SIGNATURE- ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 go look up the error number in Microsoft documentation. If they're clueful enough to make any sense of the number beyond the strerror translation we already provide, then they already know where to look. Even if it were the responsibility of the error message to suggest this, a URL seems far too transient. regards, tom lane ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 the URL in a errhint() > > instead? > > 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? -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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? It should not be there at all. Do you see URLs in any of our other error messages? regards, tom lane ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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? > > > + ereport(lev, > > + > > + /*-- > > + translator: %s is a noun phrase describing a child process, > > such as > > + "server process" */ > > + (errmsg("%s (PID %d) was terminated by > > exception %X\nSee http://source.winehq.org/source/include/ntstatus.h for a > > description\nof the hex value.", > > + procname, pid, > > WTERMSIG(exitstatus; > > + #endif Oops, forgot to mention that detail. We are using log_error() in one case, and ereport() in another. Let me do the hint in the report case, but I have to leave the log_error case alone because it takes only three arguments. -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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, > + > + /*-- > + translator: %s is a noun phrase describing a child process, > such as > + "server process" */ > + (errmsg("%s (PID %d) was terminated by > exception %X\nSee http://source.winehq.org/source/include/ntstatus.h for a > description\nof the hex value.", > + procname, pid, > WTERMSIG(exitstatus; > + #endif -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too
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 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, and everything above that as a > signal exits. I also think it is too risky to backpatch to 8.2.X. > > Also, should we print Win32 WTERMSIG() values as hex because they are so > large? I have added that to the patch. > > --- > > ITAGAKI Takahiro wrote: > > > > Tom Lane <[EMAIL PROTECTED]> wrote: > > > > > server process exited with exit code -1073741819 > > > from what I suspect is really the equivalent of a SIGSEGV trap, > > > ie, attempted access to already-deallocated memory. My calculator > > > says the above is equivalent to hex C005, and I say that this > > > makes it pretty clear that *some* parts of Windows put flag bits into > > > the process exit code. Anyone want to run down what we should really > > > be using instead of the above macros? > > > > C005 equals to EXCEPTION_ACCESS_VIOLATION. The value returned by > > GetExceptionCode() seems to be the exit code in unhandeled exception cases. > > > > AFAICS, all EXCEPTION_xxx (or STATUS_xxx) values are defined as 0xCxxx. > > I think we can use the second high bit to distinguish exit by exception > > from normal exits. > > > > #define WEXITSTATUS(w) ((int) ((w) & 0x4000)) > > #define WIFEXITED(w)((w) & 0x4000) == 0) > > #define WIFSIGNALED(w) ((w) & 0x4000) != 0) > > #define WTERMSIG(w) (w) // or ((w) & 0x3FFF) > > > > However, it comes from reverse engineering of the headers of Windows. > > I cannot find any official documentation. > > > > Regards, > > --- > > ITAGAKI Takahiro > > NTT Open Source Software Center > > > > > > > > ---(end of broadcast)--- > > TIP 3: Have you checked our extensive FAQ? > > > >http://www.postgresql.org/docs/faq > > -- > Bruce Momjian [EMAIL PROTECTED] > EnterpriseDBhttp://www.enterprisedb.com > > + If your life is a hard drive, Christ can be your backup. + > > ---(end of broadcast)--- > TIP 5: don't forget to increase your free space map settings -- Bruce Momjian [EMAIL PROTECTED] EnterpriseDBhttp://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. + Index: src/backend/postmaster/postmaster.c === RCS file: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v retrieving revision 1.508 diff -c -c -r1.508 postmaster.c *** src/backend/postmaster/postmaster.c 16 Jan 2007 13:28:56 - 1.508 --- src/backend/postmaster/postmaster.c 22 Jan 2007 18:29:01 - *** *** 2421,2426 --- 2421,2427 (errmsg("%s (PID %d) exited with exit code %d", procname, pid, WEXITSTATUS(exitstatus; else if (WIFSIGNALED(exitstatus)) + #ifndef WIN32 ereport(lev, /*-- *** *** 2428,2433 --- 2429,2443 "server process" */ (errmsg("%s (PID %d) was terminated by signal %d", procname, pid, WTERMSIG(exitstatus; + #else + ereport(lev, + + /*-- + translator: %s is a noun phrase describing a child process, such as + "server process" */ + (errmsg("%s (PID %d) was terminated by exception %X\nSee http://source.winehq.org/source/include/ntstatus.h for a description\nof the hex value.", + procname, pid, WTERMSIG(exitstatus; + #endif else ereport(lev, Index: src/include/port/win32.h === RCS file: /cvsroot/pgsql/src/include/port/win32.h,v retrieving revision 1.65 diff -c -c -r1.65 win32.h *** src/include/port/win32.h 11 Jan 2007 02:42:31 - 1.65 --- src/include/port/win32.h 22 Jan 2007 18:29:02 - *** *** 115,130 /* * Signal stuff ! * WIN32 doesn't have wait(), so the return value for children ! * is simply the return value specified by the child, without ! * any additional information on whether the child terminated ! * on its own or via a signal. These macros are also used ! * to interpret the return value of system(). ! */ ! #define WEXITSTATUS(w) (w) ! #define WIFEXITED(w) (true) ! #define WIFSIGNALED(w) (false) ! #define WTERMSIG(w) (0) #define sigmask(sig) ( 1 << ((sig)-1) ) --- 115,152 /* * Signal stuff ! * ! * For WIN32, there is no wait() call so there are no wait() macros ! * to interpr
Re: [pgsql-patches] [PATCHES] pg_standby
On Wed, 2007-01-17 at 16:15 +, Simon Riggs wrote: > On Wed, 2007-01-17 at 10:05 -0500, Merlin Moncure wrote: > > On 12/28/06, Simon Riggs <[EMAIL PROTECTED]> wrote: > > > On Thu, 2006-12-28 at 19:26 +, Simon Riggs wrote: > > > > On Thu, 2006-12-14 at 12:04 +, Simon Riggs wrote: > > > > > pg_standby and test framework, in separate .tar files > > > > > > > > New version (v2), following further testing. > > > > > > > > Signal handling not included in this version. > > > > > > Signal handling now added, tested and working correctly in version 3, > > > attached. > > > > > > pg_standby is an example program for a warm standby script as discussed > > > on -hackers: > > > http://archives.postgresql.org/pgsql-hackers/2006-08/msg00407.php > > > > > > Program looks complete and ready for review, to me. > > > > I double checked and re-ran all my test and confirmed that pg_standby > > move (-m) mode is definitely busted in v3 in the sense that a restart > > of the standby will not resume recovery and requires a pg_resetxlog to > > become operational -- it needs one more WAL file back than the oldest > > one available. > > new v4 > > Changes > - removed -m command, design flaw in original spec, use -l instead > - added -k N command to cleanup archive and leave max N files > - fflush() points added to allow Windows debug > - bug fix: when .history file present > - bug fix: command line switch cleanup > - readme updated new v6 (v5 was Windows dev release) Changes - added -r option to specify maxretries - -l option for Windows Vista (only) using mklink - Windows examples and docs added to readme - code restructured to allow more easy customization - bug fix: -k 0 error fixed - successful port report from Dave Page on Windows XP -- Simon Riggs EnterpriseDB http://www.enterprisedb.com pg_standby.v6.tar Description: Unix tar archive ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly