From a91c476387887baa5920f5539a7c4acfaf8cecd9 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Thu, 21 Jan 2010 16:03:26 -0800 Subject: Fix for #3088 (catching Exception also traps SystemExit) Changing rescues from the default to Exception (to catch errors that don't descend from StandardError) had the unintended consequence of catching (and suppressing) SystemExit. This patch restores the behavior of by reraising the exception. Of the other exceptions that fall through the same crack (NoMemoryError, SignalException, LoadError, Interrupt, NotImplementedError, and ScriptError) this patch also reraises NoMemoryError, SignalException, and Interrupt in the same way and leaves the rest captured. --- lib/puppet/util/autoload.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/puppet/util/autoload.rb') diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index ec2f48c7b..142ff293f 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -86,6 +86,8 @@ class Puppet::Util::Autoload name = symbolize(name) loaded name, file return true + rescue SystemExit,NoMemoryError,SignalException,Interrupt + raise rescue Exception => detail # I have no idea what's going on here, but different versions # of ruby are raising different errors on missing files. @@ -123,6 +125,8 @@ class Puppet::Util::Autoload begin Kernel.require file loaded(name, file) + rescue SystemExit,NoMemoryError,SignalException,Interrupt + raise rescue Exception => detail if Puppet[:trace] puts detail.backtrace -- cgit From 0025e13792b6a8e010ce1fd1dc20a17e7ba8af53 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Sun, 24 Jan 2010 18:32:25 -0800 Subject: Partial reversion of patch for #3088 to fix #3104 (Exception misreported) In my patch for #3088 I made a erroneous assumption about the ruby exception hierarchy and thus missed the fact that Timeout::error descends from both SignalError and Interrupt. This is a partial reversion of the patch for #3088 to let these through so that more useful error messages can be produced. --- lib/puppet/util/autoload.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/puppet/util/autoload.rb') diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index 142ff293f..51fdaadad 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -86,7 +86,7 @@ class Puppet::Util::Autoload name = symbolize(name) loaded name, file return true - rescue SystemExit,NoMemoryError,SignalException,Interrupt + rescue SystemExit,NoMemoryError raise rescue Exception => detail # I have no idea what's going on here, but different versions @@ -125,7 +125,7 @@ class Puppet::Util::Autoload begin Kernel.require file loaded(name, file) - rescue SystemExit,NoMemoryError,SignalException,Interrupt + rescue SystemExit,NoMemoryError raise rescue Exception => detail if Puppet[:trace] -- cgit From f9e05a8062423cf0e4dd6dca2050a8c7d4b2e85d Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Fri, 22 Jan 2010 12:55:14 -0800 Subject: Fix for #3094 (libdir should take ":" delimited path) Actually, File::PATH_SEPARATOR, which is generally, but not always, ":"). Since libdir is also the default for the plugin handler, users will need to specify it explicitly if a multipart libdir is given (and it will need to be one of the segments given in the libdir for the plugins to be found). --- lib/puppet/util/autoload.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/puppet/util/autoload.rb') diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb index 51fdaadad..ceaabe46a 100644 --- a/lib/puppet/util/autoload.rb +++ b/lib/puppet/util/autoload.rb @@ -156,7 +156,7 @@ class Puppet::Util::Autoload end end - def search_directories - [module_directories, Puppet[:libdir], $:].flatten + def search_directories(dummy_argument=:work_arround_for_ruby_GC_bug) + [module_directories, Puppet[:libdir].split(File::PATH_SEPARATOR), $:].flatten end end -- cgit