Skip to content

Commit

Permalink
(PUP-3191) Fix symlink checking
Browse files Browse the repository at this point in the history
Prior to this commit we were trying to use Pathname.realpath to find where a
symlink points to. This throws a file not found when the symlink doesn't point
at anything valid in the filesystem.
This commit fixes that problem by only using File.readlink and not attempting
to find the symlinked file relative to the module unpacking directory.
  • Loading branch information
Brandon High committed Sep 9, 2014
1 parent 8ffaa4a commit e76f2ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppet/module_tool/applications/unpacker.rb
Expand Up @@ -46,7 +46,7 @@ def sanity_check
tmpdirpath = Pathname.new tmpdir

symlinks.each do |s|
Puppet.warning "Symlinks in modules are unsupported. Please investigate symlink #{s.relative_path_from tmpdirpath}->#{s.realpath.relative_path_from tmpdirpath}."
Puppet.warning "Symlinks in modules are unsupported. Please investigate symlink #{s.relative_path_from tmpdirpath}->#{File.readlink(s)}."
end
end

Expand Down

2 comments on commit e76f2ef

@Iristyle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the Puppet FileSystem abstraction which works properly on Windows:
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/file_system.rb#L255

@highb
Copy link

@highb highb commented on e76f2ef Sep 10, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it now, #3072

Please sign in to comment.