Issue #6648 has been reported by Rohan McGovern.
----------------------------------------
Bug #6648: Windows: including any file fails due to absolute / relative path
issue
https://projects.puppetlabs.com/issues/6648
Author: Rohan McGovern
Status: Unreviewed
Priority: Normal
Assignee:
Category: windows
Target version:
Affected Puppet version: 2.6.5
Keywords:
Branch:
To reproduce with puppet 2.6.5 on Windows:
Make test1.pp containing:
<pre>
warning("In test1.pp")
import "test2.pp"
</pre>
Make test2.pp containing:
<pre>
warning("In test2.pp")
</pre>
Run from command prompt:
`puppet --vardir=%cd% --confdir=%cd% --debug --verbose --color=false test1.pp`
Expected output:
<pre>
debug: importing 'c:/Users/rmcgover/depot/sysadmin/puppet/test2.pp' in
environment production
warning: Scope(Class[main]): in test2.pp
warning: Scope(Class[main]): In test1.pp
(... other stuff)
</pre>
Actual output:
<pre>
debug: importing
'c:/Users/rmcgover/depot/sysadmin/puppet/c:/Users/rmcgover/depot/sysadmin/puppet/test2.pp'
in environment production
Could not parse for environment production: Could not find file
c:/Users/rmcgover/depot/sysadmin/puppet/c:/Users/rmcgover/depot/sysadmin/puppet/test2.pp
at c:/Users/rmcgover/depot/sysadmin/puppet/test1.pp:3 on node ...
</pre>
It seems to be because the puppet code assumes that all absolute paths match
`/^#{File::SEPARATOR}/` which is not true on Windows.
I have been able to fix this particular instance of the problem with a patch
like this, but a quick grep shows there may be many places in the code with
this problem.
<pre>
From: Rohan McGovern <[email protected]>
Date: Wed, 9 Mar 2011 15:35:38 +1000
Subject: [PATCH] Windows: fix inclusion of files on Windows
Checking if a path begins with the directory separator character
is not a valid way to check if a path is absolute on Windows.
---
.../puppet-2.6.5/lib/puppet/parser/type_loader.rb | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git
a/ruby/lib/ruby/gems/1.8/gems/puppet-2.6.5/lib/puppet/parser/type_loader.rb
b/ruby/lib/ruby/gems/1.8/gems/puppet-2.6.5/lib/puppet/parser/type_loader.rb
index bae5603..a7f99b0 100644
--- a/ruby/lib/ruby/gems/1.8/gems/puppet-2.6.5/lib/puppet/parser/type_loader.rb
+++ b/ruby/lib/ruby/gems/1.8/gems/puppet-2.6.5/lib/puppet/parser/type_loader.rb
@@ -79,9 +79,7 @@ class Puppet::Parser::TypeLoader
end
files.each do |file|
- unless file =~ /^#{File::SEPARATOR}/
- file = File.join(dir, file)
- end
+ file = File.expand_path(file, dir)
@loading_helper.do_once(file) do
parse_file(file)
end
--
1.7.3.1.msysgit.0
</pre>
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.