[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:34:18 UTC 2010


The following commit has been merged in the upstream branch:
commit 97c043f440115fcfd9d3ddaad59af5c8da875329
Author: David Schmitt <david at dasz.at>
Date:   Fri Apr 30 11:34:52 2010 +0200

    Fix path handling
    
    *) Use File.expand_path as indicator for being an absolute path
    *) Use basename instead of parsing the path manually

diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb
index 2e249ad..51865ef 100644
--- a/lib/puppet/type/file.rb
+++ b/lib/puppet/type/file.rb
@@ -29,7 +29,8 @@ Puppet::Type.newtype(:file) do
         isnamevar
 
         validate do |value|
-            unless value =~ /^#{File::SEPARATOR}/
+            # use underlying platform's convention to check for relative paths
+            unless File.expand_path(value) == value
                 fail Puppet::Error,"File paths must be fully qualified, not '#{value}'"
             end
         end
diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb
index 9003a0c..8a010bb 100644
--- a/lib/puppet/util/command_line.rb
+++ b/lib/puppet/util/command_line.rb
@@ -62,7 +62,7 @@ module Puppet
             private
 
             def subcommand_and_args( zero, argv, stdin )
-                zero = zero.gsub(/.*#{File::SEPARATOR}/,'').sub(/\.rb$/, '')
+                zero = File.basename(zero, '.rb')
 
                 if zero == 'puppet'
                     case argv.first
diff --git a/lib/puppet/util/settings/file_setting.rb b/lib/puppet/util/settings/file_setting.rb
index 2dfbcf4..732af0b 100644
--- a/lib/puppet/util/settings/file_setting.rb
+++ b/lib/puppet/util/settings/file_setting.rb
@@ -49,9 +49,9 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting
     # the variable 'dir', or adding a slash at the end.
     def munge(value)
         # If it's not a fully qualified path...
-        if value.is_a?(String) and value !~ /^\$/ and value !~ /^\// and value != 'false'
+        if value.is_a?(String) and value !~ /^\$/ and value != 'false'
             # Make it one
-            value = File.join(Dir.getwd, value)
+            value = File.expand_path(value)
         end
         if value.to_s =~ /\/$/
             @type = :directory
@@ -83,7 +83,7 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting
         return nil unless path.is_a?(String)
 
         # Make sure the paths are fully qualified.
-        path = File.join(Dir.getwd, path) unless path =~ /^\//
+        path = File.expand_path(path)
 
         return nil unless type == :directory or create_files? or File.exist?(path)
         return nil if path =~ /^\/dev/

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list