Package: libboost-date-time-dev
Version: 1.34.1-7
Severity: important

The function boost::date_time::ymd_formatter::ymd_to_string() uses the
ostream<<() function to write the date. This later function will use the
current global locale to format each of the elements of the date. In
particular, when the global locale is set to en_US, the year will be
formatted to be 2,008 which is incorrect.

The proposed solution is to temporarily imbue the ostream with the
classic locale to disable formatting. The attached patch only applies
this to the year but it would be more robust to apply to the day and
month components as well. 

This type of error probably exists in other functions.

This error was reported upstream as ticket #1674.
[http://svn.boost.org/trac/boost/ticket/1674].

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-qi.pe1650 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libboost-date-time-dev depends on:
ii  libboost-date-time1.34.1      1.34.1-7   set of date-time libraries based o
ii  libboost-dev                  1.34.1-7   Boost C++ Libraries development fi

libboost-date-time-dev recommends no packages.

-- no debconf information
--- boost-1.34.1.orig/boost/date_time/date_formatting.hpp
+++ boost-1.34.1/boost/date_time/date_formatting.hpp
@@ -79,7 +79,13 @@
     {
       typedef typename ymd_type::month_type month_type;
       std::basic_ostringstream<charT> ss;
+
+      // Temporarily switch to classic locale to prevent possible formatting
+      // of year with comma or other character (for example 2,008).
+      ss.imbue(std::locale::classic());
       ss << ymd.year;
+      ss.imbue(std::locale::locale());
+
       if (format_type::has_date_sep_chars()) {
         ss << format_type::month_sep_char();
       }

Reply via email to