[Dovecot] Dovecot and time (again)

Ben Morrow ben at morrow.me.uk
Wed Jun 5 18:10:18 EEST 2013


At  9AM -0500 on  5/06/13 you (Rick Romero) wrote:
> I'm rehashing/reliving my issues from 2010:
> http://www.dovecot.org/list/dovecot/2010-October/053528.html
> 
> In short, when calling deliver from vdelivermail (or procmail), and
> delivering via NFS to Maildir, the timestamp on the file is GMT.  If
> procmail or vdelivermail completely handle the email, the timestamp is CST.
> The server is set to CST.

Um, the timestamp on a file doesn't have a timezone. It's a Unix time in
seconds since the epoch; any conversion to or from a human time with a
timestamp happens in the program reading or writing the timestamp. The
server being 'set to' CST doesn't actually mean anything very solid: it
just serves as a default timezone for processes that don't have TZ set.

> What's changed from the original issue? 
> Previously was running dovecot 1.x on FreeBSD, now 2.1.7 on Debian 7.   I
> know it's a few versions behind, but this is a deliver only server, and
> ChangeLog doesn't show too many fixes for lda.
> Of course, running the command from the command line works perfectly... So
> where could my problem reside?
> Two examples:
> 
> 1st via Calling from procmail:
> :0
> * ? test -f /usr/lib/dovecot/dovecot-lda
> {
> :0w
> |/usr/lib/dovecot/deliver -d $EXT@$HOST
> }
> 
> -rw-------    1 vpopmail  vchkpw  87196 Jun  5 13:43
> 1370439849.M812P29560.smtp101,S=87196,W=88094

Well, that's certainly peculiar; the datestamp there resolves as 13.43
UTC or 8.44 CDT. Are you able to list the file's timestamp as a Unix
time, to compare with the timestamp in the filename? On my system I can
use 'ls -lD %s' but I don't know how portable that is. You might be able
to use stat(1).

How many machines are involved here? (Including the machine you ran that
'ls' from.) Are you running NTP, and do they all have their clocks
correct? AFAICT Dovecot only attempts to set the mtime for IMAP APPEND
and dsync; the LDA just opens the file and lets the OS set the
timestamp.

Are you able to temporarily change the procmail recipe to touch(1) a
file inside the maildir rather than making a proper delivery, just to
get some idea of where the problem might be?

> 2nd via Commandline:
> #sudo -u vpopmail cat /tmp/testmail.txt | /usr/lib/dovecot/deliver -d
> rick at havokmon.com
> 
> -rw-------    1 vpopmail  vchkpw  27740 Jun  5 08:46
> 1370440001.M421646P29846.smtp101,S=27740,W=28243

I assume you ran that ls on the same machine and with the same
environment as the one above?

> I've thrown the TZ variable in the mix as well with no resolution
> |/usr/bin/env -i TZ=CST /usr/lib/dovecot/deliver -d $EXT@$HOST
> |/usr/bin/env -i TZ=America/Chicago /usr/lib/dovecot/deliver -d $EXT@$HOST

Given that LDA doesn't do any date parsing, it just handles dates as
Unix timestamps, I'd have been very surprised if that made any
difference.

Ben



More information about the dovecot mailing list