New ecgp code problem.

Started by Keith Parksalmost 28 years ago13 messages
#1Keith Parks
emkxp01@mtcc.demon.co.uk

Hi All,

I'm getting a SEGV error when testing ecpg using the perftest,or
any other, example program.

I have tracked this down to a call to PQfinish() in ECPGfinish()
that occurs before any connection is established.

bool
ECPGfinish()
{
if (simple_connection != NULL)
{
ECPGlog("ECPGfinish: finishing.\n");
PQfinish(simple_connection);
}
else
ECPGlog("ECPGfinish: called an extra time.\n");
return true;
}

A test is made here for simple_connection != NULL.

If I apply the following patch all is OK.

Keith.

*** src/interfaces/ecpg/lib/ecpglib.c.orig      Tue Feb 17 22:01:00 1998
--- src/interfaces/ecpg/lib/ecpglib.c   Tue Feb 17 22:01:30 1998
***************
*** 24,30 ****
  #include <libpq-fe.h>
  #include <libpq/pqcomm.h>
! static PGconn *simple_connection;
  static int    simple_debug = 0;
  static FILE *debugstream = NULL;
  static int    committed = true;
--- 24,30 ----
  #include <libpq-fe.h>
  #include <libpq/pqcomm.h>

! static PGconn *simple_connection = NULL;
static int simple_debug = 0;
static FILE *debugstream = NULL;
static int committed = true;

