aboutsummaryrefslogtreecommitdiff
path: root/lang/erlang14
diff options
context:
space:
mode:
authorJimmy Olgeni <olgeni@FreeBSD.org>2008-11-17 21:30:16 +0000
committerJimmy Olgeni <olgeni@FreeBSD.org>2008-11-17 21:30:16 +0000
commit8998cb5c9a7acf7579e5acba8fd8e208d22a16c8 (patch)
tree7868b43672fccaf890490ca79480246fe0a8735b /lang/erlang14
parentbf45b7890ff4f8a960588ceb7ca698e7ff6e4d65 (diff)
downloadports-8998cb5c9a7acf7579e5acba8fd8e208d22a16c8.tar.gz
ports-8998cb5c9a7acf7579e5acba8fd8e208d22a16c8.zip
Fix an issue related to mktime(3) returning -1 when tm_isdst is true but the timestamp cannot be represented. Previously, -1 was interpreted as a valid result leading erlang:localtime_to_universaltime/2 to return {{1969, 12, 31}, {23, 59, 59}}.
A detailed explanation may be found here: http://www.erlang.org/pipermail/erlang-bugs/2008-November/001077.html Obtained from: Paul Guyot <pguyot at kallisys.net>
Notes
Notes: svn path=/head/; revision=222989
Diffstat (limited to 'lang/erlang14')
-rw-r--r--lang/erlang14/Makefile2
-rw-r--r--lang/erlang14/files/patch-erts_emulator_beam_erl__time__sup.c15
-rw-r--r--lang/erlang14/files/patch-lib_stdlib_src_calendar.erl29
3 files changed, 45 insertions, 1 deletions
diff --git a/lang/erlang14/Makefile b/lang/erlang14/Makefile
index 785979d8957a..dfe70d1a7bd7 100644
--- a/lang/erlang14/Makefile
+++ b/lang/erlang14/Makefile
@@ -7,7 +7,7 @@
PORTNAME= erlang
PORTVERSION= r12b5
-PORTREVISION= 1
+PORTREVISION= 2
PORTEPOCH= 1
CATEGORIES= lang parallel java
MASTER_SITES= http://www.erlang.org/download/ \
diff --git a/lang/erlang14/files/patch-erts_emulator_beam_erl__time__sup.c b/lang/erlang14/files/patch-erts_emulator_beam_erl__time__sup.c
new file mode 100644
index 000000000000..1e84d40d27ec
--- /dev/null
+++ b/lang/erlang14/files/patch-erts_emulator_beam_erl__time__sup.c
@@ -0,0 +1,15 @@
+
+$FreeBSD$
+
+--- erts/emulator/beam/erl_time_sup.c.orig
++++ erts/emulator/beam/erl_time_sup.c
+@@ -648,6 +648,9 @@
+ t.tm_sec = *second;
+ t.tm_isdst = isdst;
+ the_clock = mktime(&t);
++ if (the_clock == -1) {
++ return 0;
++ }
+ #ifdef HAVE_GMTIME_R
+ gmtime_r(&the_clock, (tm = &tmbuf));
+ #else
diff --git a/lang/erlang14/files/patch-lib_stdlib_src_calendar.erl b/lang/erlang14/files/patch-lib_stdlib_src_calendar.erl
new file mode 100644
index 000000000000..1ab956512316
--- /dev/null
+++ b/lang/erlang14/files/patch-lib_stdlib_src_calendar.erl
@@ -0,0 +1,29 @@
+
+$FreeBSD$
+
+--- lib/stdlib/src/calendar.erl.orig
++++ lib/stdlib/src/calendar.erl
+@@ -215,11 +215,19 @@
+
+ -spec local_time_to_universal_time_dst(t_datetime1970()) -> [t_datetime1970()].
+ local_time_to_universal_time_dst(DateTime) ->
+- UtDst = erlang:localtime_to_universaltime(DateTime, true),
+- Ut = erlang:localtime_to_universaltime(DateTime, false),
+ %% Reverse check the universal times
+- LtDst = erlang:universaltime_to_localtime(UtDst),
+- Lt = erlang:universaltime_to_localtime(Ut),
++ {UtDst, LtDst} =
++ try
++ UtDst0 = erlang:localtime_to_universaltime(DateTime, true),
++ {UtDst0, erlang:universaltime_to_localtime(UtDst0)}
++ catch error:badarg -> {error, error}
++ end,
++ {Ut, Lt} =
++ try
++ Ut0 = erlang:localtime_to_universaltime(DateTime, false),
++ {Ut0, erlang:universaltime_to_localtime(Ut0)}
++ catch error:badarg -> {error, error}
++ end,
+ %% Return the valid universal times
+ case {LtDst,Lt} of
+ {DateTime,DateTime} when UtDst =/= Ut ->