Bug #57824 On windows, mysqlbackup fails when path to my.cnf contains spaces
Submitted: 28 Oct 2010 21:34 Modified: 11 Aug 2011 20:46
Reporter: Lee Stigile Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Backup Severity:S2 (Serious)
Version:3.5.2 OS:Any
Assigned to: Satya B CPU Architecture:Any

[28 Oct 2010 21:34] Lee Stigile
Description:
MEB, Windows XP, not creating ibbackup_export_variables.txt and backup fails.  

Command to launch mysqlbackup.exe:
C:\Program Files\MySQL\MySQL Server 5.5>mysqlbackup --user=root my.ini .

However, in destination backup directory, the my-backup.cnf is created

Output:
C:\Program Files\MySQL\MySQL Server 5.5>mysqlbackup --user=root my.ini .
mysqlbackup: Starting mysqlbackup with following arguments:
mysqlbackup --user=root my.ini .
mysqlbackup: The unique backup id generated for the current backup operation is
12883010601305928

mysqlbackup: IMPORTANT: Please check that backup run completes successfully.
            At the end of a successful 'backup' run mysqlbackup
            prints "mysqlbackup completed OK!".

mysqlbackup: Created backup directory '.\2010-10-28_15-24-20'
mysqlbackup: Using ibbackup version 3.5.2 MySQL Enterprise Backup version 3.5.2
mysqlbackup: Using MySQL client version: 5.1.53
mysqlbackup: Using MySQL server version: 5.5.6-rc

101028 15:24:20 mysqlbackup: Starting ibbackup binary with args:

ibbackup.exe --suspend-at-end my.ini .\2010-10-28_15-24-20\backup-my.cnf
mysqlbackup: Error: The system cannot find the file specified.
 : 2
mysqlbackup: Error: mysqlbackup "backup" failed
mysqlbackup: Warning: Backup Logging: The LSN fields from ibbackup cannot be log
ged. Cannot open ibbackup_export_variables.txt file to read  No such file or dir
ectory: (Errcode: 2)
mysqlbackup: Warning: Backup Logging: The fields start_lsn, incremental_base_lsn
, end_lsn will be zeros.

C:\Program Files\MySQL\MySQL Server 5.5>mysqlbackup --user=root my.ini .

How to repeat:
Command to launch mysqlbackup.exe:
C:\Program Files\MySQL\MySQL Server 5.5>mysqlbackup --user=root my.ini .

I've also tried launching backup in a different directory and with a full destination location.
[3 Nov 2010 7:58] Satya B
On a successful execution of ibbackup process (by mysqlbackup) will create  ibbackup_export_variables.txt.

In other words, failed backup operations due to ibbackup execution failures will not create ibbackup_export_variables.txt file.

DOCS: Plz note.

Regarding the backup operation failure, I think ibbackup doesn't recognize "." and a full path is necessary. (Have to test and confirmed)
[3 Nov 2010 9:33] Satya B
ibbackup.exe --suspend-at-end my.ini .\2010-10-28_15-24-20\backup-my.cnf
mysqlbackup: Error: The system cannot find the file specified.
 : 2

ibbackup is not able to find the backup-my.cnf.
[8 Nov 2010 11:27] Satya B
Unable to reproduce this bug. 

***UPDATE:****
the current directory "." is recognized even in WINDOWS

@Lee Stigile
If you are able to reprodcue this bug, plz report the necessary steps to reproduce.
[8 Nov 2010 11:29] Satya B
On my windows box:
==================

C:\WORK\meb-3.5.next\meb-innobackup-c>%INNOBACKUP%  --user=root --port=13000 my.
ini .
mysqlbackup: Starting mysqlbackup with following arguments:
C:\WORK\meb-3.5.next\meb-innobackup-c\Debug\innobackup.exe --user=root --port=13
000 my.ini .
mysqlbackup: The unique backup id generated for the current backup operation is
12892154316377628

