Bug 3461 - mysqld command line on Windows
: mysqld command line on Windows
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Platform Support
: 6.5b1
: PC Windows XP
: P1 normal (vote)
: ---
Assigned To: Chris Owens
http://forums.slimdevices.com/showthr...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-05-28 09:44 UTC by Neil Sleightholm
Modified: 2008-09-15 14:39 UTC (History)
0 users

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Neil Sleightholm 2006-05-28 09:44:27 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.
Comment 1 Dan Sully 2006-06-05 21:51:00 UTC
Neil - if you change it to use something like:

$path = Win32::GetShortPathName($path);

before calling Proc::Background, does that work?

Thanks.
Comment 2 Neil Sleightholm 2006-06-06 11:16:52 UTC
It half works! GetShortPathName() works for the confFile but fails for the pidFile - it returns an empty string.
Comment 3 Neil Sleightholm 2006-06-06 13:20:47 UTC
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),
 	);
 
Comment 4 Dan Sully 2006-06-07 11:45:17 UTC
Fixed in change 7789