Patch for VS.Net 2005's strxfrm() bug
Patch for VS.Net 2005's strxfrm() bug
От:
"William ZHANG" <uniware@zedware.org>
Дата:
When I tried to compile pgsql-8.2devel with VS.Net 2005 and do regression
tests,
I found the problem. It's a bug inVS.Net 2005:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694
--
With regards,
William ZHANG
begin 666 strxfrm.patch
M*BHJ('!G&9R;6QE;B ]('-T"P@=F%L
M+" P*3L-"BL@"0E]#0HK("-E;'-E#0H@( D)>&9R;6QE;B ]('-T&9R;7-T&9R;6QE;C(@/2!S=')X
M9G)M*'AF&9R;6QE;B K(#$I.PT*(" )"4%SRe: Patch for VS.Net 2005's strxfrm() bug
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"William ZHANG" writes: > When I tried to compile pgsql-8.2devel with VS.Net 2005 and do regression > tests, > I found the problem. It's a bug inVS.Net 2005: > http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694 So why don't you use the fixed version of VS? regards, tom lane
Re: [HACKERS] Patch for VS.Net 2005's strxfrm() bug
От:
"Hiroshi Saito" <z-saito@guitar.ocn.ne.jp>
Дата:
Hi.
"William ZHANG" wrote in message news:ea5fm1$2q6i$1@news.hub.org...
> When I tried to compile pgsql-8.2devel with VS.Net 2005 and do regression
> tests,
> I found the problem. It's a bug inVS.Net 2005:
> http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694
>
+ /* http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694 */
+ #if _MSC_VER == 1400
+ {
+ char x[1];
+
+ xfrmlen = strxfrm(x, val, 0);
+ }
+ #else
xfrmlen = strxfrm(NULL, val, 0);
+ #endif
Hmm, It seems to be the bug of very unpleasant Microsoft.:D
I think that the following is desirable as an evasion measure to add.
#if defined(_MSC_VER) && _MSC_VER == 1400
To be sure, it was only VS2005.
Regards,
Hiroshi Saito
Re: [HACKERS] Patch for VS.Net 2005's strxfrm() bug
От:
Andrew Dunstan <andrew@dunslane.net>
Дата:
Hiroshi Saito wrote: > Hmm, It seems to be the bug of very unpleasant Microsoft.:D > I think that the following is desirable as an evasion measure to add. > > #if defined(_MSC_VER) && _MSC_VER == 1400 > > To be sure, it was only VS2005. > Why is this better than: #if _MSC_VER == 1400 Surely this will not be true if _MSC_VER is undefined? cheers andrew
Re: [HACKERS] Patch for VS.Net 2005's strxfrm() bug
От:
"Hiroshi Saito" <z-saito@guitar.ocn.ne.jp>
Дата:
From: "Andrew Dunstan" > Hiroshi Saito wrote: > > Hmm, It seems to be the bug of very unpleasant Microsoft.:D > > I think that the following is desirable as an evasion measure to add. > > > > #if defined(_MSC_VER) && _MSC_VER == 1400 > > > > To be sure, it was only VS2005. > > > > > Why is this better than: > > #if _MSC_VER == 1400 > > > Surely this will not be true if _MSC_VER is undefined? I experienced injustice and the reason of in OSX for it. Regards, Hiroshi Saito
Re: Patch for VS.Net 2005's strxfrm() bug
От:
"William ZHANG" <uniware@zedware.org>
Дата:
"Tom Lane" > "William ZHANG" writes: >> When I tried to compile pgsql-8.2devel with VS.Net 2005 and do regression >> tests, >> I found the problem. It's a bug inVS.Net 2005: >> http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694 > > So why don't you use the fixed version of VS? No service pack found for VS.Net 2005 now. > regards, tom lane > > ---------------------------(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: [HACKERS] Patch for VS.Net 2005's strxfrm() bug
От:
Bruce Momjian <bruce@momjian.us>
Дата:
Hiroshi Saito wrote: > From: "Andrew Dunstan" > > > Hiroshi Saito wrote: > > > Hmm, It seems to be the bug of very unpleasant Microsoft.:D > > > I think that the following is desirable as an evasion measure to add. > > > > > > #if defined(_MSC_VER) && _MSC_VER == 1400 > > > > > > To be sure, it was only VS2005. > > > > > > > > > Why is this better than: > > > > #if _MSC_VER == 1400 > > > > > > Surely this will not be true if _MSC_VER is undefined? > > I experienced injustice and the reason of in OSX for it. What was the problem with OSX? Did it throw a warning of you did an equality test on an undefined symbol? -- Bruce Momjian bruce@momjian.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +
Re: [HACKERS] Patch for VS.Net 2005's strxfrm() bug
От:
Bruce Momjian <bruce@momjian.us>
Дата:
Patch attached and applied. Thanks.
---------------------------------------------------------------------------
Hiroshi Saito wrote:
> Hi.
>
> "William ZHANG" wrote in message news:ea5fm1$2q6i$1@news.hub.org...
> > When I tried to compile pgsql-8.2devel with VS.Net 2005 and do regression
> > tests,
> > I found the problem. It's a bug inVS.Net 2005:
> > http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694
> >
>
> + /* http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694 */
> + #if _MSC_VER == 1400
> + {
> + char x[1];
> +
> + xfrmlen = strxfrm(x, val, 0);
> + }
> + #else
> xfrmlen = strxfrm(NULL, val, 0);
> + #endif
>
>
> Hmm, It seems to be the bug of very unpleasant Microsoft.:D
> I think that the following is desirable as an evasion measure to add.
>
> #if defined(_MSC_VER) && _MSC_VER == 1400
>
> To be sure, it was only VS2005.
>
> Regards,
> Hiroshi Saito
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
--
Bruce Momjian bruce@momjian.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Index: src/backend/utils/adt/selfuncs.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v
retrieving revision 1.210
diff -c -c -r1.210 selfuncs.c
*** src/backend/utils/adt/selfuncs.c 24 Jul 2006 01:19:48 -0000 1.210
--- src/backend/utils/adt/selfuncs.c 26 Jul 2006 17:13:26 -0000
***************
*** 2956,2962 ****
* == as you'd expect. Can't any of these people program their way
* out of a paper bag?
*/
! xfrmlen = strxfrm(NULL, val, 0);
xfrmstr = (char *) palloc(xfrmlen + 1);
xfrmlen2 = strxfrm(xfrmstr, val, xfrmlen + 1);
Assert(xfrmlen2 <= xfrmlen);
--- 2956,2970 ----
* == as you'd expect. Can't any of these people program their way
* out of a paper bag?
*/
! #if _MSC_VER == 1400 /* VS.Net 2005 */
! /* http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694 */
! {
! char x[1];
! xfrmlen = strxfrm(x, val, 0);
! }
! #else
! xfrmlen = strxfrm(NULL, val, 0);
! #endif
xfrmstr = (char *) palloc(xfrmlen + 1);
xfrmlen2 = strxfrm(xfrmstr, val, xfrmlen + 1);
Assert(xfrmlen2 <= xfrmlen);
Re: [HACKERS] Patch for VS.Net 2005's strxfrm() bug
От:
"Florian G. Pflug" <fgp@phlo.org>
Дата:
Bruce Momjian wrote: >>> Why is this better than: >>> >>> #if _MSC_VER == 1400 >>> >>> >>> Surely this will not be true if _MSC_VER is undefined? >> I experienced injustice and the reason of in OSX for it. > > What was the problem with OSX? Did it throw a warning of you did an > equality test on an undefined symbol? The following if evaluated to true on osx, although I'm pretty sure that _MSC_VER isn't defined on osx ;-) #if (_MSC_VER < 1300) ... #endif replacing it with #ifdef WIN32 #if (_MSC_VER < 1300) ... #endif #endif fixed the problem. greetings, Florian Pflug
Re: [HACKERS] Patch for VS.Net 2005's strxfrm() bug
От:
andrew@dunslane.net
Дата:
> Bruce Momjian wrote: >>>> Why is this better than: >>>> >>>> #if _MSC_VER == 1400 >>>> >>>> >>>> Surely this will not be true if _MSC_VER is undefined? >>> I experienced injustice and the reason of in OSX for it. >> >> What was the problem with OSX? Did it throw a warning of you did an >> equality test on an undefined symbol? > > The following if evaluated to true on osx, although I'm pretty sure that > _MSC_VER isn't defined on osx ;-) > #if (_MSC_VER < 1300) > ... > #endif > > replacing it with > #ifdef WIN32 > #if (_MSC_VER < 1300) > ... > #endif > #endif > > fixed the problem. > No doubt, but that's quite a different test. cheers andrew
Re: [HACKERS] Patch for VS.Net 2005's strxfrm() bug
От:
"Florian G. Pflug" <fgp@phlo.org>
Дата:
andrew@dunslane.net wrote: >> Bruce Momjian wrote: >>>>> Why is this better than: >>>>> >>>>> #if _MSC_VER == 1400 >>>>> >>>>> Surely this will not be true if _MSC_VER is undefined? >>>> I experienced injustice and the reason of in OSX for it. >>> What was the problem with OSX? Did it throw a warning of you did an >>> equality test on an undefined symbol? >> The following if evaluated to true on osx, although I'm pretty sure that >> _MSC_VER isn't defined on osx ;-) >> #if (_MSC_VER < 1300) >> ... >> #endif >> >> replacing it with >> #ifdef WIN32 >> #if (_MSC_VER < 1300) >> ... >> #endif >> #endif >> >> fixed the problem. > > No doubt, but that's quite a different test. I mainly posted this to show what the offending ifdef in pgadmin3 looked like, since someone referenced it, not as an argument against "#if _MSC_VER = 1400". I guess "_MSC_VER < 1300" gets interpreted as "0 < 1300" if _MSC_VER is undefined, so "_MSC_VER = 1400" would actually work. But it still suprised me a lot that "_MSC_VER < 1300" evaluated to true if _MSC_VER is undefined - maybe thats the _real_ reason why some people don't like the tri-state logic in sql - it's because they get confused when trying to use the c preprocessor ;-) greetings, Florian Pflug
Re: [HACKERS] Patch for VS.Net 2005's strxfrm() bug
От:
"Hiroshi Saito" <z-saito@guitar.ocn.ne.jp>
Дата:
From: "Florian G. Pflug" Ahhhhhhh, It is right.! I was retracing my memory for what situations the contents were. I was in distraction.....It seems that it is satisfactory at the reason for ==. Sorry and Thanks.!! Regards, Hiroshi Saito > Bruce Momjian wrote: >>>> Why is this better than: >>>> >>>> #if _MSC_VER == 1400 >>>> >>>> >>>> Surely this will not be true if _MSC_VER is undefined? >>> I experienced injustice and the reason of in OSX for it. >> >> What was the problem with OSX? Did it throw a warning of you did an >> equality test on an undefined symbol? > > The following if evaluated to true on osx, although I'm pretty sure that > _MSC_VER isn't defined on osx ;-) > #if (_MSC_VER < 1300) > ... > #endif > > replacing it with > #ifdef WIN32 > #if (_MSC_VER < 1300) > ... > #endif > #endif > > fixed the problem. > > greetings, Florian Pflug