Public bug reported:

There appears to be a bug in dbapps-lib when configuring mysql on a
remote machine. The offending line is:

            echo $sql | mysql ${dbc_dbserver:+-h $dbc_dbserver}
${dbc_dbserver:--h localhost} ${dbc_dbport:+--port $dbc_dbport} -u
$dbc_dbuser -p$dbc_dbpass $dbc_dbname -s || run_sql_fail $dbc_dbtype

If dbc_dbserver is defined then..

${dbc_dbserver:+-h $dbc_dbserver} evaluates to "-h $dbcserver"
and
${dbc_dbserver:--h localhost}  evaluates to "$dbcserver"

causing the mysql connect string to contain the remote hostname twice
and causing the connection to fail with a mysql syntax error.

I wrote the following which seems to fix the issue:

=== modified file 'dbapps-lib'
--- dbapps-lib  2012-05-10 20:06:30 +0000
+++ dbapps-lib  2012-05-10 20:09:02 +0000
@@ -14,7 +14,8 @@
     ERR=
     case $dbc_dbtype in
         mysql )
-            echo $sql | mysql ${dbc_dbserver:+-h $dbc_dbserver} 
${dbc_dbserver:--h localhost} ${dbc_dbport:+--port $dbc_dbport} -u $dbc_dbuser 
-p$dbc_dbpass $dbc_dbname -s || run_sql_fail $dbc_dbtype
+            l_dbc_dbserver=${dbc_dbserver:- localhost}
+            echo $sql | mysql -h ${l_dbc_dbserver} ${dbc_dbport:+--port 
$dbc_dbport} -u $dbc_dbuser -p$dbc_dbpass $dbc_dbname -s || run_sql_fail 
$dbc_dbtype
             ;;
         pgsql )
             if [ -z "${dbc_dbserver}" ]; then


This is my environment:

$ lsb_release -rd
Description:    Ubuntu 12.04 LTS
Release:        12.04

$ apt-cache policy phpbb3
phpbb3:
  Installed: 3.0.9-1
  Candidate: 3.0.9-1
  Version table:
 *** 3.0.9-1 0
        500 http://archive.ubuntu.com/ubuntu/ precise/universe i386 Packages
        100 /var/lib/dpkg/status

** Affects: phpbb3 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/997782

Title:
  Bug in dbapps-lib when configuring mysql on a remote machine

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/phpbb3/+bug/997782/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to