Bug 740417

Summary: print_unused returns files included using relative paths as unused
Product: [Community] Publican Reporter: Stephen Gordon <sgordon>
Component: publicanAssignee: Jeff Fearn <jfearn>
Status: CLOSED CURRENTRELEASE QA Contact: Ruediger Landmann <rlandman>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.7CC: mhideo, misty, rlandman
Target Milestone: 3.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 3.0.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-30 23:10:52 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Stephen Gordon 2011-09-21 20:50:42 EDT
Description of problem:

Publican print_unused returns files as unused despite them being included into the book's XML via a relative path, for example:

<xi:include href="./topics/Concepts/RHEV/VDSM.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>

The directory topics/Concepts/RHEV/ is under the en-US folder. Building and/or packaging the book works fine and the included content is also included in the output of these operations. The publican print_unused command however returns the file as unused.

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

2.7
Comment 1 Jeff Fearn 2011-10-10 20:07:59 EDT
Made file check ignore leading './'

Applied change to branches/publican-2x and trunk.

Committed revision 1913.
Comment 2 Martin Prpic 2012-04-26 12:46:02 EDT
"publican print_unused" still returns unused files when they are included via a relative path. See example:

en-US]$ rpm -q publican
publican-3.0-0.fc16.t166.noarch
en-US]$ ls testchapter.xml 
testchapter.xml
en-US]$ grep testchapter book.xml 
        <xi:include href="testchapter.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
[mprpic@fedora en-US]$ cd ..
[mprpic@fedora book]$ publican print_unused

No unused XML files

[mprpic@fedora book]$ cd en-US/
...
[mprpic@fedora en-US]$ grep testchapter book.xml 
        <xi:include href="./testchapter.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
[mprpic@fedora en-US]$ cd ..
[mprpic@fedora book]$ publican print_unused

List of unused XML files in en-US
   testchapter.xml
Comment 4 Jeff Fearn 2012-05-16 22:44:46 EDT
Ah the bug was about files in the main directory including files in sub directories generated false positives; the feedback was that files in nested directories including files in deeper directories also triggers false positives.

Fixed print_unused & print_tree to correctly handled deeply nested includes.

To ssh://git.fedorahosted.org/git/publican.git
   40d48c4..5000dcf  master -> master
Comment 5 Michael Hideo 2012-06-07 21:37:42 EDT
create a book that xi includes files from a subdirectory. run print_unused. verify if files do not come up as unused.
Comment 6 Stephen Gordon 2012-06-08 11:50:09 EDT
Testing on publican-3.0-0.fc17.t179.noarch it appears this is still an issue.

$ publican print_unused

List of unused XML files in en-US
   topics/References/RHEL/6/RHEVH/Support_Limits_List.xml
   topics/References/RHEV/2.3/Active_Directory.xml
   topics/References/RHEV/2.3/Admin_Client_Requirements.xml
   topics/References/RHEV/2.3/Configuration_Tool.xml
   topics/References/RHEV/2.3/Directory_Firewall_Requirements.xml
   topics/References/RHEV/2.3/Host_Firewall_Requirements.xml
   topics/References/RHEV/2.3/ISO_Uploader.xml
   topics/References/RHEV/2.3/Log_Collector.xml
   topics/References/RHEV/2.3/Log_Files.xml
   topics/References/RHEV/2.3/Manage_Domains.xml
   topics/References/RHEV/2.3/Manager_Firewall_Requirements.xml
   topics/References/RHEV/2.3/Manager_Requirements.xml
   topics/References/RHEV/2.3/RHEV_and_RHEL_Compatibility.xml
   topics/References/RHEV/2.3/Required_Channels.xml
   topics/References/RHEV/2.3/Supported_Guests.xml
   topics/References/RHEV/2.3/UIDs_needed_by_RHEV.xml
   topics/Tasks/IPA/Adding_New_Users.xml
   topics/Tasks/RHEV/Adding_FCP_Storage.xml
   topics/Tasks/RHEV/Adding_Local_Storage.xml
   topics/Tasks/RHEV/Adding_NFS_Storage.xml
   topics/Tasks/RHEV/Adding_iSCSI_Storage.xml
   topics/Tasks/RHEV/Preparing_Red_Hat_Enterprise_Linux_Hosts.xml
   topics/Tasks/RHEV/Red_Hat_Network_Subscription.xml
   topics/Tasks/RHEV/Removing_Red_Hat_Enterprise_Virtualization_Manager.xml

$ grep 'topics/References/RHEL/6/RHEVH/Support_Limits_List.xml' en-US/*.xml
en-US/Requirements.xml:		<xi:include href="./topics/References/RHEL/6/RHEVH/Support_Limits_List.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
Comment 8 Jeff Fearn 2012-06-22 20:44:21 EDT
This is a corner case where people have the optional leading './'. Because the xml_file list doesn't have it the pattern match comparing used files to existing files wasn't matching. Added extra check for the './' version.

To ssh://git.fedorahosted.org/git/publican.git
   8830412..8c64c85  master -> master
Comment 9 Misty Stanley-Jones 2012-06-29 01:30:04 EDT
I checked out Steve's test book and ran the command:

[mstanley@timtam Installation_Guide]$ publican print_unused

No unused XML files

Marking this as verified.
Comment 10 Misty Stanley-Jones 2012-06-29 01:33:02 EDT
I checked out Steve's test book and ran the command:

[mstanley@timtam Installation_Guide]$ publican print_unused

No unused XML files

Marking this as verified.