Bug 1014434 - Revision History chronological order test is buggy (and error is misleading)
Revision History chronological order test is buggy (and error is misleading)
Status: CLOSED CURRENTRELEASE
Product: PressGang CCMS
Classification: Community
Component: CCMS-Core (Show other bugs)
1.1
Unspecified Unspecified
urgent Severity urgent
: ---
: 1.2
Assigned To: Lee Newson
:
Depends On:
Blocks: 1012194 1019027
  Show dependency treegraph
 
Reported: 2013-10-01 22:24 EDT by Ruediger Landmann
Modified: 2013-10-17 19:45 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-10-17 19:45:51 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ruediger Landmann 2013-10-01 22:24:21 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):


How reproducible:
100%

Steps to Reproduce:
1. Create a Revision History with entries like this:

<revnumber>0-8.33</revnumber>
<date>2012-07-22</date>

<revnumber>0-6</revnumber>
<date>Mon Nov 29 2010</date>


Actual results:
PressGang reports the dates as not being in chronological order

Expected results:
PressGang recognises this as valid

Additional info:
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?
Comment 1 Lee Newson 2013-10-12 03:13:53 EDT
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.
Comment 3 Matthew Casperson 2013-10-14 20:55:32 EDT
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.
Comment 5 Matthew Casperson 2013-10-14 22:38:47 EDT
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".
Comment 6 Matthew Casperson 2013-10-14 22:42:57 EDT
See https://bugzilla.redhat.com/show_bug.cgi?id=1019027 for the editor enhancements RFE.

Note You need to log in before you can comment on or make changes to this bug.