qmail does not handle timezones properly?
Dear All I have a query regarding the way qmail (?incorrectly?) handles time zones. I have done various tests on this, the relevant portion of header of one test email below. Essentially I sent a mail out from a client on my internal network to qmail on my gateway machine, which forwarded to external web based email service which has an autoforward to send mail to my network e-mail address. I sent the mail from the client at 19:22 GMT +0200 (western Europe summer time) it arrived back to me about a minute later and displays on my client MUA as being received at **23:23** hours, i.e. four hours in the future! Of course you know the next thing I am going to say... before I installed qmail I have never seen or had this problem. The client PC clock said 17:22 (+0200) correct time, the Linux box said 17:22 and is setup correctly with TZ = GMT +0200. What's even funnier is when I send another email out from the same client (at 18:00 hours +0200) to two different external mail accounts I have one which is auto forwarded to my Linux box and qmail [smtpd] and one which is picked up from an ISP POP mailbox (not through qmail). Both emails arrive in the same timeframe, the one picked up from the ISP POP mailbox shows a sent time of 18:00 the other delivered via qmail shows a sent time of 22:00! The MUA stamps the message with the correct Date: field value. So I have the same email in my inbox with times four hours apart! and the qmail processed one four hours in the future. I have already read previous (heated) discussions on this topic on the list archive but could not discern a clear answer apart from some people saying qmail works as designed - why? It seems to be the only mail server that does so. Why does qmail use - when the PC it is running on is setup as GMT +0200? It clearly is causing a problem. Is there any configuration option which can be called to have qmail respect the time zone of the computer it is running on? Where and how would this be called for both qmail [POST] and SMTP daemons? Thanks in advance Patrick Starrenburg === Received: (qmail 1269 invoked from network); 11 May 2001 21:23:00 - Received: from unknown (HELO rmx452-mta.mail.com) (165.251.48.46) by xxx.homeip.net with SMTP; 11 May 2001 21:23:00 - Received: from smv635-ec.mail.com (smv635-ec.mail.com [165.251.32.19]) by rmx452-mta.mail.com (8.9.3/8.9.3) with ESMTP id NAA02057 for [EMAIL PROTECTED]; Fri, 11 May 2001 13:22:46 -0400 (EDT) Received: from spf1.us4.outblaze.com (205-158-62-23.outblaze.com [205.158.62.23] (may be forged)) by smv635-ec.mail.com (8.9.3/8.9.1SMV070400) with ESMTP id NAA04867 for [EMAIL PROTECTED] sent by [EMAIL PROTECTED]; Fri, 11 May 2001 13:22:46 -0400 (EDT) Received: from xxx.homeip.net by spf1.us4.outblaze.com (8.11.0/8.11.0) with SMTP id f4BHMiv03491 for [EMAIL PROTECTED]; Fri, 11 May 2001 17:22:44 GMT Received: (qmail 1266 invoked from network); 11 May 2001 21:22:45 - Received: from unknown (HELO starr02) (192.168.1.10) by xxx.homeip.net with SMTP; 11 May 2001 21:22:45 - Reply-To: [EMAIL PROTECTED] From: xxx [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Test sent 19:22 GMT +0200 Date: Fri, 11 May 2001 19:22:30 +0200 _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Re: qmail does not handle timezones properly?
On Sun, May 13, 2001 at 08:19:27AM +0200, Patrick Starrenburg wrote: [snip] I have already read previous (heated) discussions on this topic on the list archive but could not discern a clear answer apart from some people saying qmail works as designed - why? It seems to be the only mail server that does so. Why does qmail use - when the PC it is running on is setup as GMT +0200? It clearly is causing a problem. Is there any configuration option which can be called to have qmail respect the time zone of the computer it is running on? Where and how would this be called for both qmail [POST] and SMTP daemons? qmail uses - because it is the receiving MUA's task to display the date in the format the user desires. If your MUA is unable to do so, complain to the MUA author. qmail uses - because only if all headers use the same timezone, reliable debugging is possible. qmail uses - because timezone support adds a lot of code bloat that makes no sense in an MTA. Your sending client should add a date header. Greetz, Peter.
Re: qmail does not handle timezones properly?
Patrick Starrenburg [EMAIL PROTECTED] writes: people saying qmail works as designed - why? Because it makes debugging easier. It seems to be the only mail server that does so. So what? Is that a problem? Received: (qmail 1266 invoked from network); 11 May 2001 21:22:45 - Received: from unknown (HELO starr02) (192.168.1.10) by xxx.homeip.net with SMTP; 11 May 2001 21:22:45 - Date: Fri, 11 May 2001 19:22:30 +0200 I have never seen this behaviour. I suspect there is something wrong with your Linux setup: problem. The client PC clock said 17:22 (+0200) correct time, the Linux box said 17:22 and is setup correctly with TZ = GMT +0200. If it says 17:22, it is *not* configured to GMT +0200. Try to set Timezone CET. It should say 19:22 then. This two hour offset corresponds to the four hour offset of qmail. Regards, Frank
Re: qmail does not handle timezones properly?
On Sun, 13 May 2001, Patrick Starrenburg wrote: I sent the mail from the client at 19:22 GMT +0200 (western Europe summer time) it arrived back to me about a minute later and displays on my client MUA as being received at **23:23** hours, i.e. four hours in the future! [...] The client PC clock said 17:22 (+0200) correct time, the Linux box said 17:22 and is setup correctly with TZ = GMT +0200. I assume the 17:22 was a typo, and you really meant to type 19:22. I think your problem is due to a fundamental misunderstanding of signed GMT offset notation for TZ. A positive offset is actually treated as a location _behind_ UTC (ie. _west_ of the Greenwich meridian). I can't recall the reasoning behind this seemingly counter-intuitive notation, but the timezone-related tools I've examined all use this convention. This, of course, neatly accounts for the 4-hour discrepancy you're seeing. If you want to continue using GMT offset notation on your system, you should therefore set TZ to GST-2 (or something similar -- it's been a while since I played with timezone info). It may actually work better if you use a locale-name setting for TZ; the tzselect program (if you have it) will work it out for you. For instance, if you're living in Austria, the proper value is Europe/Vienna. -- Adrian Ho [EMAIL PROTECTED]
Re: qmail does not handle timezones properly?
Peter van Dijk [EMAIL PROTECTED] wrote: qmail uses - because it is the receiving MUA's task to display the date in the format the user desires. If your MUA is unable to do so, complain to the MUA author. It does, pls check my original mail. You will see that the MUA fully and correctly inserts the Date: field including TZ offset. qmail uses - because only if all headers use the same timezone, reliable debugging is possible. ?? This logic seems a red herring to me. Anyway my testing does not bear this out, pls see my extra info email. qmail uses - because timezone support adds a lot of code bloat that makes no sense in an MTA. Your sending client should add a date header. It does, pls check my original mail. Code bloat?? Doesn't seem like an excuse to me to (**possibly** we haven't determined this yet) have a fundamental error in a system because someone doesn't feel like adding code to internationalise something. Cheers Patrick _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Re: qmail does not handle timezones properly?
Patrick Starrenburg [EMAIL PROTECTED] writes: people saying qmail works as designed - why? Because it makes debugging easier. ? I was meaning works as designed putting (possibly) incorrect timestamps on emails. Are you meaning debugging times or debugging qmail? If the former then that is why there is a worldwide standard of local time being GMT + TZ. If Linux can store file timestamps in GMT and display them on the fly in local time (GMT + TZ offset) then surely qmail can do the same also. It seems to be the only mail server that does so. So what? Is that a problem? If it is wrong then yes! It's not a question of qmail versus the world but qmail correct or incorrect. If incorrect then DJB et. al. ought to fix it. _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
qmail does not handle timezones properly? - More Info
Dear All OK, sigh... I was hoping to avoid the religious OS wars and I intend to stick to the facts, I hope everyone else can also. I need to give you some further details on the setup. Also I have done a further test and I still see a problem with qmail. I have a network (for purposes of this test we only need to worry about two machines) Linux box running Redhat 7.1 and W2K box (with a hamster named bill inside furiously running a spinning wheel to power the OS. Occasionaly I chuck in a used Emacs manual for him to chew on). Anyway... jokes aside - as far as I, and all the documentation I read, can see both machines are correctly configured for local time as GMT + TZ offset. I am in western Europe which is GMT +1 hour, at the moment (as it is summer and for once the sun is shining in Holland) with daylight saving it is GMT +02:00. So... *Linux box* [root@linuxbox patrick]# date Sun May 13 17:02:55 GMT+2 2001 - Check *W2K box* C:\date The current date is: Sun 13/05/2001 - European date format naturally C:\time The current time is: 17:03:13.83 System TZ settings GMT+01:00 (with Daylight Saving +1hour) = GMT+02:00 - Check Onto the test email... I created the mail on the W2K box, forget about the MUA used that is irrelevant. Just note that it correctly inserts the Date: field with GMT +0200 TZ offset. To simplify things I bounced the email off my ISP's SMTP server back to my e-mail account on the Linux box. Now here is the problem - firstly see that the ISP's server also uses +0200 local time TZ offset with same time as box my MUA is on *but* when it is picked up by qmail's SMTP daemon that timestamps it as 18:56:24 -. IF it was going to use - (GMT) THEN it should have changed time to 14:56:24 - which is 16:56:24 *minus* the extra two hours TZ offset for my location. Instead it has *added* two hours, then called it GMT, then when my MUA picks it up and looks at the **Received:** field in GMT format it *correctly* converts it to my local time of GMT +0200 and displays it to me as being received as 20:56 hours. Which, by the way, hasn't arrived yet! Thats how the 4 hours time difference comes about. Strange... if there is something wrong with my logic or setup of my Linux box then please tell me (nicely, no flaming of OS's) but it seems pretty straightforward to me. I remember something in the previous thread on this topic in the list archive about a qmail program called datemail is this meant to fix this problem and how does use it in conjunction with the qmail, smtpd pop3d daemons. My setup was done using qmail-conf. Regards Patrick = *Test email* Return-Path: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Received: (qmail 6078 invoked from network); 13 May 2001 **18:56:24** - [[[ Where does 18: come from ??]]] Received: from unknown (HELO amsmta03-svc.chello.nl) (213.46.240.7) by xxx.homeip.net with SMTP; 13 May 2001 **18:56:24** - Received: from w2kbox by amsmta03-svc.chello.nl (InterMail vK.4.03.02.00 201-232-124) with SMTP id 20010513145513.IXEE12765.amsmta03-svc@w2kbox for [EMAIL PROTECTED]; Sun, 13 May 2001 16:55:13 +0200 Reply-To: [EMAIL PROTECTED] From: Patrick Starrenburg [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Test 16:55 Date: Sun, 13 May 2001 16:55:43 +0200 _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Re: qmail does not handle timezones properly?
On Sun, 13 May 2001, Patrick Starrenburg wrote: Peter van Dijk [EMAIL PROTECTED] wrote: qmail uses - because it is the receiving MUA's task to display the date in the format the user desires. If your MUA is unable to do so, complain to the MUA author. It does, pls check my original mail. You will see that the MUA fully and correctly inserts the Date: field including TZ offset. Yes, and thanks to qmail's insistence on using -, it's clear that your TZ setting is wrong (see my reply to your original mail). qmail uses - because only if all headers use the same timezone, reliable debugging is possible. ?? This logic seems a red herring to me. - lets you worry about just one thing (does machine X have the correct UTC?) rather than several things (does machine X have the correct local time? did X's admin set TZ correctly at initial installation? is X's current idea of TZ correct for this time of year? did X's MTA take all the above into account _and_ print the timestamp correctly?) - lets you quickly see MTA hop intervals without having to mentally add/subtract GMT offsets (easy to get wrong when you're in a hurry or suffering from sleep deprivation). In short, it's mind-boggling why most MTAs _don't_ use -. -- Adrian Ho [EMAIL PROTECTED]
Re: qmail does not handle timezones properly? - More Info
On Sun, May 13, 2001 at 06:28:53PM +0200, Patrick Starrenburg wrote: [snip] *Linux box* [root@linuxbox patrick]# date Sun May 13 17:02:55 GMT+2 2001 - Check Yes. *W2K box* C:\date The current date is: Sun 13/05/2001 - European date format naturally C:\time The current time is: 17:03:13.83 System TZ settings GMT+01:00 (with Daylight Saving +1hour) = GMT+02:00 - Check Yes. Onto the test email... I created the mail on the W2K box, forget about the MUA used that is irrelevant. Just note that it correctly inserts the Date: field with GMT +0200 TZ offset. To simplify things I bounced the email off my ISP's SMTP server back to my e-mail account on the Linux box. Now here is the problem - firstly see that the ISP's server also uses +0200 local time TZ offset with same time as box my MUA is on *but* when it is picked up by qmail's SMTP daemon that timestamps it as 18:56:24 -. IF it was going to use - (GMT) THEN it should have changed time to 14:56:24 - which is 16:56:24 *minus* the extra two hours TZ offset for my location. Instead it has *added* two hours, then called it GMT, then when my MUA picks it up and looks at the **Received:** field in GMT format it *correctly* converts it to my local time of GMT +0200 and displays it to me as being received as 20:56 hours. Which, by the way, hasn't arrived yet! Thats how the 4 hours time difference comes about. qmail never changes the Date: header for mails. It only adds one for locally-injected mails. If your sending MUA inserted a Date header, that is the header the receiving MUA sees. If this is not true, either one of the other mailsystems in the chain is misconfigured, or you are doing something weird on your qmail machine. Greetz, Peter.
Re: qmail does not handle timezones properly?
On Sun, May 13, 2001 at 05:47:46PM +0200, Patrick Starrenburg wrote: Code bloat?? Doesn't seem like an excuse to me to (**possibly** we haven't determined this yet) have a fundamental error in a system because someone doesn't feel like adding code to internationalise something. Why do you suggest that there may be a fundamental error in a system? Seems like a pretty unlikely conclusion just because the date is in a format that you don't expect. As it happens this topic has been done to death many times - you may want to check the archives. It is not a bug nor is it a fundamental error in a system. Rather, it is a known and conscious decision by the author and is allowed by the standard. The only way to change this behaviour is for you to patch your version of qmail - I vaguely recall someone announced a patch here, but the archives have a better memory than me. Regards.
Re: qmail does not handle timezones properly? - More Info
Your problem is almost certainly not qmail related. First off you may want to learn how Unix/Linux keeps time. Believe it or not, Unix/Linux don't know anything about timezones. They all keep time internally in UTC (nee GMT). Yes, every Unix server on the planet current has the same time. To see what it is, run this command from the shell: perl -e 'print time,\n' You should get a number back that reflects the number of seconds since 00:00UTC, Jan 1, 1970. When you run something like the date command, it takes this internal number, looks up your current timezone setting and *converts* the internal number to an external representation that matches your timezone. So, what you've shown us with your date command is simply that the combination of the internal time of your server + the timezone setting gives you the correct display. Now, qmail does not do *any* conversion when it generates it's timestamp, it takes the raw internal time value and prints it without looking at any timezone info. So, to answer your question: Received: (qmail 6078 invoked from network); 13 May 2001 **18:56:24** - [[[ Where does 18: come from ??]]] The 18 comes from the internal time value maintained by your kernel. Your kernel believes that it is currently 18:56:24 UTC. If that is not the current UTC time then the internal value in your kernel is set wrong. You can find out what your kernel thinks is UTC by going: TZ=GMT date from your shell. I'll bet that the output from that command matches the date/time in the qmail header. Regards.
Re: qmail does not handle timezones properly? - More Info
Patrick Starrenburg [EMAIL PROTECTED] writes: (as it is summer and for once the sun is shining in Holland) with daylight saving it is GMT +02:00. So... I repeat: there must something wrong with your Linux setup. Qmail uses system calls of the underlying operating system to generate the timestamps. If they are wrong it gets wrong data from the system (see now.c in the sources). Did you try to set CET? Maybe your timezone definitions are corrupted? Besides that you created a new thread, effectively destroying the possibility to follow the discussion in an efficient way. Plus you gave no new information, you only repeated your first mail. So don't expect new answers. Regards, Frank
Re: qmail does not handle timezones properly?
Patrick, Seens to me that qmail is doing the right thing. Below is the headers from a message sent by you to qmail list and all date fields inserted by qmail are using the correct time: From [EMAIL PROTECTED] Sun May 13 14:40:22 2001 Return-Path: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Received: (qmail 13318 invoked from network); 13 May 2001 15:49:43 - Received: from useful.dataloss.nl ([EMAIL PROTECTED]) by a.mx.sst.com.br with QMTP; 13 May 2001 15:49:43 - Received: (qmail 63964 invoked by uid 1001); 13 May 2001 15:50:20 - List-Help: mailto:[EMAIL PROTECTED] List-Unsubscribe: mailto:[EMAIL PROTECTED] List-Subscribe: mailto:[EMAIL PROTECTED] Delivered-To: mailing list [EMAIL PROTECTED] Received: (qmail 63959 invoked from network); 13 May 2001 15:50:19 - Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Delivered-To: mailing list [EMAIL PROTECTED] X-Originating-IP: [212.187.119.59] From: Patrick Starrenburg [EMAIL PROTECTED] To: [EMAIL PROTECTED] Bcc: Subject: Re: qmail does not handle timezones properly? Date: Sun, 13 May 2001 17:47:46 +0200 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: [EMAIL PROTECTED] X-OriginalArrivalTime: 13 May 2001 15:47:46.0770 (UTC) FILETIME=[0E613B20:01C0DBC4] -- Antonio Dias
Re: qmail does not handle timezones properly? - More Info
On Sun, May 13, 2001 at 06:28:53PM +0200, Patrick Starrenburg wrote: % *Linux box* % [root@linuxbox patrick]# date % Sun May 13 17:02:55 GMT+2 2001 - Check Your clock seems to be set wrong. According to Solaris and at least one web page I dug up, http://www.bsdi.com/date, GMT+2 is a posix time zone equivalent to GMT-0200 (!). Your linux box thinks that you are sitting somewhere in the Atlantic Ocean. Try setting your local TZ to Europe/Amsterdam, and reset your clock. Mark
Re: qmail does not handle timezones properly? - More Info
Thus spake Patrick Starrenburg ([EMAIL PROTECTED]): = *Test email* Return-Path: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Received: (qmail 6078 invoked from network); 13 May 2001 **18:56:24** - [[[ Where does 18: come from ??]]] Received: from unknown (HELO amsmta03-svc.chello.nl) (213.46.240.7) by xxx.homeip.net with SMTP; 13 May 2001 **18:56:24** - Received: from w2kbox by amsmta03-svc.chello.nl (InterMail vK.4.03.02.00 201-232-124) with SMTP id 20010513145513.IXEE12765.amsmta03-svc@w2kbox for [EMAIL PROTECTED]; Sun, 13 May 2001 16:55:13 +0200 Reply-To: [EMAIL PROTECTED] From: Patrick Starrenburg [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Test 16:55 Date: Sun, 13 May 2001 16:55:43 +0200 The date headers is OK. So what you are actually talking about is the Received lines. The date 18:56:24 - is equivalent to the date 16:56:24 +0200, so there is no error whatsoever here. The MTA prints the date as GMT, which actually is a feature, because it allows easy comparison of dates by humans, without having to calculate away time zones. Felix
Re: qmail does not handle timezones properly? - More Info
On Sun, May 13, 2001 at 09:10:12PM +0200, Felix von Leitner wrote: [snip] The date 18:56:24 - is equivalent to the date 16:56:24 +0200, so there is no error whatsoever here. The MTA prints the date as GMT, which actually is a feature, because it allows easy comparison of dates by humans, without having to calculate away time zones. 18:56:24 - equals 20:56:24 +0200, at least within qmail. This is not POSIX notation, hence your confusion. I say we stop this thread. The user's box is misconfigured and he's failing to see why UTC in headers is good. Let it be. Greetz, Peter.
Re: qmail does not handle timezones properly? - More Info
Thanks to Adrian Ho and Mark Jefferys explanations for the solution. Adrian you were halfway there with your first reply and Mark's link pointed me in the right direction to track down the problem. The TZ setting was GMT +2 which apparently means actually the box was calculating GMT **minus 2 hours**. That seems logical?! I had selected Amsterdam during installation of Redhat but obviously had changed it sometime thereafter during setup and testing of qmail. Obviously from the above I was not aware of the counter intuitiveness of Posix time zones!! I just wanted to point out a couple of things also to the list: 1) I *had* already read through the *complete* thread on this topic not wanting to rehash an old issue *before* I posted the question to the list but I did not determine that there was a clear explanation of the topic. I was aware of the discussion re: the Date: field. That's why I specifically mentioned that my MUA inserted it, however some persons simply erroneously jumped on that topic again. In my case it was nothing to do with the Date: field. 2) I recall that the discussion about this in the archive went on for *much* longer than this thread and still then there was no clear clean answer. This obviously is a point of potential confusion that perhaps one of the more experienced qmail members could write a FAQ about. DJB's document - http://cr.yp.to/immhf/date.html gives information but is not ideally suited to a FAQ type of document. 3) If this list is for technical questions regarding qmail then you are going to get people *starting* with qmail, and yes... maybe even starting with Linux. And that means starters questions. If we are going to follow DJB's wish to spread the use of qmail then you are going to get more of those types of questions... 4) And finally - On Sun, 13 May 2001, Peter van Dijk wrote: I say we stop this thread. The user's box is misconfigured and he's failing to see why UTC in headers is good. Let it be. Gee thanks Peter - you are the list owner are you? I believe your politeness is misconfigured. I'd like to point out that you didn't provide an answer, in fact you said... [snip] *Linux box* [root@linuxbox patrick]# date Sun May 13 17:02:55 GMT+2 2001 - Check Yes. So you didn't pick up on the incorrect TZ setting. Of course we all suspected something was (possibly) wrong with my Linux box, even I was saying that! What we were looking for was a solution or a pointer to the solution. Perhaps this list *should* be moderated. Thanks again everyone esp. Adrian Mark. PS _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.