Package: dbconfig-common
Version: 1.8.31
Severity: normal
Tags: patch

I am not sure I am missing something, but I cannot build a webcalendar
package [1] that initializes correctly the MySQL database.  I traced down
the problem and discovered a problem in dpkg/postint: the order of the 
creatadb and createuser commands are reversed.  The patch attached below
fixes the problem for me.

Indeed, I see in internal/mysql:

dbc_mysql_createdb(){
        [...]
                _dbc_nodb="yes" dbc_mysql_exec_command "CREATE DATABASE 
$dbc_dbname"
        [...]
        
dbc_mysql_createuser(){
        [...]
GRANT ALL PRIVILEGES ON \`$dbc_dbname\`.* TO \`$dbc_dbuser\`[...]
        [...]

Now, the database $dbc_dbname must be created before the
dbc_mysql_createuser is called, but this is not what dpkg/postinst does.

If this is not a bug, please indicate to me how I can make the webcalendar
package install correctly.

[1] The webcalendar package is being actually co-maintainied in Alioth,
    see http://svn.debian.org/wsvn/collab-maint/ext-maint/webcalendar/

Thanks,

Rafael Laboissiere
    
-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.17-2-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages dbconfig-common depends on:
ii  debconf [debconf-2.0]         1.4.72     Debian configuration management sy
ii  ucf                           2.007      Update Configuration File: preserv

dbconfig-common recommends no packages.

-- debconf information excluded
diff -Naur dbconfig-common/dpkg/postinst dbconfig-common-new/dpkg/postinst
--- dbconfig-common/dpkg/postinst       2007-03-04 13:10:42.000000000 +0100
+++ dbconfig-common-new/dpkg/postinst   2007-04-08 09:50:45.000000000 +0200
@@ -62,15 +62,16 @@
                # don't perform the following block of code during upgrades
                if [ ! "$upgrading" ]; then
                        ###
-                       ### now, create the app user account
+                       ### create the database
                        ###
-                       $dbc_createuser_cmd || dbc_install_error "creating user"
+
+                       $dbc_createdb_cmd || dbc_install_error "creating 
database"
                        [ "$dbc_tried_again" ] && return 0
        
                        ###
-                       ### create the database
+                       ### now, create the app user account
                        ###
-                       $dbc_createdb_cmd || dbc_install_error "creating 
database"
+                       $dbc_createuser_cmd || dbc_install_error "creating user"
                        [ "$dbc_tried_again" ] && return 0
        
                        ###

Reply via email to