summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2011-02-01 04:55:26 +1100
committerDaniel Pittman <daniel@rimspace.net>2011-01-31 11:09:30 -0800
commit878f266fbf8979bcfeab9faef308816fd4a54c50 (patch)
treebc21ad9dc02317f8f77fcc18685af52a0b666ad4
parenteb97aa5f7cbf3800a22849f29fad555b0ca042d9 (diff)
downloadpuppet-878f266fbf8979bcfeab9faef308816fd4a54c50.tar.gz
puppet-878f266fbf8979bcfeab9faef308816fd4a54c50.tar.xz
puppet-878f266fbf8979bcfeab9faef308816fd4a54c50.zip
Fixed #6091 - Changed POSIX path matching to allow multiple leading slashes
According to http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_266: "Multiple successive slashes are considered to be the same as one slash.", so '//tmp/xxx' is a valid POSIX pathname. Thomas Bellman adds: You should probably read section 3.2 then as well: 3.2 Absolute Pathname A pathname beginning with a single or more than two slashes; see also Pathname. Note that a pathname starting with exactly two slashes is *not* an absolute pathname according to Posix. And 4.11 (Pathname Resolution) says: A pathname that begins with two successive slashes may be interpreted in an implementation-defined manner, although more than two leading slashes shall be treated as a single slash. Posix has this rule to accomodate DomainOS, which was a Unix- like OS from Apollo, where paths on the form "//foo/bar/gazonk" meant the file "/bar/gazonk" on the machine named "foo". You may recognize this format from URLs, or MS Windows SMB paths (with backslashes instead of forward slashes). This ignores that complication, since none of our supported platforms treat the '//' form as significant. Signed-off-by: James Turnbull <james@lovedthanlost.net> Signed-off-by: Daniel Pittman <daniel@puppetlabs.com> Signed-off-by: Rick Bradley <rick@rickbradley.com>
-rw-r--r--lib/puppet/type/file.rb2
1 files changed, 1 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