Hello,
it seems that upstream broke DTS-less timezone handling again
(which breaks MochiWeb and RabbitMQ's management plugin).
While working on it, I've also noticed that timezone handling
is broken when OpenBSD is configured with leap seconds-aware
timezone (i.e. one from /usr/share/zoneinfo/right/), so that's
fixed as well.
Both fixes were sent upstream and hopefully will be included
in the upcoming 15B02 release, however with the ports tree lock
around the corner, I wanted to sent this as soon as possible,
so that 5.2 wouldn't ship with broken Erlang package.
Patch inlined, attached & available at:
http://labs.frickle.com/tmp/erlang-15b01p0.patch
Best regards,
Piotr Sikora < [email protected] >
Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/erlang/Makefile,v
retrieving revision 1.49
diff -u -r1.49 Makefile
--- Makefile 22 Jun 2012 13:08:09 -0000 1.49
+++ Makefile 14 Jul 2012 22:42:25 -0000
@@ -7,6 +7,7 @@
DISTNAME= otp_src_${V}
PKGNAME= erlang-15b.01
EPOCH= 0
+REVISION= 0
CATEGORIES= lang
# Erlang Public License
Index: patches/patch-erts_emulator_beam_erl_time_sup_c
===================================================================
RCS file: patches/patch-erts_emulator_beam_erl_time_sup_c
diff -N patches/patch-erts_emulator_beam_erl_time_sup_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-erts_emulator_beam_erl_time_sup_c 14 Jul 2012 22:42:25
-0000
@@ -0,0 +1,50 @@
+$OpenBSD$
+
+[PATCH] Fix use of "clever" mktime.
+
+Commit 1eef765 introduced regression (conditional _always_ evaluates
+to true) in which erlang:localtime_to_universaltime/2 stopped working
+on systems configured with timezone without DST (i.e. UTC) on *BSD
+platforms:
+
+1> erlang:localtime_to_universaltime({{2012,1,1},{0,0,0}}, true).
+** exception error: bad argument
+
+
+[PATCH] Fix support for leap seconds-aware timezones.
+
+erlang:universaltime_to_localtime is leap seconds-aware (since 2008),
+however erlang:localtime_to_universaltime is not, which gives
+surprising results on systems configured with leap seconds-aware
+timezones:
+
+1> erlang:universaltime_to_localtime({{2012,1,1},{0,0,0}}).
+{{2012,1,1},{0,0,0}}
+2> erlang:localtime_to_universaltime({{2012,1,1},{0,0,0}}).
+{{2012,1,1},{0,0,24}}
+
+and completely breaks calendar:local_time_to_universal_time_dst:
+
+3> calendar:local_time_to_universal_time_dst({{2011,1,1},{0,0,0}}).
+[]
+--- erts/emulator/beam/erl_time_sup.c.orig Sun Apr 1 18:14:36 2012
++++ erts/emulator/beam/erl_time_sup.c Fri Jul 13 05:52:50 2012
+@@ -757,7 +757,7 @@
+ refuses to give us a DST time, we simulate the Linux/Solaris
+ behaviour of giving the same data as if is_dst was not set. */
+ t.tm_isdst = 0;
+- if (erl_mktime(&the_clock, &t)) {
++ if (erl_mktime(&the_clock, &t) < 0) {
+ /* Failed anyway, something else is bad - will be a badarg */
+ return 0;
+ }
+@@ -766,6 +766,9 @@
+ return 0;
+ }
+ }
++
++ the_clock = time2posix(the_clock);
++
+ #ifdef HAVE_GMTIME_R
+ tm = gmtime_r(&the_clock, &tmbuf);
+ #else