[SERVER-14331] single-character verbose configuration option in file Created: 21/Jun/14  Updated: 23/Mar/16  Resolved: 22/Mar/16

Status: Closed
Project: Core Server
Component/s: Admin
Affects Version/s: 2.4.10, 2.6.3
Fix Version/s: None

Type: Bug Priority: Trivial - P5
Reporter: Daniel Medina (Inactive) Assignee: Mark Benvenuto
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

$ cat mongod-v.conf
v = true
 
$ cat mongod-vv.conf
vv = true

$ mongodb-osx-x86_64-2.6.3/bin/mongod --config mongod-v.conf
Error parsing INI config file: unknown option v
[...]
 
# works
$ mongodb-osx-x86_64-2.6.3/bin/mongod --config mongod-vv.conf
2014-06-20T23:21:49.061-0400 [DataFileSync] BackgroundJob starting: DataFileSync
[...]

$ mongodb-osx-x86_64-2.4.0/bin/mongod --config mongod-v.conf
error command line: unknown option v
use --help for help

$ mongodb-osx-x86_64-2.6.3/bin/mongod -v
2014-06-20T23:29:07.213-0400 [DataFileSync] BackgroundJob starting: DataFileSync
[...]

Sprint: Platforms 12 (04/01/16)
Participants:

 Description   

2.6 Configuration Options cite compatibility with 2.4 options including the verbose family of options.

Docs refer to v = true in the configuration file, however this doesn't seem to work in 2.6 or 2.4.

Steps to reproduce included. Works fine as command-line argument.

Documentation states "[mongod’s command line arguments or using a configuration file] are functionally equivalent".

Previously: SERVER-11471.



 Comments   
Comment by Mark Benvenuto [ 22/Mar/16 ]

The INI files only support the long form for option names. For instance, "verbose" instead of "v. As explained by Shaun the reason why "vv" works is an artifact of how we registered the multiple "v" options with the option parser. While it is possible to change this behavior, the INI files should be more verbose, and so there is not need to support short options.

See https://github.com/boostorg/program_options/blob/develop/src/parsers.cpp#L116

Comment by Shaun Verch [ 23/Jun/14 ]

I believe this is caused by a combination of the way we register our verbose options, and an idiosyncrasy of boost program options.

boost program options allows a "short name" alias for options. The "-v" option is the "short name" for "--verbose": https://github.com/mongodb/mongo/blob/r2.7.2/src/mongo/db/server_options_helpers.cpp#L151

However, the other "vv", "vvv", etc. options are options on their own, rather than short names for another option. See https://github.com/mongodb/mongo/blob/r2.7.2/src/mongo/db/server_options_helpers.cpp#L258.

We used boost for the old INI config and the command line, and we still do for 2.6. My suspicion is that "short names" are not supported in INI config files in boost, so the "v" option is not recognized there, but the others are since they are their own options. I did a small test by trying "help=true" which worked, and "h=true", which did not work ("h" is the short name for "help").

I do believe this is a bug, although a minor one because the "workaround" is to just use "verbose" instead of "v", and because the INI config is deprecated.

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