Red Hat Bugzilla – Bug 1014434
Revision History chronological order test is buggy (and error is misleading)
Last modified: 2013-10-17 19:45:51 EDT
Description of problem:
PressGang tests Revision Histories to ensure that the entries are in descending chronological order as required by rpmlint (via Publican). However, PressGang cannot compare dates in (some) different formats and falsely reports a validity error.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create a Revision History with entries like this:
<date>Mon Nov 29 2010</date>
PressGang reports the dates as not being in chronological order
PressGang recognises this as valid
1. PressGang reports the problem as a DocBook validity issue:
ERROR: This topic has invalid Docbook XML. The revisions in the Revision History are not in descending chronological order, starting from "Mon Nov 29 2010".
This is untrue; it's potentially even more confusing when the user follows the link to the troublesome chapter and finds there is no validity error reported in the editing screen.
2. There's potential value to be added by neatening and standardising Revision History date formats; maybe PressGang could offer to do that for revision histories?
Fixed in csprocessor 1.2-SNAPSHOT, build 201310121509
The problem here is due to the parser using lenient parsing and matching the wrong date format for the "2012-07-22" date. It was parsing this as something in the year 189, which makes the error message have meaning.
As such I've reverted the lenient parsing to strict parsing. The downside to this means that the day name will be validated as well, but it doesn't make sense to allow something like "Fri May 28 2013" anyway (that date is actually a Tuesday).
As for PressGang formatting the date format that would be fairly trivial to do, but I think it'd be best to file an RFE of it's own for that.
I'm going to assume that date parsing done by Publican uses something like http://search.cpan.org/~gbarr/TimeDate-2.30/lib/Date/Parse.pm. If that is the case then there are examples of time formats that would be recognised by Publican and not by PressGang. I tested a couple of the example dates (http://search.cpan.org/~gbarr/TimeDate-2.30/lib/Date/Parse.pm#EXAMPLE_DATES) listed, and 2013:08:21T09:08:17.1823213 and 15 Aug 13 22:28:20 PST are examples of dates that PG doesn't recognise (although there would be more).
I don't think time spent matching Perl date parsing rules is well spent. PG should suggest (if not enforce) a standard date format that becomes part of the style guide.
As for the specific dates mentioned in the bugs, I can confirm that PG will not allow incorrect day names in the date. e.g.
ERROR: This topic has invalid Docbook XML. Invalid revision, the name of the day specified in "Wed Oct 9 2010" doesn't match the date.
I can also confirm that dates in the format 2013-10-22 and Wed Oct 9 2013 are correctly parsed.
Tested dates not correctly ordered, and got the expected error:
ERROR: This topic has invalid Docbook XML. The revisions in the Revision History are not in descending chronological order, starting from "Wed Oct 9 2013".
See https://bugzilla.redhat.com/show_bug.cgi?id=1019027 for the editor enhancements RFE.