Bug 979247 - Bug: Allows space in book version
Summary: Bug: Allows space in book version
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: PressGang CCMS
Classification: Community
Component: CSProcessor
Version: 1.0
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ---
: 1.2
Assignee: Lee Newson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1011904
TreeView+ depends on / blocked
 
Reported: 2013-06-28 04:43 UTC by Misha H. Ali
Modified: 2013-10-17 23:49 UTC (History)
3 users (show)

Fixed In Version: 0.33.2
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-10-17 23:49:50 UTC
Embargoed:


Attachments (Terms of Use)

Description Misha H. Ali 2013-06-28 04:43:45 UTC
Description of problem:

The version field in the CSP map allows a value with a space, which is not allowed by publican.

For example, this is a valid value:

Version = 6.2-Beta

This should not be allowed:

Version = 6.2 Beta

I accidentally added a space instead of the intended hyphen and it was not caught out till I eventually ran publican package.

Comment 1 Lee Newson 2013-06-28 04:50:24 UTC
Fixed in 0.33.2

The regex used for validation has been updated to remove the ability to have spaces.

Comment 2 Lee Newson 2013-07-01 05:52:17 UTC
0.33.2 has been released.

Comment 3 Misha H. Ali 2013-07-02 23:31:22 UTC
Tested, works as expected.

Comment 4 Ruediger Landmann 2013-10-04 03:22:12 UTC
(In reply to Misha H. Ali from comment #0)
> Description of problem:
> 
> The version field in the CSP map allows a value with a space, which is not
> allowed by publican.

That's not /quite/ true; it's not allowed by Publican if a valid "version:" parameter is not set in the Publican.cfg file. 

Publican looks first to the "version:" parameter in the publican.cfg file for a value with which it can generate a valid RPM name. If it doesn't find the parameter set there, it looks at the <productnumber> in the Book_Info.xml file. If it doesn't find a valid value there either, it errors out.

So PressGang should allow spaces in the "version:" parameter, since I assume that anything in PressGang's publican.cfg parameter gets used, and this can contain a valid version; ie, the topic map could specify:

version = 6.6 Beta
publican.cfg = [xml_lang: "en-US"
type: Book
version: 6-Beta
git_branch: docs-rhel-6]

PressGang might even implement logic so that if the (PressGang) version parameter is not valid for RPM naming, then the (publican.cfg) version parameter must, or the topic map fails validation.

Comment 5 Lee Newson 2013-10-04 03:33:06 UTC
I definitely agree with Rudi that this isn't the case and the "Version" metadata should allow spaces (sorry I should have looked into this more originally). As such I'll be reverting this change for 1.2.

Adding a little bit more detail to the way the publican.cfg "version" is currently configurable. This can be configured as Rudi mentioned above via the "publican.cfg" metadata. If it's not used by that then it will attempt to get the value from the "Book Version" and lastly fallback to the "Version" metadata.

So I believe what needs to be done here is to re-enable spaces in the Version field and then alter the mechanism that sets the publican.cfg "version" value to escape the "Book Version" or "Version" metadata fields accordingly (this is the way we currently do it for "product" and "docname".

Comment 6 Misha H. Ali 2013-10-04 03:44:34 UTC
Sorry folks, looks like I jumped the gun on reporting this as a bug.

Comment 7 Lee Newson 2013-10-08 03:33:35 UTC
I've updated this so that the Version can now have spaces and will be escaped accordingly if it fallen back to when setting the "version" in publican.cfg.

Comment 9 Matthew Casperson 2013-10-15 04:50:20 UTC
Confirmed that the content spec Version field can take a space, and that the publican.cfg file (or files if more than one publican.cfg file is specified) will get a version field with the space replaced with a dash.

Comment 10 Matthew Casperson 2013-10-15 04:55:48 UTC
Confirmed that any version information specified in the publican.cfg file won't be overwritten by the Version metadata in the spec.

Also confirmed that if one publican.cfg file does have a version, and a second does not, the one that does not will have a fixed version added and the one that does will not be touched.


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