BUG #1815: ECPGdebug causes crash on Windows XP

Started by Joshua Masikoover 20 years ago11 messagesbugs
Jump to latest
#1Joshua Masiko
joshua_masiko@yahoo.com

The following bug has been logged online:

Bug reference: 1815
Logged by: joshua masiko
Email address: joshua_masiko@yahoo.com
PostgreSQL version: 8.0.3
Operating system: Windows XP SP2
Description: ECPGdebug causes crash on Windows XP
Details:

/* Processed by ecpg (4.0.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "main.pgc"
#include <stdio.h>

int main(int argc,char **argv)
{
ECPGdebug(1,stderr);
return 0;
}

Running the above program results in a reproducible crash on Windows XP

Environment
Windows XP SP2
Visual Studio SP5
Postgresql 8.0.3

Any ideas??

#2William ZHANG
uniware@zedware.org
In reply to: Joshua Masiko (#1)
Re: BUG #1815: ECPGdebug causes crash on Windows XP

Make sure the lib directory is in the PATH.
I tested it in MinGW.

$ ecpg main.pgc
$ gcc main.c -I../include -L../lib -lecpg
$ export PATH=$PATH:"/c/Program Files/PostgreSQL/8.0/lib"
$ ./a.exe
[1772]: ECPGdebug: set to 1

""joshua masiko"" <joshua_masiko@yahoo.com> wrote
news:20050809194027.A1C76F0B08@svr2.postgresql.org...

Show quoted text

The following bug has been logged online:

Bug reference: 1815
Logged by: joshua masiko
Email address: joshua_masiko@yahoo.com
PostgreSQL version: 8.0.3
Operating system: Windows XP SP2
Description: ECPGdebug causes crash on Windows XP
Details:

/* Processed by ecpg (4.0.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "main.pgc"
#include <stdio.h>

int main(int argc,char **argv)
{
ECPGdebug(1,stderr);
return 0;
}

Running the above program results in a reproducible crash on Windows XP

Environment
Windows XP SP2
Visual Studio SP5
Postgresql 8.0.3

Any ideas??

---------------------------(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

#3Bruce Momjian
bruce@momjian.us
In reply to: Joshua Masiko (#1)
Re: [BUGS] BUG #1815: ECPGdebug causes crash on Windows XP

Can someone on the interfaces list comment on this? Thanks.

---------------------------------------------------------------------------

joshua masiko wrote:

The following bug has been logged online:

Bug reference: 1815
Logged by: joshua masiko
Email address: joshua_masiko@yahoo.com
PostgreSQL version: 8.0.3
Operating system: Windows XP SP2
Description: ECPGdebug causes crash on Windows XP
Details:

/* Processed by ecpg (4.0.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "main.pgc"
#include <stdio.h>

int main(int argc,char **argv)
{
ECPGdebug(1,stderr);
return 0;
}

Running the above program results in a reproducible crash on Windows XP

Environment
Windows XP SP2
Visual Studio SP5
Postgresql 8.0.3

Any ideas??

---------------------------(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                        |  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
#4Bruce Momjian
bruce@momjian.us
In reply to: William ZHANG (#2)
Re: [BUGS] BUG #1815: ECPGdebug causes crash on Windows XP

William ZHANG wrote:

Make sure the lib directory is in the PATH.
I tested it in MinGW.

$ ecpg main.pgc
$ gcc main.c -I../include -L../lib -lecpg
$ export PATH=$PATH:"/c/Program Files/PostgreSQL/8.0/lib"
$ ./a.exe
[1772]: ECPGdebug: set to 1

Ah, interesting. Why would it crash if the lib directory is not in the
path? Because it can't load the library?

---------------------------------------------------------------------------

""joshua masiko"" <joshua_masiko@yahoo.com> wrote
news:20050809194027.A1C76F0B08@svr2.postgresql.org...

The following bug has been logged online:

Bug reference: 1815
Logged by: joshua masiko
Email address: joshua_masiko@yahoo.com
PostgreSQL version: 8.0.3
Operating system: Windows XP SP2
Description: ECPGdebug causes crash on Windows XP
Details:

/* Processed by ecpg (4.0.1) */
/* These include files are added by the preprocessor */
#include <ecpgtype.h>
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */
#line 1 "main.pgc"
#include <stdio.h>

