Issue #22060 has been updated by Adrien Thebo. Status changed from In Topic Branch Pending Review to Merged - Pending Release Target version set to 2.0.0
Merged into master in cc269f9; this should be released in 2.0.0. ---------------------------------------- Bug #22060: undefined local variable or method `path' in macaddress.rb https://projects.puppetlabs.com/issues/22060#change-96352 * Author: Mark Zeren * Status: Merged - Pending Release * Priority: Normal * Assignee: * Category: * Target version: 2.0.0 * Keywords: * Branch: https://github.com/puppetlabs/facter/pull/509 * Affected Facter version: ---------------------------------------- When I run `puppet agent --no-daemonize --debug` and in the code somewhere set the global $DEBUG = true, then Ctrl-C to kill puppet I hit the following exception: > Exception `NilClass' at .../facter/lib/facter/macaddress.rb:19 - undefined > local variable or method `path' for :Facter::Util::Resolution after that I see an "infinite" recursion which leads to a stack overflow/segv. The behavior is not seen if I don't set $DEBUG. The fix looks trivial: <pre> diff --git a/lib/facter/macaddress.rb b/lib/facter/macaddress.rb index 3bcc927..993f2d5 100644 --- a/lib/facter/macaddress.rb +++ b/lib/facter/macaddress.rb @@ -15,7 +15,7 @@ Facter.add(:macaddress) do has_weight 10 # about an order of magnitude faster setcode do begin - Dir.glob('/sys/class/net/*').reject {|x| x[-3..-1] == '/lo' }.first + path = Dir.glob('/sys/class/net/*').reject {|x| x[-3..-1] == '/lo' }.first path and File.read(path + '/address') rescue Exception nil </pre> This code was introduced here: commit 4b926d0df3bb02a0492908fd13479e0a148ae19e Author: Daniel Pittman <[email protected]> Date: Thu Jul 19 19:11:46 2012 Faster MAC address load on Linux via sysfs -- 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.
