[Boost-bugs] [Boost C++ Libraries] #5446: Exception thrown by tz_database::load_from_file() on linux 2.6.37, boost1.46.1, gcc4.5.2

Subject: [Boost-bugs] [Boost C++ Libraries] #5446: Exception thrown by tz_database::load_from_file() on linux 2.6.37, boost1.46.1, gcc4.5.2
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-04-09 07:38:39


#5446: Exception thrown by tz_database::load_from_file() on linux 2.6.37,
boost1.46.1,gcc4.5.2
---------------------------------+------------------------------------------
 Reporter: frankrq2009@… | Owner: az_sw_dude
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: date_time
  Version: Boost 1.46.1 | Severity: Problem
 Keywords: |
---------------------------------+------------------------------------------
 Hi, I tried to run the Flight Time Example in
 boost_1_46_1/doc/html/date_time/examples.html#date_time.examples.simple_time_zone,
 and an exception was thrown with error message:
 terminate called after throwing an instance of
 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_lexical_cast>
>'
   what(): bad lexical cast: source type value could not be interpreted as
 target
 When I debug with step into, I found it happened on line "Africa/Cairo" of
 the date_time_zonespec.csv, because this is the first timezone which needs
 to call dst_adjustment_offsets(), and there was a '\r' at the end of the
 line, then when str_from_delimited_time_duration() called
 boost::lexical_cast<unsigned short>(*beg) the '\r' made the exception
 being raised.
 On linux, std::getline(ifs, buff) in load_from_file() will leave the '\r'
 in buff, which caused the exception. On win32 this would not happen. So
 the line ends '\r' needs to be removed in load_from_file() or at the
 beginning of parse_string().

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5446>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:06 UTC