Skip Menu |

This queue is for tickets about the Mac-PropertyList-XS CPAN distribution.

Report information
The Basics
Id: 99072
Status: resolved
Worked: 1.2 hours (70 min)
Priority: 0/
Queue: Mac-PropertyList-XS

People
Owner: kulp [...] cpan.org
Requestors: richie765 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Error when loading single string binary plist
Date: Mon, 22 Sep 2014 22:03:47 -0300
To: bug-Mac-PropertyList-XS [...] rt.cpan.org
From: "Richard Faasen" <richie765 [...] gmail.com>
When loading a single string binary plist file, I get the following error: not well-formed (invalid token) at line 1, column 16, byte 16 at /..../perl-5.18.2/lib/site_perl/5.18.2/darwin-thread-multi-2level/XML/Parser.pm line 187. The error also occurs with Mac::PropertyList::SAX. It works well with Mac::PropertyList and with XML property lists with all three modules. Steps to reproduce. cat << EOF > xml.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <string>Just a string</string> </plist> EOF plutil -convert binary1 xml.plist -o binary.plist # working perl -MMac::PropertyList=:all -MData::Dumper -e'print Dumper parse_plist_fh(*STDIN)->as_perl;' < xml.plist perl -MMac::PropertyList::XS=:all -MData::Dumper -e'print Dumper parse_plist_fh(*STDIN)->as_perl;' < xml.plist perl -MMac::PropertyList::SAX=:all -MData::Dumper -e'print Dumper parse_plist_fh(*STDIN)->as_perl;' < xml.plist perl -MMac::PropertyList=:all -MData::Dumper -e'print Dumper parse_plist_fh(*STDIN)->as_perl;' < binary.plist # not working perl -MMac::PropertyList::XS=:all -MData::Dumper -e'print Dumper parse_plist_fh(*STDIN)->as_perl;' < binary.plist perl -MMac::PropertyList::SAX=:all -MData::Dumper -e'print Dumper parse_plist_fh(*STDIN)->as_perl;' < binary.plist # Result not well-formed (invalid token) at line 1, column 16, byte 16 at /..../perl-5.18.2/lib/site_perl/5.18.2/darwin-thread-multi-2level/XML/Parser.pm line 187. # Expected result $VAR1 = 'Just a string';
Thank you for this bug report. In the case of Mac::PropertyList::SAX, the development of the module was done before Mac::PropertyList started supporting binary plists (Mac::PropertyList 1.31_01 - Sun May 3 06:40:14 2009). Mac::PropertyList::XS was developed after this, but was intended to replace Mac::PropertyList::SAX's functionality only. The reason Mac::PropertyList::{SAX,XS} exist is that they can hand off the parsing to an XML parser to speed up deserialisation over pure-Perl string handling. According to the plist(5) man page, "The binary property list format is opaque and does not use XML." Therefore Mac::PropertyList::{SAX,XS} are now caught in the unfortunate situation where they no longer live up to their name and claim (since they claim to be drop-in replacements for Mac::PropertyList), but will probably never themselves handle binary plists (at least not ::SAX). It should be relatively easy to make these modules hand off binary plists to Mac::PropertyList. Patches to this effect will be gratefully reviewed and likely accepted. I am leaving this bug open in case someone wishes to make a stab at a solution. -- --kulp
Mac::PropertyList::SAX version 0.86, just uploaded to PAUSE, delegates binary plist loading to Mac::PropertyList, and thus should once again serve as a drop-in replacement for Mac::PropertyList. -- --kulp