mysqlbackup: IMPORTANT: Please check that backup run completes successfully.
            At the end of a successful 'backup' run mysqlbackup
            prints "mysqlbackup completed OK!".

mysqlbackup: Created backup directory '.\2010-11-08_16-53-51'
mysqlbackup: Using ibbackup version 3.5.2 MySQL Enterprise Backup version 3.5.2
mysqlbackup: Using MySQL client version: 5.1.53
mysqlbackup: Using MySQL server version: 5.1.53-debug-log

101108 16:53:51 mysqlbackup: Starting ibbackup binary with args:

ibbackup.exe --suspend-at-end my.ini .\2010-11-08_16-53-51\backup-my.cnf
mysqlbackup: Waiting for ibbackup process to suspend
mysqlbackup: Suspend file '.\2010-11-08_16-53-51\ibbackup_suspended'
ibbackup version 3.5.2 MySQL Enterprise Backup version 3.5.2
Copyright (c) 2002, 2010, Oracle and/or its affiliates.
Run 'ibbackup --help' for help and 'ibbackup --version' for version info.

Contents of my.ini:
innodb_data_home_dir got value C:/WORK/mysql-5.1-meb-win/mysql-test/var/mysqld.1
/data
innodb_data_file_path got value ibdata1:10M;ibdata2:10M:autoextend
datadir got value C:/WORK/mysql-5.1-meb-win/mysql-test/var/mysqld.1/data
innodb_log_group_home_dir got value C:/WORK/mysql-5.1-meb-win/mysql-test/var/mys
qld.1/data
innodb_log_files_in_group got value 3
innodb_log_file_size got value 5242880

Contents of .\2010-11-08_16-53-51\backup-my.cnf:
innodb_data_home_dir got value .\2010-11-08_16-53-51
innodb_data_file_path got value ibdata1:10M;ibdata2:10M:autoextend
datadir got value .\2010-11-08_16-53-51
innodb_log_group_home_dir got value .\2010-11-08_16-53-51
innodb_log_files_in_group got value 3
innodb_log_file_size got value 5242880

ibbackup: System tablespace file format is Antelope.
ibbackup: Found checkpoint at lsn 51417.
ibbackup: Starting log scan from lsn 51200.
101108 16:53:51  ibbackup: Copying log...
101108 16:53:51  ibbackup: Log copied, lsn 51417.
ibbackup: We wait 1 second before starting copying the data files...
101108 16:53:52  ibbackup: Copying C:\WORK\mysql-5.1-meb-win\mysql-test\var\mysq
ld.1\data\ibdata1 (Antelope file format).
101108 16:53:53  ibbackup: Copying C:\WORK\mysql-5.1-meb-win\mysql-test\var\mysq
ld.1\data\ibdata2 (Antelope file format).

ibbackup: You specified the option --suspend-at-end.
101108 16:53:54  ibbackup: Suspending the backup procedure to wait
ibbackup: until you delete the marker file .\2010-11-08_16-53-51\ibbackup_suspen
ded.

101108 16:53:54 mysqlbackup: Continuing after ibbackup has suspended

101108 16:53:54 mysqlbackup: Starting to lock all the tables....

101108 16:53:54 mysqlbackup: All tables are locked and flushed to disk
mysqlbackup: Opening backup source directory 'C:\WORK\mysql-5.1-meb-win\mysql-te
st\var\mysqld.1\data'

101108 16:53:54 mysqlbackup: Starting to backup all files in subdirectories of '
C:\WORK\mysql-5.1-meb-win\mysql-test\var\mysqld.1\data'
mysqlbackup: Backing up the database directory 'mtr'
mysqlbackup: Backing up the database directory 'mysql'
mysqlbackup: Backing up the database directory 'test'
mysqlbackup: Resuming ibbackup

101108 16:53:55  ibbackup: Suspension ends. Continuing the backup procedure.

