Skip to content

Commit

Permalink
Fixes jordansissel#554 do not map existing paths with = in them
Browse files Browse the repository at this point in the history
  • Loading branch information
r4um committed Sep 19, 2013
1 parent 77ca9f4 commit 462d135
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fpm/package/dir.rb
Expand Up @@ -43,7 +43,7 @@ def input(path)
# This mapping should work the same way 'rsync -a' does
# Meaning 'rsync -a source dest'
# and 'source=dest' in fpm work the same as the above rsync
if path =~ /.=./
if path =~ /.=./ && !File.exists?(chdir == '.' ? path : File.join(chdir, path))
origin, destination = path.split("=", 2)

if File.directory?(origin) && origin[-1,1] == "/"
Expand Down
17 changes: 17 additions & 0 deletions spec/fpm/package/dir_spec.rb
Expand Up @@ -97,5 +97,22 @@
insist { File }.exist?(File.join(output, expected_file))
end
end

it "should not map existing paths with = in them" do
File.write(File.join(tmpdir, "a=b"), "hello world")
subject.input(File.join(tmpdir, "a=b"))
subject.output(output)
insist { File }.exist?(File.join(output, tmpdir, "a=b"))
end

it "should not map existing paths with = in them and obey :chdir and :prefix attributes" do
Dir.mkdir(File.join(tmpdir, "a"))
File.write(File.join(tmpdir,"a", "a=b"), "hello world")
subject.attributes[:chdir] = tmpdir
subject.attributes[:prefix] = "/foo"
subject.input(File.join("a", "a=b"))
subject.output(output)
insist { File }.exist?(File.join(output, "foo", "a", "a=b"))
end
end
end # describe FPM::Package::Dir

0 comments on commit 462d135

Please sign in to comment.