Thread: Re: [HACKERS] Win32 WEXITSTATUS too

Re: [HACKERS] Win32 WEXITSTATUS too

From
Bruce Momjian
Date:
bruce wrote:
> Tom Lane wrote:
> > Bruce Momjian <bruce@momjian.us> 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   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: [HACKERS] Win32 WEXITSTATUS too

From
Tom Lane
Date:
Bruce Momjian <bruce@momjian.us> 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

Re: [HACKERS] Win32 WEXITSTATUS too

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> 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   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: [HACKERS] Win32 WEXITSTATUS too

From
Magnus Hagander
Date:
Bruce Momjian wrote:
> Tom Lane wrote:
>> Bruce Momjian <bruce@momjian.us> 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


Re: [HACKERS] Win32 WEXITSTATUS too

From
Bruce Momjian
Date:
Magnus Hagander wrote:
> Bruce Momjian wrote:
> > Tom Lane wrote:
> >> Bruce Momjian <bruce@momjian.us> 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   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: [HACKERS] Win32 WEXITSTATUS too

From
Alvaro Herrera
Date:
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 Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: [HACKERS] Win32 WEXITSTATUS too

From
Tom Lane
Date:
Alvaro Herrera <alvherre@commandprompt.com> 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

Re: [HACKERS] Win32 WEXITSTATUS too

From
Bruce Momjian
Date:
Tom Lane wrote:
> Alvaro Herrera <alvherre@commandprompt.com> 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   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: [HACKERS] Win32 WEXITSTATUS too

From
"Takayuki Tsunakawa"
Date:
From: "Bruce Momjian" <bruce@momjian.us>
> 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 0xC0000005?  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.



Re: [HACKERS] Win32 WEXITSTATUS too

From
Bruce Momjian
Date:
Takayuki Tsunakawa wrote:
> From: "Bruce Momjian" <bruce@momjian.us>
> > 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 0xC0000005?  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   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: [HACKERS] Win32 WEXITSTATUS too

From
"Takayuki Tsunakawa"
Date:
> 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" <bruce@momjian.us>
To: "Takayuki Tsunakawa" <tsunakawa.takay@jp.fujitsu.com>
Cc: "Tom Lane" <tgl@sss.pgh.pa.us>; "Alvaro Herrera"
<alvherre@commandprompt.com>; "Magnus Hagander" <magnus@hagander.net>;
"ITAGAKI Takahiro" <itagaki.takahiro@oss.ntt.co.jp>;
"PostgreSQL-patches" <pgsql-patches@postgresql.org>
Sent: Tuesday, January 23, 2007 10:37 AM
Subject: Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too


> Takayuki Tsunakawa wrote:
>> From: "Bruce Momjian" <bruce@momjian.us>
>> > 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 0xC0000005?  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   bruce@momjian.us
>  EnterpriseDB    http://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
>