diff options
author | Daniel Pittman <daniel@puppetlabs.com> | 2011-01-31 11:10:39 -0800 |
---|---|---|
committer | Daniel Pittman <daniel@rimspace.net> | 2011-01-31 11:10:39 -0800 |
commit | 8de9b9aeadcee490065aeb34663ca22c513fd2e4 (patch) | |
tree | bc21ad9dc02317f8f77fcc18685af52a0b666ad4 | |
parent | 95ebc00c4a529c88301b26e1b0c6ecfc3a0cf67f (diff) | |
parent | 878f266fbf8979bcfeab9faef308816fd4a54c50 (diff) | |
download | puppet-8de9b9aeadcee490065aeb34663ca22c513fd2e4.tar.gz puppet-8de9b9aeadcee490065aeb34663ca22c513fd2e4.tar.xz puppet-8de9b9aeadcee490065aeb34663ca22c513fd2e4.zip |
Merge branch 'bug/2.6.next/6091-multiple-slashes-in-path-are-legal' into 2.6.next
-rw-r--r-- | lib/puppet/type/file.rb | 2 | ||||
-rwxr-xr-x | spec/unit/type/file_spec.rb | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb index 0d69446b4..a91e7a504 100644 --- a/lib/puppet/type/file.rb +++ b/lib/puppet/type/file.rb @@ -34,7 +34,7 @@ Puppet::Type.newtype(:file) do validate do |value| # accept various path syntaxes: lone slash, posix, win32, unc - unless (Puppet.features.posix? and (value =~ /^\/$/ or value =~ /^\/[^\/]/)) or (Puppet.features.microsoft_windows? and (value =~ /^.:\// or value =~ /^\/\/[^\/]+\/[^\/]+/)) + unless (Puppet.features.posix? and value =~ /^\//) or (Puppet.features.microsoft_windows? and (value =~ /^.:\// or value =~ /^\/\/[^\/]+\/[^\/]+/)) fail Puppet::Error, "File paths must be fully qualified, not '#{value}'" end end diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb index 51c27c0e6..db0fa9f34 100755 --- a/spec/unit/type/file_spec.rb +++ b/spec/unit/type/file_spec.rb @@ -194,6 +194,23 @@ describe Puppet::Type.type(:file) do file = Puppet::Type::File.new(:path => "/") file[:path].should == "/" end + + it "should accept a double-slash at the start of the path" do + expect { + file = Puppet::Type::File.new(:path => "//tmp/xxx") + # REVISIT: This should be wrong, later. See the next test. + # --daniel 2011-01-31 + file[:path].should == '/tmp/xxx' + }.should_not raise_error + end + + # REVISIT: This is pending, because I don't want to try and audit the + # entire codebase to make sure we get this right. POSIX treats two (and + # exactly two) '/' characters at the start of the path specially. + # + # See sections 3.2 and 4.11, which allow DomainOS to be all special like + # and still have the POSIX branding and all. --daniel 2011-01-31 + it "should preserve the double-slash at the start of the path" end describe "on Microsoft Windows systems" do |