[SERVER-36430] mongod.exe seems sensitive to trailing backslash in --dbpath Created: 03/Aug/18  Updated: 27/Oct/23  Resolved: 08/Aug/18

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

Type: Bug Priority: Minor - P4
Reporter: Michael Garde Assignee: Mark Benvenuto
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows


Issue Links:
Related
is related to SERVER-70354 File Path on WiredTiger Error with Tr... Closed
Participants:

 Description   

When launching mongod.exe with a trailing backslash in the --dbpath parameter 

mongod.exe --dbpath "c:\Users\USER\Local Documents\_kode\MongoDB-data\"

it fails with

options: { storage: { dbPath: "c:\Users\sosdagmc\Local Documents\_kode\MongoDB-data"" } }
exception in initAndListen: NonExistentPath: Data directory c:\Users\USER\Local Documents\_kode\MongoDB-data" not found., terminating

When launching it without the trailing backslash;

mongod.exe --dbpath "c:\Users\USER\Local Documents\_kode\MongoDB-data"

it starts with no issues.

options: { storage: { dbPath: "c:\Users\USER\Local Documents\_kode\MongoDB-data" } }
Detected data files in c:\Users\USER\Local Documents\_kode\MongoDB-data created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.

I'm not sure what the issue is here, but there is an extra " in the first options log, which looks odd.



 Comments   
Comment by Michael Garde [ 07/Aug/18 ]

Of course! The trailing backslash escapes the double quote at the end of the string. You are right this is intended behavior of cmd.exe and not a bug in mongod.exe. I'm actually a bit surprised. that I haven't encountered this scenario before.

Comment by Mark Benvenuto [ 06/Aug/18 ]

mgarde the behavior of the " (double quote) character being the last character of path is actually a behavior of cmd.exe and not mongod.exe. When cmd.exe calls mongod.exe in your first case, it passes the string 'c:\Users\USER\Local Documents_kode\MongoDB-data"' (note: I am using single-quotes to wrap the string). MongoDB does not manipulate the string in this case.

Comment by Nick Brewer [ 03/Aug/18 ]

mgarde Thanks for your report - I can confirm I'm seeing the same behavior in my testing. I'm passing this along to our Platform team for evaluation.

-Nick

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