Bugzilla – Bug 3461
mysqld command line on Windows
Last modified: 2008-09-15 14:39:24 UTC
On Windows mysqld.exe is being lauched with the wrong command line if you have your cache located somewhere where there is a space in the path. When it is lauched the command line is: [pathtomysqld]\mysqld.exe "--defaults-file=[pathtocache]\my.cnf" "--pid-file=[pathtocache]\slimserver-mysql.pid" Note the quotes around the options. I think this should be: [pathtomysqld]\mysqld.exe --defaults-file="[pathtocache]\my.cnf" --pid-file="[pathtocache]\slimserver-mysql.pid" Note the quotes just surround the paths. If I start the server when it is located on a short pathname folder the command line is: [pathtomysqld]\mysqld.exe --defaults-file=[pathtocache]\my.cnf --pid-file=[pathtocache]\slimserver-mysql.pid I tried changing the lauching code in MySQLHelper.pm to put the quotes in the correct place but that failed. I think the quotes are being added by Proc::Background. If I change the call to Proc::Background to: my $arg1 = sprintf('--defaults-file="%s"', $class->confFile); my $arg2 = sprintf('--pid-file="%s"', $class->pidFile); $::d_mysql && msgf("MySQLHelper: startServer() About to start MySQL with command: [%s %s %s]\n", $mysqld, $arg1, $arg2); $proc = Proc::Background->new($mysqld, $arg1, $arg2); I get the error: Could not open required defaults file: "=[pathtocache]\my.cnf" but running this same command line from a cmd prompt works.
Neil - if you change it to use something like: $path = Win32::GetShortPathName($path); before calling Proc::Background, does that work? Thanks.
It half works! GetShortPathName() works for the confFile but fails for the pidFile - it returns an empty string.
This patch seems to work. I don't fully understand it but the pidFile won't convert to a short filename and works even though the quotes surround the complete parameter (e.g. "--pid-file=[pathtocache]\slimserver-mysql.pid"). Index: MySQLHelper.pm =================================================================== --- MySQLHelper.pm (revision 7770) +++ MySQLHelper.pm (working copy) @@ -151,9 +151,13 @@ exit; }; + my $confFile = $class->confFile; + if (Slim::Utils::OSDetect::OS() eq 'win') { + $confFile = Win32::GetShortPathName($confFile); + } my @commands = ( $mysqld, - sprintf('--defaults-file=%s', $class->confFile), + sprintf('--defaults-file=%s', $confFile), sprintf('--pid-file=%s', $class->pidFile), );
Fixed in change 7789