int main(int argc,char **argv)
{
ECPGdebug(1,stderr);
return 0;
}

Running the above program results in a reproducible crash on Windows XP

Environment
Windows XP SP2
Visual Studio SP5
Postgresql 8.0.3

Any ideas??

---------------------------(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

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

-- 
  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
#5William ZHANG
uniware@zedware.org
In reply to: William ZHANG (#2)
Re: [BUGS] BUG #1815: ECPGdebug causes crash on Windows XP

"Bruce Momjian" <pgman@candle.pha.pa.us>
wrote:200508130244.j7D2iJE03191@candle.pha.pa.us...

William ZHANG wrote:

Make sure the lib directory is in the PATH.
I tested it in MinGW.

$ ecpg main.pgc
$ gcc main.c -I../include -L../lib -lecpg
$ export PATH=$PATH:"/c/Program Files/PostgreSQL/8.0/lib"
$ ./a.exe
[1772]: ECPGdebug: set to 1

Ah, interesting. Why would it crash if the lib directory is not in the
path? Because it can't load the library?

Maybe I misunderstood the word 'crash'. If I forgot to put the lib
directory,
it will make Windows popup a GUI warning window.

joshua masiko: Can you give more information?

#6Joshua Masiko
joshua_masiko@yahoo.com
In reply to: William ZHANG (#5)
Re: BUG #1815: ECPGdebug causes crash on Windows XP

crash in this case means I get the popup that says
<progname> has encountered errors and needs to close
when I click the debug button this is the call stack
that shows up in the Visual Studio debugger

ntdll.dll!7c918fea()
ntdll.dll!7c9106eb()
ntdll.dll!7c90104b()
msvcrt.dll!77c3b90d()
msvcrt.dll!77c420e7()
libecpg.dll!6d0c7471()

ecpgtest.exe!main(int argc=1, char * *

argv=0x003c0d10) Line 5 + 0xc C
ecpgtest.exe!mainCRTStartup() Line 206 + 0x19 C
kernel32.dll!7c816d4f()
kernel32.dll!7c8399f3()

The offending line in ecpgtest.pgc is

ECPGdebug(1,stderr);

I get the same result even if I use a file handle
obtained by using fopen
--- William ZHANG <uniware@zedware.org> wrote:

"Bruce Momjian" <pgman@candle.pha.pa.us>
wrote:200508130244.j7D2iJE03191@candle.pha.pa.us...

William ZHANG wrote:

Make sure the lib directory is in the PATH.
I tested it in MinGW.

$ ecpg main.pgc
$ gcc main.c -I../include -L../lib -lecpg
$ export PATH=$PATH:"/c/Program

Files/PostgreSQL/8.0/lib"

$ ./a.exe
[1772]: ECPGdebug: set to 1

Ah, interesting. Why would it crash if the lib

directory is not in the

path? Because it can't load the library?

Maybe I misunderstood the word 'crash'. If I forgot
to put the lib
directory,
it will make Windows popup a GUI warning window.

joshua masiko: Can you give more information?

__________________________________
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html

#7William ZHANG
uniware@zedware.org
In reply to: Joshua Masiko (#6)
Re: BUG #1815: ECPGdebug causes crash on Windows XP

Yes. It is reproducible. But it works well in MinGW.
Is there sth. wrong with the import library lib\ms\libecpg.lib or
lib\libecpg.dll?

"Joshua Masiko" <joshua_masiko@yahoo.com>
wrote:20050813145453.48119.qmail@web33903.mail.mud.yahoo.com...

Show quoted text

ntdll.dll!7c918fea()
ntdll.dll!7c9106eb()
ntdll.dll!7c90104b()
msvcrt.dll!77c3b90d()
msvcrt.dll!77c420e7()
libecpg.dll!6d0c7471()

ecpgtest.exe!main(int argc=1, char * *

argv=0x003c0d10) Line 5 + 0xc C
ecpgtest.exe!mainCRTStartup() Line 206 + 0x19 C
kernel32.dll!7c816d4f()
kernel32.dll!7c8399f3()

The offending line in ecpgtest.pgc is

ECPGdebug(1,stderr);

I get the same result even if I use a file handle
obtained by using fopen

#8Michael Meskes
meskes@postgresql.org
In reply to: William ZHANG (#7)
Re: BUG #1815: ECPGdebug causes crash on Windows XP

On Mon, Aug 15, 2005 at 07:39:42PM +0800, William ZHANG wrote:

Yes. It is reproducible. But it works well in MinGW.
Is there sth. wrong with the import library lib\ms\libecpg.lib or
lib\libecpg.dll?

"Joshua Masiko" <joshua_masiko@yahoo.com>
wrote:20050813145453.48119.qmail@web33903.mail.mud.yahoo.com...

ntdll.dll!7c918fea()
ntdll.dll!7c9106eb()
ntdll.dll!7c90104b()
msvcrt.dll!77c3b90d()
msvcrt.dll!77c420e7()
libecpg.dll!6d0c7471()

ecpgtest.exe!main(int argc=1, char * *

argv=0x003c0d10) Line 5 + 0xc C
ecpgtest.exe!mainCRTStartup() Line 206 + 0x19 C
kernel32.dll!7c816d4f()
kernel32.dll!7c8399f3()

The offending line in ecpgtest.pgc is

ECPGdebug(1,stderr);

I get the same result even if I use a file handle
obtained by using fopen

Could someone with access to a Windows system have a look at this? I do
not have one atm. In particular I'd like to know whether it makes a
difference if your compiled ecpg with threading enabled or not. After
all without threading the function called does not much, just changing
two variables and logging the change.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

#9Bruce Momjian
bruce@momjian.us
In reply to: Michael Meskes (#8)
Re: BUG #1815: ECPGdebug causes crash on Windows XP

Ah, I have found the cause of the crash, and added documentation about
the cause:

On Win32, if the <application>ecpg</> libraries and application are
compiled with different flags, this function call will crash the
application because the internal representation of the <literal>FILE</>
pointers differ.

While such a mismatch is a problem on all platforms, it is more common
on Win32 where the FILE structure changes for debug, for example.

---------------------------------------------------------------------------

Michael Meskes wrote:

On Mon, Aug 15, 2005 at 07:39:42PM +0800, William ZHANG wrote:

Yes. It is reproducible. But it works well in MinGW.
Is there sth. wrong with the import library lib\ms\libecpg.lib or
lib\libecpg.dll?

"Joshua Masiko" <joshua_masiko@yahoo.com>
wrote:20050813145453.48119.qmail@web33903.mail.mud.yahoo.com...

ntdll.dll!7c918fea()
ntdll.dll!7c9106eb()
ntdll.dll!7c90104b()
msvcrt.dll!77c3b90d()
msvcrt.dll!77c420e7()
libecpg.dll!6d0c7471()

ecpgtest.exe!main(int argc=1, char * *

argv=0x003c0d10) Line 5 + 0xc C
ecpgtest.exe!mainCRTStartup() Line 206 + 0x19 C
kernel32.dll!7c816d4f()
kernel32.dll!7c8399f3()

The offending line in ecpgtest.pgc is

ECPGdebug(1,stderr);

I get the same result even if I use a file handle
obtained by using fopen

Could someone with access to a Windows system have a look at this? I do
not have one atm. In particular I'd like to know whether it makes a
difference if your compiled ecpg with threading enabled or not. After
all without threading the function called does not much, just changing
two variables and logging the change.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

-- 
  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
#10William ZHANG
uniware@zedware.org
In reply to: Michael Meskes (#8)
Re: BUG #1815: ECPGdebug causes crash on Windows XP

I remember that I have posted the answer to pgsql.bugs,
but now it can only be found here:

http://www.talkaboutdatabases.com/group/pgsql.bugs/messages/2346.html

Do not know what's wrong with the mail list or my mails.

"Bruce Momjian" <pgman@candle.pha.pa.us> wrote

Ah, I have found the cause of the crash, and added documentation about
the cause:

On Win32, if the <application>ecpg</> libraries and application are
compiled with different flags, this function call will crash the
application because the internal representation of the <literal>FILE</>
pointers differ.

While such a mismatch is a problem on all platforms, it is more common
on Win32 where the FILE structure changes for debug, for example.

--------------------------------------------------------------------------

-

Michael Meskes wrote:

On Mon, Aug 15, 2005 at 07:39:42PM +0800, William ZHANG wrote:

Yes. It is reproducible. But it works well in MinGW.
Is there sth. wrong with the import library lib\ms\libecpg.lib or
lib\libecpg.dll?

"Joshua Masiko" <joshua_masiko@yahoo.com>
wrote:20050813145453.48119.qmail@web33903.mail.mud.yahoo.com...

ntdll.dll!7c918fea()
ntdll.dll!7c9106eb()
ntdll.dll!7c90104b()
msvcrt.dll!77c3b90d()
msvcrt.dll!77c420e7()
libecpg.dll!6d0c7471()

ecpgtest.exe!main(int argc=1, char * *

argv=0x003c0d10) Line 5 + 0xc C
ecpgtest.exe!mainCRTStartup() Line 206 + 0x19 C
kernel32.dll!7c816d4f()
kernel32.dll!7c8399f3()

The offending line in ecpgtest.pgc is

ECPGdebug(1,stderr);

I get the same result even if I use a file handle
obtained by using fopen

Could someone with access to a Windows system have a look at this? I do
not have one atm. In particular I'd like to know whether it makes a
difference if your compiled ecpg with threading enabled or not. After
all without threading the function called does not much, just changing
two variables and logging the change.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot

(De|Com|Net|Org)

ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

-- 
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

Show quoted text

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

#11Bruce Momjian
bruce@momjian.us
In reply to: William ZHANG (#10)
Re: BUG #1815: ECPGdebug causes crash on Windows XP

Thanks, I have added an additional sentence to that section outlining
the specific items that should match --- patch attached.

---------------------------------------------------------------------------

William ZHANG wrote:

I remember that I have posted the answer to pgsql.bugs,
but now it can only be found here:

http://www.talkaboutdatabases.com/group/pgsql.bugs/messages/2346.html

Do not know what's wrong with the mail list or my mails.

"Bruce Momjian" <pgman@candle.pha.pa.us> wrote

Ah, I have found the cause of the crash, and added documentation about
the cause:

On Win32, if the <application>ecpg</> libraries and application are
compiled with different flags, this function call will crash the
application because the internal representation of the <literal>FILE</>
pointers differ.

While such a mismatch is a problem on all platforms, it is more common
on Win32 where the FILE structure changes for debug, for example.

--------------------------------------------------------------------------

-

Michael Meskes wrote:

On Mon, Aug 15, 2005 at 07:39:42PM +0800, William ZHANG wrote:

Yes. It is reproducible. But it works well in MinGW.
Is there sth. wrong with the import library lib\ms\libecpg.lib or
lib\libecpg.dll?

"Joshua Masiko" <joshua_masiko@yahoo.com>
wrote:20050813145453.48119.qmail@web33903.mail.mud.yahoo.com...

ntdll.dll!7c918fea()
ntdll.dll!7c9106eb()
ntdll.dll!7c90104b()
msvcrt.dll!77c3b90d()
msvcrt.dll!77c420e7()
libecpg.dll!6d0c7471()

ecpgtest.exe!main(int argc=1, char * *

argv=0x003c0d10) Line 5 + 0xc C
ecpgtest.exe!mainCRTStartup() Line 206 + 0x19 C
kernel32.dll!7c816d4f()
kernel32.dll!7c8399f3()

The offending line in ecpgtest.pgc is

ECPGdebug(1,stderr);

I get the same result even if I use a file handle
obtained by using fopen

Could someone with access to a Windows system have a look at this? I do
not have one atm. In particular I'd like to know whether it makes a
difference if your compiled ecpg with threading enabled or not. After
all without threading the function called does not much, just changing
two variables and logging the change.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot

(De|Com|Net|Org)

ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

-- 
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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

-- 
  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

Attachments:

/rtmp/difftext/plainDownload+8-8