[Pkg-puppet-devel] [facter] 233/352: (FACT-321) Remove deprecated file extension expansion

Stig Sandbeck Mathisen ssm at debian.org
Sun Apr 6 22:21:48 UTC 2014


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit f9386528c2629944de11960fb18f6cfe668b50a1
Author: Adrien Thebo <git at somethingsinistral.net>
Date:   Mon Feb 10 09:58:04 2014 -0800

    (FACT-321) Remove deprecated file extension expansion
    
    This commit removes the automatic expansion of Windows commands that
    have an absolute path but do not have a file extension.
---
 lib/facter/core/execution.rb     | 11 -----------
 spec/unit/core/execution_spec.rb | 10 ----------
 2 files changed, 21 deletions(-)

diff --git a/lib/facter/core/execution.rb b/lib/facter/core/execution.rb
index cdcd03f..f500a9a 100644
--- a/lib/facter/core/execution.rb
+++ b/lib/facter/core/execution.rb
@@ -38,17 +38,6 @@ module Facter
       def which(bin)
         if absolute_path?(bin)
           return bin if File.executable?(bin)
-          if Facter::Util::Config.is_windows? and File.extname(bin).empty?
-            exts = ENV['PATHEXT']
-            exts = exts ? exts.split(File::PATH_SEPARATOR) : %w[.COM .EXE .BAT .CMD]
-            exts.each do |ext|
-              destext = bin + ext
-              if File.executable?(destext)
-                Facter.warnonce("Using Facter::Util::Execution.which with an absolute path like #{bin} but no fileextension is deprecated. Please add the correct extension (#{ext})")
-                return destext
-              end
-            end
-          end
         else
           search_paths.each do |dir|
             dest = File.join(dir, bin)
diff --git a/spec/unit/core/execution_spec.rb b/spec/unit/core/execution_spec.rb
index 9a6fc38..c90df48 100644
--- a/spec/unit/core/execution_spec.rb
+++ b/spec/unit/core/execution_spec.rb
@@ -127,16 +127,6 @@ describe Facter::Core::Execution do
           described_class.which('\\\\remote\dir\foo.exe').should == '\\\\remote\dir\foo.exe'
         end
 
-        it "should return the binary with added extension if executable" do
-          ['.COM', '.BAT', '.CMD', '' ].each do |ext|
-            File.stubs(:executable?).with('C:\Windows\system32\netsh'+ext).returns false
-          end
-          File.expects(:executable?).with('C:\Windows\system32\netsh.EXE').returns true
-
-          Facter.expects(:warnonce).with('Using Facter::Util::Execution.which with an absolute path like C:\\Windows\\system32\\netsh but no fileextension is deprecated. Please add the correct extension (.EXE)')
-          described_class.which('C:\Windows\system32\netsh').should == 'C:\Windows\system32\netsh.EXE'
-        end
-
         it "should return nil if the binary is not executable" do
           File.expects(:executable?).with('C:\Tools\foo.exe').returns false
           File.expects(:executable?).with('\\\\remote\dir\foo.exe').returns false

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list