summaryrefslogtreecommitdiff
path: root/mail/heirloom-mailx
diff options
context:
space:
mode:
authorAndrea Biardi <a.biardi@tiscali.it>2022-01-26 18:29:51 -0800
committerCy Schubert <cy@FreeBSD.org>2022-01-26 18:36:59 -0800
commitc4f80928aed6891068ad6cf9be8c4aaff2a62e24 (patch)
treef5bbdf98a226f5621c3b28311b5e9a1c61192920 /mail/heirloom-mailx
parentgraphics/openexr: security update to 3.1.4 (diff)
mail/heirloom-mailx: Fix wrong UTC offset for Europe/Dublin
Somewhere around 2018, the tzdata maintainers (IANA) corrected a historical mistake with the Europe/Dublin timezone. The mistake was rooted in a misunderstanding of whether IST meant "Irish Summer Time" or "Irish Standard Time". The problem was discussed at great length (http://mm.icann.org/pipermail/tz/2018-January/thread.html) and it was concluded that IST really meant Irish *Standard* Time (in constrast with, say, British *Summer* Time), and that this standard time is defined as UTC+0100. This corresponds to the article at https://en.wikipedia.org/wiki/Time_in_the_Republic_of_Ireland and the notes at https://en.wikipedia.org/wiki/Winter_time_(clock_lag); the source archive of tzdata has a long section dedicated to this problem and a large set of official references and links to www.irishstatutebook.ie. Once the question was settled, the only possible solution for keeping the Irish local time in sync with the rest of the world (timezones aside, the local time in Ireland - as understood by common people - is the same as in London and Belfast) was for IANA to _reverse_ the functioning of the DST flag for Ireland. The result is that in the current IANA timezone database (2021e), Europe/Dublin has DST applied in *winter*, with an adjustment of -1h (that is, negative). Digging deeper, one uncovers that there are a few other countries that have (or once had) the same time-switch mechanism as Ireland; amongst others, https://github.com/MenoData/Time4J/issues/742 also concedes that negative DST is a reality. In heirloom mailx, the logic that works out the UTC offset does the right thing up to a point (November 2021, Ireland = UTC+0100), but then upon inspecting tm->tm_isdst it sees that DST is in effect (remember, flag has been reversed, so DST in Ireland is on in winter time) it adds one hour (it should subtract one, because the adjustment is negative, but mailx doesn't know). PR: 260137 Submitted by: Andrea Biardi <a.biardi@tiscali.it> Reported by: Andrea Biardi <a.biardi@tiscali.it> MFH: 2022Q1
Diffstat (limited to 'mail/heirloom-mailx')
-rw-r--r--mail/heirloom-mailx/Makefile2
-rw-r--r--mail/heirloom-mailx/files/patch-head.c14
-rw-r--r--mail/heirloom-mailx/files/patch-imap.c30
-rw-r--r--mail/heirloom-mailx/files/patch-sendout.c31
4 files changed, 74 insertions, 3 deletions
diff --git a/mail/heirloom-mailx/Makefile b/mail/heirloom-mailx/Makefile
index 0bbf3ff46ac4..98d9e9eed479 100644
--- a/mail/heirloom-mailx/Makefile
+++ b/mail/heirloom-mailx/Makefile
@@ -1,6 +1,6 @@
PORTNAME= mailx
PORTVERSION= 12.4
-PORTREVISION= 9
+PORTREVISION= 10
CATEGORIES= mail
MASTER_SITES= SF/heirloom/heirloom-${PORTNAME}/${PORTVERSION}
PKGNAMEPREFIX= heirloom-
diff --git a/mail/heirloom-mailx/files/patch-head.c b/mail/heirloom-mailx/files/patch-head.c
new file mode 100644
index 000000000000..546889ebe1bd
--- /dev/null
+++ b/mail/heirloom-mailx/files/patch-head.c
@@ -0,0 +1,14 @@
+--- head.c.orig 2006-03-03 16:01:19.000000000 -0800
++++ head.c 2022-01-26 18:13:57.270492000 -0800
+@@ -1116,10 +1116,8 @@
+ if ((t = combinetime(year, month, day, hour, minute, second)) ==
+ (time_t)-1)
+ goto invalid;
+- tzdiff = t - mktime(gmtime(&t));
+ tmptr = localtime(&t);
+- if (tmptr->tm_isdst > 0)
+- tzdiff += 3600;
++ tzdiff = tmptr->tm_gmtoff; /* seconds east of GMT */
+ t -= tzdiff;
+ return t;
+ invalid:
diff --git a/mail/heirloom-mailx/files/patch-imap.c b/mail/heirloom-mailx/files/patch-imap.c
new file mode 100644
index 000000000000..b90d47a85384
--- /dev/null
+++ b/mail/heirloom-mailx/files/patch-imap.c
@@ -0,0 +1,30 @@
+--- imap.c.orig 2008-01-06 14:46:50.000000000 -0800
++++ imap.c 2022-01-26 18:13:57.271602000 -0800
+@@ -3506,10 +3506,8 @@
+ return -1;
+ if ((t = combinetime(year, month, day, 0, 0, 0)) == (time_t)-1)
+ return -1;
+- tzdiff = t - mktime(gmtime(&t));
+ tmptr = localtime(&t);
+- if (tmptr->tm_isdst > 0)
+- tzdiff += 3600;
++ tzdiff = tmptr->tm_gmtoff; /* seconds east of GMT */
+ t -= tzdiff;
+ return t;
+ }
+@@ -3521,13 +3519,11 @@
+ struct tm *tmptr;
+ int tzdiff, tzdiff_hour, tzdiff_min;
+
+- tzdiff = t - mktime(gmtime(&t));
++ tmptr = localtime(&t);
++ tzdiff = tmptr->tm_gmtoff; /* seconds east of GMT */
+ tzdiff_hour = (int)(tzdiff / 60);
+ tzdiff_min = tzdiff_hour % 60;
+ tzdiff_hour /= 60;
+- tmptr = localtime(&t);
+- if (tmptr->tm_isdst > 0)
+- tzdiff_hour++;
+ snprintf(s, sizeof s, "\"%02d-%s-%04d %02d:%02d:%02d %+03d%02d\"",
+ tmptr->tm_mday,
+ month_names[tmptr->tm_mon],
diff --git a/mail/heirloom-mailx/files/patch-sendout.c b/mail/heirloom-mailx/files/patch-sendout.c
index d95e185c4e3a..77aa7195e2b6 100644
--- a/mail/heirloom-mailx/files/patch-sendout.c
+++ b/mail/heirloom-mailx/files/patch-sendout.c
@@ -1,5 +1,5 @@
---- sendout.c.orig 2022-01-26 14:24:22.000017000 -0800
-+++ sendout.c 2022-01-26 14:25:03.262517000 -0800
+--- sendout.c.orig 2008-07-03 23:09:57.000000000 -0700
++++ sendout.c 2022-01-26 18:25:05.091791000 -0800
@@ -885,6 +885,7 @@
cp = expand(cp);
else
@@ -8,3 +8,30 @@
execv(cp, args);
perror(cp);
}
+@@ -1123,9 +1124,7 @@
+
+ /*
+ * Create a Date: header field.
+- * We compare the localtime() and gmtime() results to get the timezone,
+- * because numeric timezones are easier to read and because $TZ is
+- * not set on most GNU systems.
++ * We use tm->tm_gmtoff to account for negative DST adjustments (e.g. Ireland).
+ */
+ int
+ mkdate(FILE *fo, const char *field)
+@@ -1135,13 +1134,11 @@
+ int tzdiff, tzdiff_hour, tzdiff_min;
+
+ time(&t);
+- tzdiff = t - mktime(gmtime(&t));
++ tmptr = localtime(&t);
++ tzdiff = tmptr->tm_gmtoff; /* seconds east of GMT */
+ tzdiff_hour = (int)(tzdiff / 60);
+ tzdiff_min = tzdiff_hour % 60;
+ tzdiff_hour /= 60;
+- tmptr = localtime(&t);
+- if (tmptr->tm_isdst > 0)
+- tzdiff_hour++;
+ return fprintf(fo, "%s: %s, %02d %s %04d %02d:%02d:%02d %+05d\n",
+ field,
+ weekday_names[tmptr->tm_wday],