[SERVER-17726] Improve error messages when parsing config file for mongod Created: 24/Mar/15  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Admin, Usability
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Dwight Merriman Assignee: Backlog - Security Team
Resolution: Unresolved Votes: 0
Labels: platform-lhf
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Security
Participants:

 Description   

Some specific issues:

1) on the command line one types --dbpath. in the config file, it is dbPath:. lowercase isn't supported. that may be wise, however i suggest the error message if you typed the tolower of a valid parm name should be " ... , did you mean dbPath:?"

also if i have a tab, intentionally to test the error message, i get this:

Error parsing YAML config file: yaml-cpp: error at line 2, column 8: illegal map value

2) does illegal map value actually mean something to the user? (i don't know yaml well.) would "unexpected character" make more sense? the position is given which is nice.

3) can we just scan the whole file for a tab up front and say "tabs are not legal in yaml" as that is going to happen A LOT (if we don't want to just accept them as equivalent to a space, even though YAML doesn't...)

4) If I have an unknown option in a sub-section, the error message returned to the user says that the top level section is unknown. e.g.,

dan:(git)mongo[master]/$ ./mongod -f f.cfg
Unrecognized option: replication
try './mongod --help' for more information
dan:(git)mongo[master]/$ cat f.cfg
replication:
    master:true
dan:(git)mongo[master]/$ ./mongod -f f.cfg
Unrecognized option: replication
try './mongod --help' for more information


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