Bug 642088

Summary: Apostrophe in Abstract generates invalid RPM
Product: [Community] Publican Reporter: Alison Young <alyoung>
Component: publicanAssignee: Jeff Fearn <jfearn>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 1.6CC: jfearn, mmcallis, publican-list, r.landmann, rlerch, ttrinks
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: publican-2.3-0.fc13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-27 18:48:03 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Alison Young 2010-10-11 19:18:08 EDT
Description of problem: publican will build an rpm successfully however upon attempting to install the package is invalid. Believe the issue is caused by apostrophes being used in the abstract. 

Version-Release number of selected component (if applicable):


How reproducible: very.


Steps to Reproduce:
1. go to any Book_Info.xml in a book
2. within the <abstract> tags write anything that uses an apostrophe. Eg "I've been told this is bad"
3. build rpm in Publican.
4. install rpm and note errors.
  
Actual results:
Updating: Product-BookName-1    8/1
7Can't find string terminator '"' anywhere before EOF at -e line 1, <DATA> line 
1662. 
 error: %post(Product-BookName-1-web-en-US-1-12.el5.noarch) scriptlet failed, exit status 9

Expected results: Publican to detect apostrophe use.


Additional info:
Comment 1 Jeff Fearn 2010-10-11 19:38:47 EDT
Changes spec file to enable special string handling in bash, escaped ' in abstract text for use in %post.

Fixed in build: 2.2-0%{?dist}.t16
Comment 2 Timo Trinks 2010-10-14 01:04:58 EDT
(In reply to comment #1)
> Changes spec file to enable special string handling in bash, escaped ' in
> abstract text for use in %post.
> 
> Fixed in build: 2.2-0%{?dist}.t16

Tested with latest publican build from trunk. Building now escapes ' in
abstract text in the %post section:

%post -n Red_Hat_Enterprise_Linux-Installation_Guide-6-web-it-IT
[...]
relativi all\'installazione.} }); } $ws->regen_all_toc();'
[...]

Therefore, installation of RPM and subsequent run of %post scripts doesn't
choke any more:

[root@fedsec noarch]# yum --nogpg localinstall Red_Hat_Enterprise_Linux-Installation_Guide-6-web-it-IT-1.0-1.fc13.noarch.rpm
[...]
Running Transaction Installing     : Red_Hat_Enterprise_Linux-Installation_Guide-6-web-it-I   1/1
Installed: Red_Hat_Enterprise_Linux-Installation_Guide-6-web-it-IT.noarch 0:1.0-1.fc13
Complete!
Comment 3 Ryan Lerch 2010-10-18 18:34:13 EDT
Just ran into this issue again this morning on 

publican-2.2-0.fc13.t31.noarch


With an apostrophe in the <subtitle> in the book_info.xml, i am getting the following error when trying to install the RPM:

"""
/var/tmp/rpm-tmp.VEEuQE: line 1: `/usr/bin/perl -e $'use Publican::WebSite; my @formats = qw(html pdf html-single epub); my $ws = Publican::WebSite->new(); foreach my $format (@formats) { $ws->update_or_add_entry( { language => "en-US", product => "Documentation", version => "0.1", name => "RPMTest", format => "$format", product_label => "", version_label => "", name_label => "", subtitle => q{short desc'ription}, abstract => q{A short over\'view and summary of the book\'s subject and purpose, traditionally no more than one paragraph long. Note: the abstract will appear in the front matter of your book and will also be placed in the description field of the book\'s RPM spec file.} }); } $ws->regen_all_toc();''
warning: %post(Documentation-RPMTest-0.1-web-en-US-0-0.el5.noarch) scriptlet failed, exit status 2
"""
Comment 4 Jeff Fearn 2010-10-18 19:53:39 EDT
escaped subtitle for use in post script.

Fixed in build: 2.2-0%{?dist}.t35
Comment 5 Timo Trinks 2010-10-18 22:46:52 EDT
(In reply to comment #4)
> escaped subtitle for use in post script.
> 
> Fixed in build: 2.2-0%{?dist}.t35

'found another one... tested with publican-2.2-0.fc13.t35.noarch.

Installation Guide in fr-FR uses Guide d'installation as Name, resulting in
an apostrophe in the name_label field in the %post section of the spec-file:

name_label => "Guide_d'installation"

This again causes a scriplet failed error:

  Installing     : Red_Hat_Enterprise_Linux-Installation_Guide-6-web-fr-F   1/1 
Non-fatal POSTIN scriptlet failure in rpm package Red_Hat_Enterprise_Linux-Installation_Guide-6-web-fr-FR-1.0-1.fc13.noarch
/var/tmp/rpm-tmp.Av4LeS: line 1: unexpected EOF while looking for matching `"'
/var/tmp/rpm-tmp.Av4LeS: line 4: syntax error: unexpected end of file
warning: %post(Red_Hat_Enterprise_Linux-Installation_Guide-6-web-fr-FR-1.0-1.fc13.noarch) scriptlet failed, exit status 2

-> seems \' in name_label is needed as well...
Comment 6 Jeff Fearn 2010-10-19 02:38:36 EDT
Ensured all 3 web labels have apostrophes escaped for packaging.

Fixed in build: 2.2-0%{?dist}.t40
Comment 7 Ryan Lerch 2010-10-19 19:01:41 EDT
Thanks Jeff

Fix verified in 2.2-0%{?dist}.t40

The following test cases were performed:

= Test Case 1 =
1. publican create --name "Test_Case_642088"

2. cd Test_Case_642088/

3. Add ' to the contents of both the <subtitle> and <abstract> tags in en-US/Book_Info.xml

4. publican package --binary --lang en-US

5. rpm -Uvh tmp/rpm/noarch/Documentation-Test_Case_642088-0.1-web-en-US-0-0.el5.noarch.rpm

Results:
PASSED, no errors were returned when the RPM was installed.

---------------------------------------------------------------


= Test Case 2 =
1. publican create --name "Test_Case_642088"

2. cd Test_Case_642088/

3. publican update_pot

4. publican update_po --langs=fr-FR

5. update the translated strings for the title, subtitle and para entries, and add a ' to each one

6. publican package --binary --lang fr-FR

7. rpm -Uvh tmp/rpm/noarch/Documentation-Test_Case_642088-0.1-web-fr-FR-0-0.el5.noarch.rpm


Results:
PASSED, no errors were returned when the RPM was installed.
Comment 8 Fedora Update System 2010-10-25 23:44:30 EDT
publican-2.3-0.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/publican-2.3-0.fc13
Comment 9 Fedora Update System 2010-10-27 18:47:22 EDT
publican-2.3-0.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.