[SERVER-3915] Installing mongod as a windows service fails if paths have spaces in them Created: 20/Sep/11  Updated: 29/Feb/12  Resolved: 06/Feb/12

Status: Closed
Project: Core Server
Component/s: Admin
Affects Version/s: 2.0.0
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Robert Stam Assignee: Tad Marshall
Resolution: Duplicate Votes: 0
Labels: Windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7


Issue Links:
Duplicate
duplicates SERVER-4410 Windows Service --install option isn'... Closed
Operating System: ALL
Participants:

 Description   

If mongod is installed as a Windows service and any command line parameters contain spaces it fails to start. For example:

C:>mongod --install --config "c:\test\mongo data\mongod.conf"

The install works, but the service can't be started. It looks like the quotes needed around the path containing a space are lost when the service is installed. The ImagePath entry in the Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MongoDB node contains:

"C:\mongodb\mongodb-win32-x86_64-2.0.0\bin\mongod" --config c:\test\mongo data\mongod.conf --service

Where you can see that the --config value is no longer quoted.

Easy workaround: don't use spaces in any paths.



 Comments   
Comment by Tad Marshall [ 29/Oct/11 ]

The routine ServiceController::installService() in util/ntservice.cpp has code to add the quotes back in for dbpath and logpath, but it needs to do the same thing with -f, --config, --pidfilepath and --keyFile.

Generated at Thu Feb 08 03:04:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.