Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 744200 - Lines starting with whitespaces in XML files lead to perl warnings
Lines starting with whitespaces in XML files lead to perl warnings
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: perl-XML-SAX (Show other bugs)
5.7
Unspecified Unspecified
medium Severity unspecified
: rc
: 5.8
Assigned To: Petr Pisar
Petr Šplíchal
: EasyFix, Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-07 09:05 EDT by Marko Karg
Modified: 2016-05-31 21:42 EDT (History)
4 users (show)

See Also:
Fixed In Version: perl-XML-SAX-0.14-11
Doc Type: Bug Fix
Doc Text:
Cause Parsing a XML document starting with a white space. Consequence Warning `Unable to recognize encoding of this document' has been printed. Fix Encoding detection code has been changed to recognize XML document with leading white space as document without XML declaration and with default encoding. Result No warning is printed anymore as such documents are valid documents with encoding detection rules conforming to documents without XML declaration.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-11-13 22:07:04 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
perl script (6.53 KB, text/plain)
2011-10-07 09:06 EDT, Marko Karg
no flags Details
input file for the script (396.43 KB, text/xml)
2011-10-07 09:06 EDT, Marko Karg
no flags Details
upstream patch (609 bytes, patch)
2011-10-07 09:09 EDT, Marcela Mašláňová
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1446 normal SHIPPED_LIVE perl-XML-SAX bug fix update 2011-11-14 03:02:40 EST

  None (edit)
Description Marko Karg 2011-10-07 09:05:47 EDT
Description of problem:

XML files which have whitespaces as the first character in a line lead to warnings like this

Unable to recognise encoding of this document at /usr/lib/perl5/vendor_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96, <$in> line 793

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

perl-XML-SAX-0.14-8

How reproducible:

Always

Steps to Reproduce:
1. Run the attached perl script (conversion.pl) on the attached input file (input.xml) on a RHEL5 machine
  
Actual results:

lots of

Unable to recognise encoding of this document at /usr/lib/perl5/vendor_perl/5.8.8/XML/SAX/PurePerl/EncodingDetect.pm line 96, <$in> line 793

warnings for multiple lines


Expected results:

no warnings

Additional info:
Comment 1 Marko Karg 2011-10-07 09:06:31 EDT
Created attachment 526893 [details]
perl script
Comment 2 Marko Karg 2011-10-07 09:06:58 EDT
Created attachment 526894 [details]
input file for the script
Comment 3 Marcela Mašláňová 2011-10-07 09:09:44 EDT
Created attachment 526895 [details]
upstream patch
Comment 5 Petr Pisar 2011-10-07 09:17:05 EDT
Upstream fixed this issue in version 2.15 (available from <http://cpan.metacpan.org/authors/id/G/GR/GRANTM/>) by accepting XML document starting with white spaces and defaulting to implicit encoding. This effectively silent the warning. This is the 4-line patch attached by Marcela.

Simple test case:

$ perl -MXML::Simple -e 'XML::Simple::XMLin(q{ <f/>})'
Comment 7 Petr Pisar 2011-10-10 06:58:43 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
    Parsing a XML document starting with a white space.
Consequence
    Warning `Unable to recognize encoding of this document'
    has been printed.
Fix
    Encoding detection code has been changed to recognize
    XML document with leading white space as document
    without XML declaration and with default encoding.
Result
    No warning is printed anymore as such documents are
    valid documents with encoding detection rules conforming
    to documents without XML declaration.
Comment 10 errata-xmlrpc 2011-11-13 22:07:04 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1446.html

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