[SERVER-22525] Fix implicit options usage in test cases Created: 08/Feb/16  Updated: 14/Apr/16  Resolved: 22/Mar/16

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 3.3.1
Fix Version/s: 3.3.4

Type: Bug Priority: Major - P3
Reporter: Mark Benvenuto Assignee: Mark Benvenuto
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-20754 mongo/util/options_parser/options_par... Closed
is depended on by SERVER-17294 Upgrade to boost 1.60 Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platforms 10 (02/19/16), Platforms 12 (04/01/16)
Participants:

 Description   

In Mongo, MongoD, and MongoS, we have several options which are implicit options:

  1. password (mongo)
  2. PEMKeyPassword (*)
  3. sslClusterPassword (mongod, mongos)

These are options that have been setup with setImplicitValue.

To quote setImplicitValue

Add an implicit value for this option if it is specified with no argument

This maps to boost::program_options::typed_value::implicit_value which is defined as:

Specifies an implicit value, which will be used if the option is given, but without an adjacent value. Using this implies that an explicit value is optional, but if given, must be strictly adjacent to the option, i.e.: '-ovalue' or '--option=value'. Giving '-o' or '--option' will cause the implicit value to be applied.
Unlike the above overload, the type 'T' need not provide operator<< for ostream, but textual representation of default value must be provided by the user.

This has been documented this way since boost 1.49.

This means that the common way of passing passwords for example on the command line as used by the tests is wrong.

mongo --password foo

and

mongo foo

are supposed to be equivalent.

The correct syntax is

mongo --password=foo

Boost prior to 1.59 had a bug where -password foo was allowed to mean -password=foo. This has been fixed. Now, we need to either correct our tests or change our usage of implicit values to fix our tests or change our code to define these parameters as default values to maintain the existing behavior.

References:
SERVER-20754
http://lists.boost.org/boost-users/2015/09/85130.php
https://github.com/boostorg/program_options/commit/88dea3c6fdea8c9ea894911897b1770599c383e4



 Comments   
Comment by Githook User [ 22/Mar/16 ]

Author:

{u'username': u'markbenvenuto', u'name': u'Mark Benvenuto', u'email': u'mark.benvenuto@mongodb.com'}

Message: SERVER-22525 Translate old-style implicit options into new-style
Branch: master
https://github.com/mongodb/mongo/commit/b766d1a46bacf5ff94c585543e0e6538da559633

Comment by Githook User [ 22/Mar/16 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: SERVER-22525 Revert "Fixes to support building against system boost 1.59"

This reverts commit 53ce96ad0f9d410ef86dc3ad3a4bd45e0ea5eef1.
Branch: master
https://github.com/mongodb/mongo/commit/866a3747dcd895ef932c79fe250f5967f3366034

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