On Sun, Apr 24, 2016 at 10:47 AM, David Vines <d...@zombi.eclipse.co.uk>
wrote:

> While testing/reviewing my nearly finished updates for my
> technoteattachcli branch following the comments from Ross, I discovered
> that if I try creating tech notes with dates before 1 BC or after AD 9999
> resulting in the error message "Internal error: Fossil tried to make an
> invalid artifact for the edited technote."


> This is caused by an assumption in the code that the ISO 8601 formatted
> date has a four digit year. This assumption is also backed up by the SQLite
> documentation for the DATETIME functions which explicitly states that "For
> dates outside that range, the results of these functions are undefined."
>

Now that you mention it, we had some experimentation in place for
supporting 5-digit years at some point, but nothing was ever done with it.
i vaguely remember poking around at it roughly 3 years(?) ago, and then
figured that it wouldn't be worth the effort because support for _reading_
the 5-digit years would have to be rolled out _far_ in advance of fossil
actually writing them - far enough that all "legacy" (4-digit) versions of
fossil are out of circulation. Otherwise older clients couldn't read newer
manifests.


> I'm not sure how to proceed as I see three options for all of which I can
> make a case:
>
> 1. Leave as is.


+1.


> 2. Add error checking to both the CLI and GUI so that the error message is
> more explicit and isn't an internal error.


Only if it doesn't break anything.


> 3. Remove the assumption from the code that the output from datetime has a
> four digit year number and hence support dates outside of the supported
> range as long as the undefined result from datetime gives a string.
>

That sounds dangerous to me, but that's just intuition (which is wrong
surprisingly often when it comes to such things).


> My initial temptation was to implement option 3, but (a) relying on
> undefined behaviour feels just wrong and (b) doesn't actually add that much
> to the available range of dates (my testing on Ubuntu showed that datetime
> returns sensible results between 4713 BC and 28052 AD).
>
> I've almost certainly been over thinking this, so does anyone else have
> thoughts or opinions on what is sensible for fossil?
>

IMO, leave it. There's almost 8000 years before this becomes a true
problem, and by that time computers will be able to fix such annoyances
themselves. Once fossil has spread across the solar system/galaxy, where
Sol dates are essentially useless, Julian (or some more modern alternative)
is likely to supplant ISO8601 and the whole problem will likely become moot.

i.e., the problem is solely academic.

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
_______________________________________________
fossil-dev mailing list
fossil-dev@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/fossil-dev

Reply via email to