Bug 979247 - Bug: Allows space in book version
Bug: Allows space in book version
Status: CLOSED CURRENTRELEASE
Product: PressGang CCMS
Classification: Community
Component: CSProcessor (Show other bugs)
1.0
Unspecified Unspecified
urgent Severity urgent
: ---
: 1.2
Assigned To: Lee Newson
: Reopened
Depends On:
Blocks: 1011904
  Show dependency treegraph
 
Reported: 2013-06-28 00:43 EDT by Misha H. Ali
Modified: 2013-10-17 19:49 EDT (History)
3 users (show)

See Also:
Fixed In Version: 0.33.2
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-10-17 19:49:50 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 Misha H. Ali 2013-06-28 00:43:45 EDT
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 00:50:24 EDT
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 01:52:17 EDT
0.33.2 has been released.
Comment 3 Misha H. Ali 2013-07-02 19:31:22 EDT
Tested, works as expected.
Comment 4 Ruediger Landmann 2013-10-03 23:22:12 EDT
(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-03 23:33:06 EDT
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-03 23:44:34 EDT
Sorry folks, looks like I jumped the gun on reporting this as a bug.
Comment 7 Lee Newson 2013-10-07 23:33:35 EDT
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 00:50:20 EDT
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 00:55:48 EDT
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.