[pkg-boost-devel] Bug#345714: libboost-program-options-dev: Fails
	to parse valid options with a common root
    Roger Leigh 
    rleigh at debian.org
       
    Mon Jan  2 23:21:14 UTC 2006
    
    
  
Package: libboost-program-options-dev
Version: 1.33.0-6
Severity: normal
Given the following testcase:
#include <iostream>
#include <boost/program_options.hpp>
namespace opt = boost::program_options;
int main(int   argc,
	 char *argv[])
{
  try
    {
      bool all, all_chroots, all_sessions;
      opt::options_description chroot("Chroot selection");
      chroot.add_options()
	("all,a", "Select all chroots and active sessions")
	("all-chroots", "Select all chroots")
	("all-sessions", "Select all active sessions");
      opt::variables_map vm;
      opt::store(opt::parse_command_line(argc, argv, chroot), vm);
      opt::notify(vm);
      if (vm.count("all"))
	all = true;
      if (vm.count("all-chroots"))
	all_chroots = true;
      if (vm.count("all-sessions"))
	all_sessions = true;
      return 0;
    }
  catch (std::exception const& e)
    {
      std::cerr << e.what() << std::endl;
      return 1;
    }
}
$ g++ -o opt opt.cc -lboost_program_options
$ ./opt --help
unknown option help
$ ./opt --all-chroots
$ ./opt --all-sessions
$ ./opt --all
ambiguous option all
--all is not abiguous, since it's an exact match.  It's not abigous for
GNU getopt or GLib GOption, so this is IMHO a bug.
Regards,
Roger
-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14.5
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Versions of packages libboost-program-options-dev depends on:
ii  libboost-dev                  1.33.0-6   Boost C++ Libraries development fi
ii  libboost-program-options1.33. 1.33.0-6   program options library for C++
libboost-program-options-dev recommends no packages.
-- no debconf information
    
    
More information about the pkg-boost-devel
mailing list