aboutsummaryrefslogtreecommitdiffstats
path: root/lang/erlang14
diff options
context:
space:
mode:
authorolgeni <olgeni@FreeBSD.org>2008-11-18 05:30:16 +0800
committerolgeni <olgeni@FreeBSD.org>2008-11-18 05:30:16 +0800
commit20843e8badb1e2ff564e9a34e8bd4f561f584254 (patch)
treed3b4593bd314362023953a9e70deeebaf374826a /lang/erlang14
parent5e42f8bd699ff0be745c312c8bc54ae5099a62c4 (diff)
downloadfreebsd-ports-gnome-20843e8badb1e2ff564e9a34e8bd4f561f584254.tar.gz
freebsd-ports-gnome-20843e8badb1e2ff564e9a34e8bd4f561f584254.tar.zst
freebsd-ports-gnome-20843e8badb1e2ff564e9a34e8bd4f561f584254.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>
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 ->