innobackupex-1.5.1 cannot handle MySQL passwords which contain special characters

Bug #688211 reported by Nick Pavey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona XtraBackup moved to https://jira.percona.com/projects/PXB
Fix Released
High
Valentine Gostev

Bug Description

Toolset version:

  innobackupex : 1.5.1
  xtrabackup : 1.2

Built from source, against MySQL 5.0.91.
Operating system RHEL 4, 64 bit AMD.

Command line :

  innobackupex --user='<user name>' --password='<password including shell special character' ...

NB - notice that the password on the 'innobackupex' command line is quoted, to prevent the command line shell from trying to interpret it.

EG :

  innobackupex-1.5.1 --host=<test host name> \
    --port=21192 \
    --user='nick' \
    --password='special&char' \
    --no-lock \
    --defaults-file <path to config file>/my.sandbox.cnf \
    `pwd`

  .... additional output here ....

  innobackupex-1.5.1: Starting mysql with options: --defaults-file="<path to config file>/my.sandbox.cnf" --password=special&char --user=nick --host=<test host name> --port=21192 --unbuffered --

  101209 14:34:06 innobackupex-1.5.1: Connected to database with mysql child process (pid=4969)
  ERROR 1045 (28000): Access denied for user 'msandbox'@'localhost' (using password: YES)

  innobackupex-1.5.1: Error: mysql child process has died: sh: char: command not found

As you can see, the '&' has been interpreted incorrectly when the upper level script calls the lower level MySQL instance.

The fix is as follows:

  sub get_mysql_options {
    my $options = '';

    # this option has to be first
    if ($option_defaults_file) {
        $options = "$options --defaults-file=\"$option_defaults_file\"";
    }

    if ($option_mysql_password) {
        $options = "$options --password='$option_mysql_password'"; <<<< Single quotes added here to protect the password
    }

    ....
  }

Related branches

Changed in percona-xtrabackup:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Alexey Kopytov (akopytov)
milestone: none → 1.6
Revision history for this message
Vadim Tkachenko (vadim-tk) wrote :

Assigned to core-longbow to prepare test case

Changed in percona-xtrabackup:
assignee: Alexey Kopytov (akopytov) → Valentine Gostev (core-longbow)
Changed in percona-xtrabackup:
status: Confirmed → In Progress
Changed in percona-xtrabackup:
status: In Progress → Triaged
Changed in percona-xtrabackup:
status: Triaged → Confirmed
Revision history for this message
Valentine Gostev (longbow) wrote :

I have linked the branch which contains a valid test case for this bug, also it contains fixed innobackupex-1.5.1 script (with additional single quotes for command line options)

lp:~core-longbow/percona-xtrabackup/bug688211

Revision history for this message
Valentine Gostev (longbow) wrote :
Changed in percona-xtrabackup:
status: Confirmed → Fix Committed
Changed in percona-xtrabackup:
status: Fix Committed → Fix Released
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PXB-293

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.