[Dovecot] Weird internaldate behavior with 1.0-test80 and mbox folder

Jon Roma roma at uiuc.edu
Sat Sep 3 05:49:35 EEST 2005


Timo:

Sorry for not writing faster.  The patch you supplied (below) applied
to 1.0-test80 and solves the weird date behavior.  Thank you for your
fast and efficient service!

I'm already planning out my upgrade from UW to Dovecot.  So far 1.0-test80
works fine for me, but once the patch gets applied, I'll probably grab
one of the more recent versions.

Thanks again.

Timo Sirainen <tss at iki.fi> wrote:

> On Tue, 2005-08-23 at 11:50 -0500, Jon Roma wrote:
>> Has anyone else encountered weird date behavior with mbox-style folders?
>
> Looks like timezone handling was completely broken in mboxes. I think
> most people haven't noticed it because most software nowadays don't seem
> to write timezones to the From-line.
>
> This patch should fix it?
>
> Index: src/lib-storage/index/mbox/mbox-from.c
> ===================================================================
> RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-from.c,v
> retrieving revision 1.6
> diff -u -r1.6 mbox-from.c
> --- src/lib-storage/index/mbox/mbox-from.c	19 Aug 2005 15:49:49 -0000	1.6
> +++ src/lib-storage/index/mbox/mbox-from.c	28 Aug 2005 18:52:29 -0000
> @@ -145,8 +145,8 @@
>  		   i_isdigit(msg[3]) && i_isdigit(msg[4]) && msg[5] == ' ') {
>  		/* numeric timezone, use it */
>                  seen_timezone = TRUE;
> -		timezone = (msg[1]-'0') * 1000 + (msg[2]-'0') * 100 +
> -			(msg[3]-'0') * 10 +(msg[4]-'0');
> +		timezone = (msg[1]-'0') * 10*60*60 + (msg[2]-'0') * 60*60 +
> +			(msg[3]-'0') * 10 + (msg[4]-'0');
>  		if (msg[0] == '-') timezone = -timezone;
>  		msg += 6;
>  	}
> @@ -166,8 +166,8 @@
>  	    i_isdigit(msg[2]) && i_isdigit(msg[3]) &&
>  	    i_isdigit(msg[4]) && i_isdigit(msg[5])) {
>  		seen_timezone = TRUE;
> -		timezone = (msg[2]-'0') * 1000 + (msg[3]-'0') * 100 +
> -			(msg[4]-'0') * 10 +(msg[5]-'0');
> +		timezone = (msg[2]-'0') * 10*60*60 + (msg[3]-'0') * 60*60 +
> +			(msg[4]-'0') * 10 + (msg[5]-'0');
>  		if (msg[1] == '-') timezone = -timezone;
>  	}
>
> @@ -176,7 +176,7 @@
>  		if (t == (time_t)-1)
>  			return -1;
>
> -		t -= timezone * 60;
> +		t -= timezone;
>  		*time_r = t;
>  	} else {
>  		/* assume local timezone */
>






More information about the dovecot mailing list