-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dan Langille wrote:
> On 21 Aug 2007 at 12:47, Ryan Novosielski wrote:
> 
>> Dan Langille wrote:
>>> On 20 Aug 2007 at 0:40, Ryan Novosielski wrote:
>>>
>>>> Dan Langille wrote:
>>>>> On 18 Aug 2007 at 11:00, Ryan Novosielski wrote:
>>>>>
>>>>>> Dan Langille wrote:
>>>>>>> On 18 Aug 2007 at 2:00, Per olof Ljungmark wrote:
>>>>>>>
>>>>>>>> Since upgrading to 2.2.0 bsmtp sets the wrong Date: header in the mail:
>>>>>>>> Date: Sat, 18 Aug 2007 01:48:56 +0000 (CEST)
>>>>>>>>
>>>>>>>> For the recipient the above message appears to have been receieved at 
>>>>>>>> 03:48, two hours ahead.
>>>>>>>>
>>>>>>>> The correct timezone is UTC +2, the above header should have read
>>>>>>>> Date: Sat, 18 Aug 2007 01:48:56 +0200 (CEST)
>>>>>>>>                                    ^
>>>>>>>> Again, this might be FreeBSD specific just as my last report.
>>>>>>> This just in (at 23:22 local time):
>>>>>>>
>>>>>>> Date: Fri, 17 Aug 2007 23:19:12 +0000 (EDT)
>>>>>>>
>>>>>>> Compare that to an email generated via: echo 'test' | mail dan
>>>>>>>
>>>>>>> Fri, 17 Aug 2007 23:21:39 -0400 (EDT)
>>>>>>>
>>>>>>> It's getting the timezone wrong.  In my case, it should be -0400.  I 
>>>>>>> won't have time to look at this until Saturday afternoon.
>>>>>> I'd like to chime in that it is NOT just FreeBSD, but at least also
>>>>>> Solaris. I've had this problem with Solaris and Horde/IMP before as
>>>>>> well, so I never reported it on the Bacula list figuring it was really
>>>>>> not their problem. My Bacula director is Solaris 9. I don't know how 10
>>>>>> would change this.
>>>>> Good.  Good to know.  Thank you.
>>>>>
>>>>> Perhaps it was this commit:
>>>>>
>>>>> http://bacula.svn.sourceforge.net/viewvc/bacula/trunk/bacula/src/tools
>>>>> /bsmtp.c?view=diff&r1=4789&r2=479
>>>>>
>>>>> If you look at older versions of bsmtp, and I think that's where the 
>>>>> problem is, you see this (look around line 353):
>>>>>
>>>>> http://bacula.svn.sourceforge.net/viewvc/bacula/trunk/bacula/src/tools
>>>>> /bsmtp.c?view=diff&r1=2835&r2=283
>>>>>
>>>>> The code used to do:
>>>>>
>>>>>   strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S %z", &tm)
>>>>>
>>>>> Where the %z (time zone offset, e.g. -04) is the time zone.  For some 
>>>>> reason, this is now done as a different step (see the first URL) and 
>>>>> uses %Z (time zone name, eg. EST)
>>>>>
>>>>> This patch fixes the problem for me, but I suspect there were some 
>>>>> special issues attempted by the original code that my fix does not 
>>>>> address.
>>>>>
>>>>> --- src/tools/bsmtp.c~    Sat Aug 18 16:33:26 2007
>>>>> +++ src/tools/bsmtp.c     Sat Aug 18 16:33:26 2007
>>>>> @@ -194,11 +194,7 @@
>>>>>     gettimeofday(&tv, &tz);
>>>>>     my_timezone = tz.tz_minuteswest; /* timezone offset in mins */
>>>>>  #endif
>>>>> -   strftime(buf, buf_len, "%a, %d %b %Y %H:%M:%S", &tm);
>>>>> -   sprintf(tzbuf, " %+2.2ld%2.2u", -my_timezone / 60, 
>>>>> abs(my_timezone) % 60);
>>>>> -   strcat(buf, tzbuf);              /* add +0100 */
>>>>> -   strftime(tzbuf, sizeof(tzbuf), " (%Z)", &tm);
>>>>> -   strcat(buf, tzbuf);              /* add (CEST) */
>>>>> +   strftime(buf, buf_len, "%a, %d %b %Y %H:%M:%S %z %Z", &tm);
>>>>>  }
>>>> I haven't had a lot of time to look this over, but I think that the date
>>>> in my headers from bstmp will be interesting to you and others who may
>>>> be having this problem and have had more time to look at it:
>>>>
>>>> Date: Sun, 08 Jul 2007 23:57:00 +0000 (%z)
>>>>
>>>> ...that don't look right to me. :) I suspect %z and %Z may not be
>>>> handled properly on non-Linux? Is that even possible? I thought most of
>>>> this stuff kinda stuck to POSIX for this kind of thing, whatever it
>>>> might have to say about this. <shrug>
>>> Ryan: please check man strftime and compare to what I found here for 
>>> %z:  http://bama.ua.edu/cgi-bin/man-cgi?00+00
>>>
>>> In short, %Z is supported on Solaris, but not %z.
>> Changing this %z to %Z (actually, on 2.0.3 I think it was changing '%Z
>> (%z)' to just %Z) rectifies the problem on Solaris 9, which is nice,
>> because I was really sick of doing the math every time my backups finished.
> 
> I am tempted to change the code to use %Z.  It seems to be more 
> portable and exists on all the man strftime pages that I've checked.  
> Either that or add an autoconf test.  Which I don't know how to do. 
> If someone does that work, I'll be sure to add it in.
> 
> If no objections, I'll do the %Z patch tomorrow.  And, FYI, I'll 
> patch the 2.2.0 code in the Bacula port.

Can we see if we can get this to fail on, say, Linux -- or any other OS
for which it was currently working? I don't have a full source copy
present, but it seems like %Z would have the desired effect on all
platforms. Can a person with Linux source hanging around test this please?

- --
 ---- _  _ _  _ ___  _  _  _
 |Y#| |  | |\/| |  \ |\ |  | |Ryan Novosielski - Systems Programmer II
 |$&| |__| |  | |__/ | \| _| |[EMAIL PROTECTED] - 973/972.0922 (2-0922)
 \__/ Univ. of Med. and Dent.|IST/AST - NJMS Medical Science Bldg - C630
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFGyzGGmb+gadEcsb4RAh2vAKDKYQGlyvJnHDSw5Gfvfnyi+xRE5QCWNsAi
R+48b0sguYRGZ318cmbbGA==
=RjcZ
-----END PGP SIGNATURE-----
begin:vcard
fn:Ryan Novosielski
n:Novosielski;Ryan
org:UMDNJ;IST/AST
adr;dom:MSB C630;;185 South Orange Avenue;Newark;NJ;07103
email;internet:[EMAIL PROTECTED]
title:Systems Programmer III
tel;work:(973) 972-0922
tel;fax:(973) 972-7412
tel;pager:(866) 20-UMDNJ
x-mozilla-html:FALSE
version:2.1
end:vcard

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to