In principle I don't think it is a good idea to ignore unrecognised
arguments on the command line - that only leads to confusion when users
misspell something. Having two separate parts of the program parsing
them is the real problem Mir was coded on the misguided assumption that
boost.Options was good enough for all client code.

I think a better solution would be to decouple the creation of the
options object from the initialisation of DefaultServerConfiguration.
That way options can be passed directly to DefaultServerConfiguration
without any reference to the command line.  Clearly we'd continue to
provide a default option parser. (Maybe this could return the arguments
it doesn't interpret?)

There is a precedent for manipulating the "arguments" to get around this
- the following comes from the Mir test framework:

int main(int argc, char** argv)
{
    ::argc = std::remove_if(
        argv,
        argv+argc,
        [](char const* arg) { return !strncmp(arg, "--gtest_", 8); }) - argv;
    ::argv = const_cast<char const**>(argv);

  ::testing::InitGoogleTest(&argc, argv);

  return RUN_ALL_TESTS();
}

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1226227

Title:
  libmirserver parses arguments and fails if it's not something it
  understands

To manage notifications about this bug go to:
https://bugs.launchpad.net/mir/+bug/1226227/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to