On Tue, Sep 27, 2005 at 04:14:27AM -0400, sean finney wrote:
> unfortunately, this would require me to know what was in the contents
> of every sql file used by dbconfig-common using packages, or to
Ah yes, I see.

Then again....
If Postgres is setup like this then when whoever wants to access it, 
they will need to have a unix user (even if it is www-data) so they sort
of need to get the user sorted out anyhow.

I realised this when I had to create the JFFNMS user anyway.

> yeah, that's what i'm guessing too.  i'm still looking into it; i'll get
> back to you if i find sometihng.  
More digging has given me some interesting results.  I'm not a shell
guru so i don't understand why this happens.

First in dpkg/postinst put some values:
                echo foo1 dbname "$dbc_dbname"
                $dbc_createuser_cmd || dbc_install_error "creating user"
                [ "$dbc_tried_again" ] && return 0

                ###
                ### create the database
                ###
                echo foo2 dbname "$dbc_dbname"

In internal/pgsql function dbc_pgsql_createuser() I put some debug stuff

        dbc_logpart "creating postgres user $dbc_dbuser: "
        dbc_logline "XXX CU1 dbname is $dbc_dbname "

        if dbc_pgsql_check_user; then
        dbc_logline "XXX CU2 dbname is $dbc_dbname "
[adjust user code here]
        elif _dbc_createuser; then
        dbc_logline "XXX CU3 dbname is $dbc_dbname "


So let's look at the typescript, first time run...
foo1 dbname dbtestpgsql
XXX check connect faked 3template1.
creating postgres user dbtestpgsql:  XXX CU1 dbname is 3template1 .
XXX CU3 dbname is template1 .
success.
verifying creation of user: success.
XXX CU4 dbname is template1 .
foo2 dbname template1

Then run it again, user exists:
foo1 dbname dbtestpgsql
XXX check connect faked 3template1.
creating postgres user dbtestpgsql:  XXX CU1 dbname is 3template1 .
XXX CU2 dbname is template1 .
already exists.
XXX CU4 dbname is template1 .
foo2 dbname template1

I think it is leaking in the pgsql exec part, it is very strange.
The problem is that foo2 line is just before it is creating the tables,
so you are in trouble.

I have an evil fix, you might not like it but I can install and purge
the db-test-pgsql package with it.

Have a variable in the dpkg/* files that saves the database name.
Use that each time to set the dbc_dbname variable.

eg
                save_dbname="$dbc_dbname"
                $dbc_createuser_cmd || dbc_install_error "creating user"
[...]
                dbc_dbname="$save_dbname"
                $dbc_createdb_cmd || dbc_install_error "creating database"
[...]
                dbc_dbname="$save_dbname"
                dbc_sqlfile=$dbc_share/data/$dbc_package/install/$dbc_dbtype
                
dbc_sqlfile_adm=$dbc_share/data/$dbc_package/install-dbadmin/$dbc

Ugly, but it works!

I'm trying not to hassle you, but my package JFFNMS depends on this
working.  I got a few DB-related bugs with it that this package should
clear out for me.

 - Craig

-- 
Craig Small      GnuPG:1C1B D893 1418 2AF4 45EE  95CB C76C E5AC 12CA DFA5
Eye-Net Consulting http://www.enc.com.au/   MIEE         Debian developer
csmall at : enc.com.au                      ieee.org           debian.org


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to