[smokeping-users] "Date" header in SmokeAlert mails may not be RFC compliant

Thorsten Schöning tschoening at am-soft.de
Fri May 27 09:12:02 CEST 2016


we moved SmokeAlert recently to a new server and since then I
recognized that the received mails are not properly sorted by my mail
client. The reason is the following header, which is not RFC

> Date: Fr, 27 Mai 2016 00:42:02 +0200

"Mai" is the name of the month for the German locale, which we use on
that server. My mail client interprets that as something around 26 Jan 2016
23:42:02, so both date and time are wrong.

The problem is in Smokeping.pm around line 1931:

> my $rfc2822stamp =  POSIX::strftime("%a, %e %b %Y %H:%M:%S %z", @stamp);

At least using %a and %b is wrong here, since both are locale
dependent[1], while RFC2822 is not[2]:

> date-time       =       [ day-of-week "," ] date FWS time [CFWS]
> day-name        =       "Mon" / "Tue" / "Wed" / "Thu" /
>                         "Fri" / "Sat" / "Sun"
> date            =       day month year
> month-name      =       "Jan" / "Feb" / "Mar" / "Apr" /
>                         "May" / "Jun" / "Jul" / "Aug" /
>                         "Sep" / "Oct" / "Nov" / "Dec"

As you can see, "Fr" instead of "Fri" and "Mai" instead of "May" are
both wrong. The same timestamp is given in the body, but this time
only as a stringified localtime and in this case it seems to be locale

> my $stamp = localtime($time);
> Fri May 27 00:42:02 2016

Sadly, this timestamp is not RFC compliant as well. So in my opinion
you should either create a truly locale independent date header using
some other function or changing LC_* or such or remove it at all and
let the mail system provide that. I do understand that you want to
have both in sync, but in my opinion having the timestamp in the body
is enough for most people and it simply avoids the problems I have


[1]: http://man7.org/linux/man-pages/man3/strftime.3.html
[2]: https://www.ietf.org/rfc/rfc2822.txt

Mit freundlichen Grüßen,

Thorsten Schöning

Thorsten Schöning       E-Mail: Thorsten.Schoening at AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

More information about the smokeping-users mailing list