101108 16:53:55  ibbackup: Copying of the last data file is close to ending...
ibbackup: We still once copy the latest flushed log to ibbackup_logfile.
ibbackup: A copied database page was modified at 51417.
ibbackup: Scanned log up to lsn 53076.
ibbackup: Was able to parse the log up to lsn 53076.
ibbackup: Maximum page number for a log record 51
101108 16:53:55  ibbackup: Full backup completed!

101108 16:53:55 mysqlbackup: All tables unlocked
mysqlbackup: All MySQL tables were locked for 1.114 seconds
mysqlbackup: start_lsn: 51200
mysqlbackup: incremental_base_lsn: 51417
mysqlbackup: end_lsn: 53076

101108 16:53:55 mysqlbackup: mysqlbackup completed OK!
[9 Nov 2010 22:11] Lee Stigile
Hello,  I believe that I've identified the problem.  When running mysqlbackup.exe, if I pass a path to the my.ini file which contains a space such as c:\program files\mysql\mysql server 5.5\my.ini the backup fails.  It fails, even if the path is surrounded by double quotes.

In the output of my unsuccessful backup, there was a message that an invalid parameter was passed to ibbackup "server".  I deteremined that server was from the invalid parsing of the path.

For instance:  the following fails:
C:\Program Files\MySQL\MySQL Enterprise Backup 3.5.next>mysqlbackup "C:\program
files\mysql\MySQL Server 5.5\my.ini"  c:\backup --user=root

But, the following succeeds:
C:\Program Files\MySQL\MySQL Enterprise Backup 3.5.next>mysqlbackup "C:\backup\my.ini"  c:\backup --user=root
[10 Nov 2010 11:02] Satya B
TEST 1: No quotes used at all
==============================

C:\WORK\mysql-5.1-meb-win\mysql-test>%INNOBACKUP% --ibbackup=%IBBACKUP% --user=r
oot --port=13000 C:\work\test with space\my.cnf .
mysqlbackup: Error: incorrect number of command line arguments, use  --help for
usage

TEST 2: quotes around the directory which has spaces
========================================================
C:\WORK\mysql-5.1-meb-win\mysql-test>%INNOBACKUP% --ibbackup=%IBBACKUP% --user=r
oot --port=13000 C:\work\"test with space"\my.cnf .
mysqlbackup: Error: incorrect number of command line arguments, use  --help for
usage

TEST 3: quotes used around the entire path to my.cnf
======================================================
C:\WORK\mysql-5.1-meb-win\mysql-test>%INNOBACKUP% --ibbackup=%IBBACKUP% --user=r
oot --port=13000 "C:\work\test with space\my.cnf" .
mysqlbackup: Starting mysqlbackup with following arguments:
C:\WORK\meb-3.5.next\meb-innobackup-c\Debug\innobackup.exe --ibbackup=C:\WORK\me
b-3.5.next\meb-ibbackup\bin\Debug\ibbackup.exe --user=root --port=13000 C:\work\
test with space\my.cnf .
mysqlbackup: The unique backup id generated for the current backup operation is
12893866176562516

mysqlbackup: IMPORTANT: Please check that backup run completes successfully.
            At the end of a successful 'backup' run mysqlbackup
            prints "mysqlbackup completed OK!".

mysqlbackup: Created backup directory '.\2010-11-10_16-26-57'
mysqlbackup: Using ibbackup version 3.5.2 MySQL Enterprise Backup version 3.5.2
mysqlbackup: Using MySQL client version: 5.1.53
mysqlbackup: Using MySQL server version: 5.1.53-debug-log

101110 16:26:58 mysqlbackup: Starting ibbackup binary with args:

C:\WORK\meb-3.5.next\meb-ibbackup\bin\Debug\ibbackup.exe --suspend-at-end C:\wor
k\test with space\my.cnf .\2010-11-10_16-26-57\backup-my.cnf
mysqlbackup: Waiting for ibbackup process to suspend
mysqlbackup: Suspend file '.\2010-11-10_16-26-57\ibbackup_suspended'
ibbackup version 3.5.2 MySQL Enterprise Backup version 3.5.2
Copyright (c) 2002, 2010, Oracle and/or its affiliates.
Run 'ibbackup --help' for help and 'ibbackup --version' for version info.

