Bug 474766

Summary: TclXML reports an error when an xml-stylesheet PI is encountered
Product: [Fedora] Fedora Reporter: James Armstrong <james_armstrong>
Component: tclxmlAssignee: Wart <wart>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 10CC: wart
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-12-24 18:40:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description James Armstrong 2008-12-05 09:13:03 UTC
Description of problem:

Tcl's XML parser reports an error when an xml-stylesheet Processing Instruction is encountered in the parsed XML.

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

RPM Package name tclxml Version = 3.1

How reproducible:

everytime

Steps to Reproduce:
1. Create Script:
#!/usr/bin/tclsh
package require xml

proc OnXmlElementStart {args} {}
proc OnXmlElementEnd {args} {}
proc OnXmlCharacterData {args} {}

set MyXml {<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="http://feedproxy.google.com/~d/styles/rss2full.xsl"?>
<rss>
</rss>
}

set parser [::xml::parser -elementstartcommand OnXmlElementStart -elementendcommand  OnXmlElementEnd -characterdatacommand OnXmlCharacterData] 
if [catch {$parser parse $MyXml} perr] {
	puts "Parse failed: $perr\n"
}

$parser free

2. Run That.
  
Actual results:

Parse failed: illegalcharacters {characters "xml" not permitted in processing instruction target "xml-stylesheet"}

Expected results:

No error messages.

Additional info:

I was able to fix this on my system by rolling back a somewhat recent change
to sgmlparser.tcl:

diff original_sgmlparser.tcl fixed_sgmlparser.tcl 
609c609
< 			} elseif {[regexp {[xX][mM][lL]} $tag]} {
---
> 			} elseif {[regexp {^[xX][mM][lL]$} $tag]} {

I've submitted a comment to an up-stream bug report here:

http://sourceforge.net/tracker/index.php?func=detail&aid=1649537&group_id=13178&atid=113178

Comment 1 James Armstrong 2008-12-05 09:17:58 UTC
Note an unfortunate "line wrap" on the statement that begins:

set parser [::xml::parser .... ]

Comment 2 Wart 2008-12-15 23:45:59 UTC
tclxml was released a few days ago, however it doesn't appear that this patch made it into the new release.  I'm working on updating the fedora package to 3.2 and will include this patch with the updated package.

Comment 3 Fedora Update System 2008-12-18 00:06:58 UTC
tclxml-3.1-14.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/tclxml-3.1-14.fc10

Comment 4 Wart 2008-12-18 00:25:58 UTC
tclxml-3.2 has quite a few issues that need to be fixed before it can be updated in Fedora.  In the meantime, I've fixed this specific problem for tclxml 3.1.

Comment 5 Fedora Update System 2008-12-21 08:23:17 UTC
tclxml-3.1-14.fc10 has been pushed to the Fedora 10 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update tclxml'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2008-11595

Comment 6 Fedora Update System 2008-12-24 18:40:00 UTC
tclxml-3.1-14.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.