Issue #21538 has been updated by Brian Warsing.

There is simple fix for this issue here...

https://github.com/dayglojesus/facter/commit/99af24ed36f94aa54e09c83a1c3938825f488a8b#commitcomment-3742260

The doc variable need to be declared outside the block.

----------------------------------------
Bug #21538: cfpropertylist can't handle plain text plists?
https://projects.puppetlabs.com/issues/21538#change-95702

* Author: Clay Caviness
* Status: Needs Decision
* Priority: Normal
* Assignee: eric sorenson
* 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.


Reply via email to