ibbackup: Error: extraneous argument space\my.cnf.
ibbackup: Run 'ibbackup --help' for help.
mysqlbackup: Error: ibbackup process has died
mysqlbackup: Error: mysqlbackup "backup" failed
mysqlbackup: Warning: Backup Logging: The LSN fields from ibbackup cannot be log
ged. Cannot open ibbackup_export_variables.txt file to read  No such file or dir
ectory: (Errcode: 2)
mysqlbackup: Warning: Backup Logging: The fields start_lsn, incremental_base_lsn
, end_lsn will be zeros.

This is indeed a bug.
[10 Nov 2010 11:07] Satya B
@Lee Stigile

Thanks for the reporting and analyzing the bug!
[18 Nov 2010 12:33] Satya B
can be solved by using the windows api GetShortPathName().

See http://msdn.microsoft.com/en-us/library/Aa364989
[22 Mar 2011 22:02] Hema Sridharan
Hi,

Yes, this test is reproducible in MEB 3.5.2 as well as in MEB 3.6 versions. I also noticed that when backup dir path name contains space, mysqlbackup fails with error "Error: Found extraneous commands at the end."

hema@HEMA_SRIDHARAN /cygdrive/c/mysql-server/MEB/meb-36-windows/src/build/Debug
$ ./mysqlbackup.exe  --datadir=C:\\mysql-server\\meb-server-tree\\mysql-5.1-meb
-new\\mysql-test\\var\\mysqld.1\\data\\ --innodb_log_file_size=5M --innodb_log_
files_in_group=4 --backup_innodb_log_files_in_group=4 --backup_innodb_log_file_
size=5M --innodb_data_home_dir=C:\\mysql-server\\meb-server-tree\\mysql-5.1-meb
\\mysql-test\\var\\mysqld.1\\data\\ --backup-dir=C:\\mysql-server\\meb-server-t
ree\\Dir with space\\backuptest\\ --socket=C:\\mysql-server\\meb-server-tree\\m
ysql-test\\var\\tmp\\mysqld.1.sock --user=root --port=13000 --protocol=tcp back
up

InnoDB Backup Utility v3.6.0 [Tue 03/22/2011 ]
Copyright (c) 2003, 2011, Oracle and/or its affiliates. All Rights Reserved.

INFO: Starting with following command line ...
 C:\mysql-server\MEB\meb-36-windows\src\build\Debug\mysqlbackup.exe
        --datadir=C:\mysql-server\meb-server-tree\mysql-5.1-meb-new\mysql-test\v
ar\mysqld.1\data\
        --innodb_log_file_size=5M --innodb_log_files_in_group=4
        --backup_innodb_log_files_in_group=4 --backup_innodb_log_file_size=5M
        --innodb_data_home_dir=C:\mysql-server\meb-server-tree\mysql-5.1-meb\mys
ql-test\var\mysqld.1\data\
        --backup-dir=C:\mysql-server\meb-server-tree\Dir with space\backuptest\

        --socket=C:\mysql-server\meb-server-tree\mysql-test\var\tmp\mysqld.1.soc
k
        --user=root --port=13000 --protocol=tcp backup

Error: Found extraneous commands at the end.
Use --help option for usage description.
[17 Apr 2011 10:52] Valeriy Kravchuk
Bug #60898 was marked as a duplicate of this one.
[11 Aug 2011 18:50] Sveta Smirnova
Bug is fixed in version 3.6 Please upgrade.
[11 Aug 2011 20:46] John Russell
Added to 3.6 changelog:

The mysqlbackup command could fail on Windows systems if the path to
 the MySQL configuration file contained spaces.