summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-06-25 09:02:07 +0200
committerJulian Andres Klode <jak@debian.org>2016-11-14 15:10:03 +0100
commitc6dcd6d5c03abdcaa075bb4734b78a6bb9de9b94 (patch)
treef18cdca951f18d646e0efacb88cbe04e01eec49c /apt-pkg
parent5d467e2092a9e4083f86b5f9bbea49fb4e7e3850 (diff)
imbue datetime parsing with C.UTF-8 locale
Rewritten in 9febc2b238e1e322dce1f94ecbed46d595893b52 for c++ locales usage and rewritten again in 1d742e01470bba27715a8191c50adde4b39c2f19 to avoid a currently present stdlibc++6 bug in the std::get_time implementation. The later implementation uses still stringstreams for parsing, but forgot to explicitly reset the locale to something sane (for parsing english dates that is), so date and especially the parsing of a number is depending on the locale. Turns out, the French (among others) format their numbers with space as thousand separator so for some reason the stdlibc++6 thinks its a good idea to interpret the entire datetime string as a single number instead of realizing that in "25 Jun …" the later parts can't reasonably be part of that number even through there are spaces there… Workaround is hence: LC_NUMERIC=C.UTF-8 Closes: 828011 (cherry picked from commit 3bdff17c894d0c3d0f813d358fc45d7a263f3552)
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/strutl.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index 23c2f78e5..ca924e578 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -934,6 +934,8 @@ bool RFC1123StrToTime(const char* const str,time_t &time)
signed int year = 0; // yes, Y23K problem – we gonna worry then…
std::string weekday, month, datespec, timespec, zone;
std::istringstream ss(str);
+ auto const &posix = std::locale("C.UTF-8");
+ ss.imbue(posix);
ss >> weekday;
// we only superficially check weekday, mostly to avoid accepting localized
// weekdays here and take only its length to decide which datetime format we