Chronos is one of the many Smalltalk-related blogs syndicated on Planet Smalltalk
χρόνος

Discussion of the Essence# programming language, and related issues and technologies.

Blog Timezone: America/Los_Angeles [Winter: -0800 hhmm | Summer: -0700 hhmm] 
Your local time:  

2006-04-03

Bug Report

A Chronos bug was reported to me earlier today. I'd say who made the report, except in the absence of permission to do so, it's better to err on the side of personal privacy.

The bug is in the method LocalTimeCalendarClock>>basicTodayIn:. The symptom is an MNU #subtractSeconds:. The fix is to replace "subtractSeconds: now secondsSinceStartOfDay" with "addSeconds: now secondsSinceStartOfDay negated". Note that the erroneous code never runs in an environment where the system clock reports Universal Time, and not local time. In other words, you won't see it unless you are using Chronos in either Squeak, or in a pre-7x version of VisualWorks on a non-Unix host platform.

The reason for the bug is simply that I had removed all the #subtractSeconds: methods (which, before I removed them, could only successfully have been sent to mutable Chronos objects, and were not part of the public API,) in favor of only supporting #addSeconds: with a negated argument. In other words, when the code in question was written, it was not a bug.

How I missed this (and one other) sender when I removed all the #subtractSeconds: methods from Chronos I have no idea, unless perhaps it had something to do with the fact that there are non-Chronos implementers and senders of #addSeconds: in VisualWorks.

How I missed the resulting bug is easy to explain: I use VW 7.4 as my main development platform (where the code would never execute,) and my test procedure for Squeak didn't have adequate coverage, because up to now I've been more concerned with the correctness of the infrastructural/platform-specific code in Squeak, under the (now-revealed-to-be faulty) assumption that my test coverage in VisualWorks 7.4 would be good enough for everything else.

The fix is in both the Squeak and VisualWorks download archives, available from the Chronos web site.


No comments: