[MacPorts] #29394: in boost 1.46.1 program_options lib is unusable in macports

MacPorts noreply at macports.org
Sun May 8 07:36:57 PDT 2011


#29394: in boost 1.46.1  program_options lib is unusable in macports
--------------------------------------------------+-------------------------
 Reporter:  christophe.prudhomme@…                |       Owner:  adfernandes@…           
     Type:  defect                                |      Status:  new                     
 Priority:  Normal                                |   Milestone:                          
Component:  ports                                 |     Version:  1.9.2                   
 Keywords:  boost1.46 program_options             |        Port:  boost                   
--------------------------------------------------+-------------------------
Changes (by ryandesign@…):

  * owner:  macports-tickets@… => adfernandes@…


Old description:

> the following simple program using boost.program_options crashes with
> the boost macports
>

> #include <iostream>
>
> #include <boost/program_options.hpp>
> namespace po = boost::program_options;
> int main(int ac, char** av)
> {
>         using namespace std;
> //locale::global(locale(""));
> // Declare the supported options.
> po::options_description desc("Allowed options");
> desc.add_options()
>     ("help", "produce help message")
>     ("compression", po::value<int>(), "set compression level")
> ;
>
> po::variables_map vm;
> po::store(po::parse_command_line(ac, av, desc), vm);
> po::notify(vm);
>
> if (vm.count("help")) {
>         cout << desc << "\n";
>     return 1;
> }
>
> if (vm.count("compression")) {
>     cout << "Compression level was set to "
>  << vm["compression"].as<int>() << ".\n";
> } else {
>     cout << "Compression level was not set.\n";
> }
> }
>

> the problem lies in printing the options_description structure
>

> (gdb) r --help
> Starting program: /private/tmp/t --help
> Allowed options:
> t(40384) malloc: *** error for object 0x7fff70a22500: pointer being freed
> was not allocated
> *** set a breakpoint in malloc_error_break to debug
>
> Program received signal SIGABRT, Aborted.
> 0x00007fff88cab5d6 in __kill ()
> (gdb) bt
> #0  0x00007fff88cab5d6 in __kill ()
> #1  0x00007fff88d4bcd6 in abort ()
> #2  0x00007fff88c636b5 in free ()
> #3  0x00000001001299d0 in std::basic_stringbuf<char,
> std::char_traits<char>, std::allocator<char> >::overflow ()
> #4  0x000000010012e13c in std::basic_streambuf<char,
> std::char_traits<char> >::xsputn ()
> #5  0x00007fff84fcdae4 in std::__ostream_write<char,
> std::char_traits<char> > ()
> #6  0x00007fff84fcbb98 in std::__ostream_insert<char,
> std::char_traits<char> > ()
> #7  0x0000000100063b3d in
> boost::program_options::options_description::print ()
> #8  0x00000001000640b7 in boost::program_options::operator<< ()
> #9  0x00000001000016cf in main ()

New description:

 the following simple program using boost.program_options crashes with
 the boost macports

 {{{
 #include <iostream>

 #include <boost/program_options.hpp>
 namespace po = boost::program_options;
 int main(int ac, char** av)
 {
         using namespace std;
 //locale::global(locale(""));
 // Declare the supported options.
 po::options_description desc("Allowed options");
 desc.add_options()
     ("help", "produce help message")
     ("compression", po::value<int>(), "set compression level")
 ;

 po::variables_map vm;
 po::store(po::parse_command_line(ac, av, desc), vm);
 po::notify(vm);

 if (vm.count("help")) {
         cout << desc << "\n";
     return 1;
 }

 if (vm.count("compression")) {
     cout << "Compression level was set to "
  << vm["compression"].as<int>() << ".\n";
 } else {
     cout << "Compression level was not set.\n";
 }
 }
 }}}

 the problem lies in printing the options_description structure

 {{{
 (gdb) r --help
 Starting program: /private/tmp/t --help
 Allowed options:
 t(40384) malloc: *** error for object 0x7fff70a22500: pointer being freed
 was not allocated
 *** set a breakpoint in malloc_error_break to debug

 Program received signal SIGABRT, Aborted.
 0x00007fff88cab5d6 in __kill ()
 (gdb) bt
 #0  0x00007fff88cab5d6 in __kill ()
 #1  0x00007fff88d4bcd6 in abort ()
 #2  0x00007fff88c636b5 in free ()
 #3  0x00000001001299d0 in std::basic_stringbuf<char,
 std::char_traits<char>, std::allocator<char> >::overflow ()
 #4  0x000000010012e13c in std::basic_streambuf<char,
 std::char_traits<char> >::xsputn ()
 #5  0x00007fff84fcdae4 in std::__ostream_write<char,
 std::char_traits<char> > ()
 #6  0x00007fff84fcbb98 in std::__ostream_insert<char,
 std::char_traits<char> > ()
 #7  0x0000000100063b3d in
 boost::program_options::options_description::print ()
 #8  0x00000001000640b7 in boost::program_options::operator<< ()
 #9  0x00000001000016cf in main ()
 }}}

--

-- 
Ticket URL: <https://trac.macports.org/ticket/29394#comment:2>
MacPorts <http://www.macports.org/>
Ports system for Mac OS


More information about the macports-tickets mailing list