Issue #21538 has been updated by Alex Chamberlain. Status changed from Unreviewed to Needs Decision Assignee set to Clay Caviness Keywords set to plist CFPropertyList REXML
Looks like in Facter::Util::CFPropertyList, method XML.load() is not checking the return value of REXML::Document.new() to see if it's non-nil before trying to import_xml(). I'm not sure *why* REXML::Document.new() is not returning a valid object, however, in Clay's example above of a minimal text .plist file. ---------------------------------------- Bug #21538: cfpropertylist can't handle plain text plists? https://projects.puppetlabs.com/issues/21538#change-94666 * Author: Clay Caviness * Status: Needs Decision * Priority: Normal * Assignee: Clay Caviness * Category: * Target version: * Keywords: plist CFPropertyList REXML * Branch: * Affected Facter version: 1.7.1 ---------------------------------------- I was exploring replacing `Facter::Util::Plist` with `Facter::Util::CFPropertylist` in the `launchd` provider (and eventually elsewhere) when I discovered a bug in `CFPropertylist`. It handles binary plists fine, but <strong>can't</strong> handle text plists. If I have two versions of the same simple plist, one text, one binary, the binary can be read but the text fails with a NoMethodError in the XML parser. To reproduce, first create a simple text plist and a version converted to binary: <pre> $ PlistBuddy -c 'add :key string value' /tmp/text.plist File Doesn't Exist, Will Create: text.plist $ plutil -convert binary1 -o /tmp/binary.plist /tmp/text.plist </pre> Now, try to parse the files using CFPropertylist: <pre> $ ruby -r facter -r facter/util/cfpropertylist -e 'Facter::Util::CFPropertyList::List.new(:file => "/tmp/binary.plist")' $ ruby -r facter -r facter/util/cfpropertylist -e 'Facter::Util::CFPropertyList::List.new(:file => "/tmp/text.plist")' /Library/Ruby/Site/1.8/facter/util/cfpropertylist/lib/rbREXMLParser.rb:19:in `load': undefined method `root' for nil:NilClass (NoMethodError) from /Library/Ruby/Site/1.8/facter/util/cfpropertylist/lib/rbCFPropertyList.rb:329:in `load' from /Library/Ruby/Site/1.8/facter/util/cfpropertylist/lib/rbCFPropertyList.rb:244:in `initialize' from -e:1:in `new' from -e:1 </pre> This is on OS X 10.8.4 (and the default ruby 1.8.7). -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