#2Michael Meskes
meskes@topsystem.de
In reply to: Keith Parks (#1)
Re: New ecgp code problem.

Keith Parks writes:

If I apply the following patch all is OK.

Thanks. It's already in CVS it seems. Are you able to execute programs
against v6.3? I cannot even create a user so I only can test my changes my
manually inspecting the C file right now.

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

#3Keith Parks
emkxp01@mtcc.demon.co.uk
In reply to: Michael Meskes (#2)
Re: New ecgp code problem.

Hi,

Things were working upto a point when I was playing yesterday.

The perftest seemed to run OK
The test2 example ran but did not display the varchar (name) field.

I'm afraid I've not got very far debugging.

Keith.

Michael Meskes <meskes@topsystem.de>

Show quoted text

Keith Parks writes:

If I apply the following patch all is OK.

Thanks. It's already in CVS it seems. Are you able to execute programs
against v6.3? I cannot even create a user so I only can test my changes my
manually inspecting the C file right now.

#4Meskes, Michael
meskes@topsystem.de
In reply to: Keith Parks (#3)
RE: New ecgp code problem.

Do you mean you didn't get any output? Or you got just the numbers? If
you didn't get anything that's the old problem and I believe the same
problem holds for ODBC (Julie?). The first fetch returns no row, so the
program ends. Unfortunately I haven't changed anything I expect to be
able to cause that problem. It seems to be a backend/library problem.

Anyway, which version are you using? I cannot connect to a database
since last week or so. I tried re-initdb'ing it but get a seg fault in
the backend when doing a createuser. So my only chance of testing right
now is to manually inspect the code created.

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

Show quoted text

-----Original Message-----
From: Keith Parks [SMTP:emkxp01@mtcc.demon.co.uk]
Sent: Wednesday, February 18, 1998 8:28 PM
To: meskes@topsystem.de
Cc: pgsql-hackers@postgresql.org
Subject: Re: New ecgp code problem.

Hi,

Things were working upto a point when I was playing yesterday.

The perftest seemed to run OK
The test2 example ran but did not display the varchar (name) field.

I'm afraid I've not got very far debugging.

Keith.

#5The Hermit Hacker
scrappy@hub.org
In reply to: Meskes, Michael (#4)
pg_user permissions problem (Was: Re: [HACKERS] RE: New ecgp code problem.)

On Thu, 19 Feb 1998, Meskes, Michael wrote:

Do you mean you didn't get any output? Or you got just the numbers? If
you didn't get anything that's the old problem and I believe the same
problem holds for ODBC (Julie?). The first fetch returns no row, so the
program ends. Unfortunately I haven't changed anything I expect to be
able to cause that problem. It seems to be a backend/library problem.

I spent time with Julie last night working on this, and the
problem comes back down to "pg_user: Permission Denied"...

I think this is a high priority problem, since it affects so many
things.

What is the chance of (how hard would it be to?) having a hard
coded view setup that overrides the permissions lock on pg_user? At what
point is the lock implemented, software level, or file system?

All we would really need was:

create view all_users as select usename,usesysid from pg_user;

Which psql/odbc/ecgp/jdbc could call instead of what its doing
now...

#6Michael Meskes
meskes@topsystem.de
In reply to: The Hermit Hacker (#5)
Re: pg_user permissions problem (Was: Re: [HACKERS] RE: New ecgp code problem.)

The Hermit Hacker writes:

What is the chance of (how hard would it be to?) having a hard
coded view setup that overrides the permissions lock on pg_user? At what
point is the lock implemented, software level, or file system?

I wasn't able to read data from a DB that I created with the very same user.
But I was able to connect, insert data etc. Why was that possible?

All we would really need was:

create view all_users as select usename,usesysid from pg_user;

Which psql/odbc/ecgp/jdbc could call instead of what its doing
now...

ecpg doesn't call anything like that. All I use is some PQ... functions. No
direct access to whatever user permission system we have. So does this have
to be changed in libpq?

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

#7Bruce Momjian
maillist@candle.pha.pa.us
In reply to: The Hermit Hacker (#5)
Re: pg_user permissions problem (Was: Re: [HACKERS] RE: New ecgp code problem.)

I spent time with Julie last night working on this, and the
problem comes back down to "pg_user: Permission Denied"...

I think this is a high priority problem, since it affects so many
things.

What is the chance of (how hard would it be to?) having a hard
coded view setup that overrides the permissions lock on pg_user? At what
point is the lock implemented, software level, or file system?

I believe the only way to fix it at this point is to remove the REVOKE
pg_user from initdb, and add a check in user.c to make sure the
permissions on pg_user are not NULL if they try and use passwords.

--
Bruce Momjian
maillist@candle.pha.pa.us

#8Keith Parks
emkxp01@mtcc.demon.co.uk
In reply to: Meskes, Michael (#4)
RE: New ecgp code problem.

Hi,

The problem is just the missing name column.

I've just trashed my last build, which passed the regression tests
perfectly (SPARC/Linux on an IPX), to do a fresh build from CVS.

Once this is complete I'll do some more tests.

Basically the output looks something like.

was born 19661202 (age=32)
was born 19881202 (age=54)
etc.
etc.
^^^^^^^^
Just a blank field!!

Maybe it's something in the structure handling?

Keith.

"Meskes, Michael" <meskes@topsystem.de>

Show quoted text

Do you mean you didn't get any output? Or you got just the numbers? If
you didn't get anything that's the old problem and I believe the same
problem holds for ODBC (Julie?). The first fetch returns no row, so the
program ends. Unfortunately I haven't changed anything I expect to be
able to cause that problem. It seems to be a backend/library problem.

Anyway, which version are you using? I cannot connect to a database
since last week or so. I tried re-initdb'ing it but get a seg fault in
the backend when doing a createuser. So my only chance of testing right
now is to manually inspect the code created.

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

-----Original Message-----
From: Keith Parks [SMTP:emkxp01@mtcc.demon.co.uk]
Sent: Wednesday, February 18, 1998 8:28 PM
To: meskes@topsystem.de
Cc: pgsql-hackers@postgresql.org
Subject: Re: New ecgp code problem.

Hi,

Things were working upto a point when I was playing yesterday.

The perftest seemed to run OK
The test2 example ran but did not display the varchar (name) field.

I'm afraid I've not got very far debugging.

Keith.

#9Michael Meskes
meskes@topsystem.de
In reply to: Keith Parks (#8)
Re: [HACKERS] RE: New ecgp code problem.

Keith Parks writes:

Hi,

The problem is just the missing name column.

I think I know the problem. I will send a patch later (again) but I cannot
test it myself as I still cannot create a user. Hmm, maybe I should try as
postgres user.

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

#10Meskes, Michael
meskes@topsystem.de
In reply to: Michael Meskes (#9)
RE: [HACKERS] RE: New ecgp code problem.

Unfortunately createdb as user postgres doesn't work either, so I have
to keep debugging without being able to run the binary.

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

Show quoted text

-----Original Message-----
From: Michael Meskes [SMTP:meskes@topsystem.de]
Sent: Friday, February 20, 1998 9:41 AM
To: emkxp01@mtcc.demon.co.uk
Cc: pgsql-hackers@postgreSQL.org
Subject: Re: [HACKERS] RE: New ecgp code problem.

Keith Parks writes:

Hi,

The problem is just the missing name column.

I think I know the problem. I will send a patch later (again) but I
cannot
test it myself as I still cannot create a user. Hmm, maybe I should
try as
postgres user.

Michael

--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10

#11The Hermit Hacker
scrappy@hub.org
In reply to: Meskes, Michael (#10)
RE: [HACKERS] RE: New ecgp code problem.

On Fri, 20 Feb 1998, Meskes, Michael wrote:

Unfortunately createdb as user postgres doesn't work either, so I have
to keep debugging without being able to run the binary.

I'm curious here as to why nobody has looked into this
problem...why is it that you can't create a database/user? *raised
eyebrow*

#12Thomas G. Lockhart
lockhart@alumni.caltech.edu
In reply to: The Hermit Hacker (#11)
Re: [HACKERS] RE: New ecgp code problem.

Unfortunately createdb as user postgres doesn't work either, so I have
to keep debugging without being able to run the binary.

I'm curious here as to why nobody has looked into this
problem...

Because no one else sees the problem? I've forgotten what your symptom
actually is, but from the 980217 cvs tree:

postgres=> \q
golem$ createuser tgl
Enter user's postgres ID or RETURN to use unix user ID: 106 ->
Is user "tgl" allowed to create databases (y/n) y
Is user "tgl" allowed to add users? (y/n) y
createuser: tgl was successfully added
...
golem> createdb
golem> psql
Welcome to the POSTGRESQL interactive sql monitor:
...
You are currently connected to the database: tgl

tgl=>

Have you done a complete "make clean; make install; initdb" cycle??

- Tom

#13Meskes, Michael
meskes@topsystem.de
In reply to: Thomas G. Lockhart (#12)
RE: [HACKERS] RE: New ecgp code problem.

I was afraid to hear something like that.

I just tried starting posgres manually and enter the statement that
caused the seg fault manually but then it works!

I will try to find some more time.

Michael
--
Dr. Michael Meskes, Projekt-Manager | topystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Use Debian GNU/Linux! | Tel: (+49) 2405/4670-44

Show quoted text

----------
From: Thomas G. Lockhart[SMTP:lockhart@alumni.caltech.edu]
Sent: Freitag, 20. Februar 1998 14:26
To: The Hermit Hacker
Cc: Meskes, Michael; emkxp01@mtcc.demon.co.uk;
pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] RE: New ecgp code problem.

Unfortunately createdb as user postgres doesn't work either, so I

have

to keep debugging without being able to run the binary.

I'm curious here as to why nobody has looked into this
problem...

Because no one else sees the problem? I've forgotten what your symptom
actually is, but from the 980217 cvs tree:

postgres=> \q
golem$ createuser tgl
Enter user's postgres ID or RETURN to use unix user ID: 106 ->
Is user "tgl" allowed to create databases (y/n) y
Is user "tgl" allowed to add users? (y/n) y
createuser: tgl was successfully added
...
golem> createdb
golem> psql
Welcome to the POSTGRESQL interactive sql monitor:
...
You are currently connected to the database: tgl

tgl=>

Have you done a complete "make clean; make install; initdb" cycle??

- Tom