Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-22525

Fix implicit options usage in test cases

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.4
    • Affects Version/s: 3.3.1
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • Platforms 10 (02/19/16), Platforms 12 (04/01/16)

      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

            Assignee:
            mark.benvenuto@mongodb.com Mark Benvenuto
            Reporter:
            mark.benvenuto@mongodb.com Mark Benvenuto
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: