Thread overview
[phobos] std.datetime unittest
Jan 04, 2012
Martin Nowak
Jan 04, 2012
Jonathan M Davis
Jan 04, 2012
Jonathan M Davis
Jan 04, 2012
Martin Nowak
Jun 22, 2012
Martin Nowak
Jun 22, 2012
Jonathan M Davis
January 04, 2012
I regularly get a failing phobos unittest.

core.exception.AssertError at std/datetime.d(28169): _assertPred!"==" failed: [PPT] is not == [PDT].

As I am the only one it might be related to updating to FreeBSD9.
How can I check that the timezone files are correct?
Are there tools to decode timezone files?

thanks martin
January 03, 2012
On Wednesday, January 04, 2012 04:55:17 Martin Nowak wrote:
> I regularly get a failing phobos unittest.
> 
> core.exception.AssertError at std/datetime.d(28169): _assertPred!"==" failed:
> [PPT] is not == [PDT].
> 
> As I am the only one it might be related to updating to FreeBSD9.
> How can I check that the timezone files are correct?
> Are there tools to decode timezone files?

Well, the FreeBSD box on the autotester is fine, though I don't know what version of FreeBSD it's using. Your failure is just downright bizarre though. According to http://www.timeanddate.com/worldclock/timezone.html?n=137&syear=1925 that abbreviation was used for daylight savings time in America/Los_Angeles between 1925 and 1949. The test tests it for the current time.

The question, therefore, is what time zone your box is set to. It could be that setTZEnvVar isn't working correctly on your box. However, there don't appear to be an time zones which currently use PPT for daylight savings time, so I don't know that it's likely that that's causing the problem.

I suppose that the time zone files _could_ be corrupt, but that seems unlikely, since it would fail to load if it didn't match the spec. More likely, the time zone file is just wrong, but that would be weird, since theoretically, they all come from the same source.

If you want to look at what's in the time zone file, then use zdump. If you use it with -v, it'll spit out a bunch of lines looking like this:

America/Los_Angeles  Sun Mar  8 10:00:00 2493 UTC = Sun Mar  8 03:00:00 2493 PDT isdst=1

Each of them represents a DST switch. On my computer (64-bit Linux), if I run

zdump America/Los_Angeles -v | grep PPT

then I get

America/Los_Angeles  Tue Aug 14 23:00:00 1945 UTC = Tue Aug 14 16:00:00 1945
PPT isdst=1
America/Los_Angeles  Sun Sep 30 08:59:59 1945 UTC = Sun Sep 30 01:59:59 1945
PPT isdst=1

If you're seeing more than those two lines, then something is definitely wrong with your time zone file.

You could also tar up you /usr/share/zoneinfo directory, and I can have a look at it, but zdump should be enough to tell you whether too many DST switches in America/Los_Angeles use PPT. And if you're only getting those two lines, then something else weird is going on that needs to be looked into.

- Jonathan M Davis
January 03, 2012
Actually, another possibility (besides the time zone file being wrong) would be if FreeBSD9's version of glibc had a bug in it which caused it to read the time zone file incorrectly. Assuming that you're in an English-speaking locale, if you uncomment lines 27,647 and 27,648 and those tests pass, then the time zone file is fine (or at least not wrong enough to give PPT as the current abbreviation for daylight savings time), and it's glibc which is broken. I don't know how likely it is that such a bug would creep into glibc though, since I wouldn't think that that code would need to be changed very often.

- Jonathan M Davis
January 04, 2012
On Wed, 04 Jan 2012 05:24:18 +0100, Jonathan M Davis <jmdavisProg at gmx.com> wrote:

> On Wednesday, January 04, 2012 04:55:17 Martin Nowak wrote:
>> I regularly get a failing phobos unittest.
>>
>> core.exception.AssertError at std/datetime.d(28169): _assertPred!"=="
>> failed:
>> [PPT] is not == [PDT].
>>
>> As I am the only one it might be related to updating to FreeBSD9.
>> How can I check that the timezone files are correct?
>> Are there tools to decode timezone files?
>
> Well, the FreeBSD box on the autotester is fine, though I don't know what
> version of FreeBSD it's using. Your failure is just downright bizarre
> though.
> According to
> http://www.timeanddate.com/worldclock/timezone.html?n=137&syear=1925 that
> abbreviation was used for daylight savings time in America/Los_Angeles
> between
> 1925 and 1949. The test tests it for the current time.
>
> The question, therefore, is what time zone your box is set to. It could
> be
> that setTZEnvVar isn't working correctly on your box. However, there
> don't
> appear to be an time zones which currently use PPT for daylight savings
> time,
> so I don't know that it's likely that that's causing the problem.
>
> I suppose that the time zone files _could_ be corrupt, but that seems
> unlikely,
> since it would fail to load if it didn't match the spec. More likely,
> the time
> zone file is just wrong, but that would be weird, since theoretically,
> they all
> come from the same source.
>
> If you want to look at what's in the time zone file, then use zdump. If
> you use
> it with -v, it'll spit out a bunch of lines looking like this:
>
> America/Los_Angeles  Sun Mar  8 10:00:00 2493 UTC = Sun Mar  8 03:00:00
> 2493
> PDT isdst=1
>
> Each of them represents a DST switch. On my computer (64-bit Linux), if I run
>
> zdump America/Los_Angeles -v | grep PPT
>
> then I get
>
> America/Los_Angeles  Tue Aug 14 23:00:00 1945 UTC = Tue Aug 14 16:00:00
> 1945
> PPT isdst=1
> America/Los_Angeles  Sun Sep 30 08:59:59 1945 UTC = Sun Sep 30 01:59:59
> 1945
> PPT isdst=1
>
I get about the same, but only if I explicitly specify a year range which contains these dates.

> If you're seeing more than those two lines, then something is definitely
> wrong
> with your time zone file.
>
> You could also tar up you /usr/share/zoneinfo directory, and I can have
> a look
> at it, but zdump should be enough to tell you whether too many DST
> switches in
> America/Los_Angeles use PPT. And if you're only getting those two lines,
> then
> something else weird is going on that needs to be looked into.
>
I've diffed the distribution tab files with the ones from iana and also
get the
same binaries after zic compiling.

Ah, I can reproduce the same behavior with C so it's likely a bug in localtime.

Having a short look at the implementation is somewhat revealing :). http://www.freebsd.org/cgi/cvsweb.cgi/src/contrib/tzcode/stdtime/localtime.c?rev=1.3.2.2.2.1;content-type=text%2Fplain

> - Jonathan M Davis
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
June 22, 2012
On Wed, 04 Jan 2012 04:55:17 +0100, Martin Nowak <dawg@dawgfoto.de> wrote:

> I regularly get a failing phobos unittest.
>
> core.exception.AssertError@std/datetime.d(28169): _assertPred!"==" failed: [PPT] is not == [PDT].
>

I finally took the time to locate the bug.
http://www.freebsd.org/cgi/query-pr.cgi?pr=168862

Any ideas what to do about this?
_______________________________________________
phobos mailing list
phobos@puremagic.com
http://lists.puremagic.com/mailman/listinfo/phobos

June 22, 2012
On Friday, June 22, 2012 15:27:27 Martin Nowak wrote:
> On Wed, 04 Jan 2012 04:55:17 +0100, Martin Nowak <dawg@dawgfoto.de> wrote:
> > I regularly get a failing phobos unittest.
> > 
> > core.exception.AssertError@std/datetime.d(28169): _assertPred!"=="
> > failed: [PPT] is not == [PDT].
> 
> I finally took the time to locate the bug. http://www.freebsd.org/cgi/query-pr.cgi?pr=168862
> 
> Any ideas what to do about this?

I think that you've already done everything that needs to be done. It's a bug in FreeBSD, not Phobos. You've reported the bug, and it's up to them to sort it out. If anyone complains about it, we can point them to the FreeBSD bug report (though hopefully they'll fix it sooner rather than later). The only real problem would be if the autotester were updated to a version of FreeBSD which had the bug, since the tests must pass on those machines. So, hopefully Brad doesn't do that.

- Jonathan M Davis
_______________________________________________
phobos mailing list
phobos@puremagic.com
http://lists.puremagic.com/mailman/listinfo/phobos