Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #556 from r4um/issue-554

Fixes #554 do not map existing paths with = in them
  • Loading branch information...
commit 589c40214b78391341ba2088048fdc59e8dd0993 2 parents 70ac6b9 + 89d3642
@jordansissel authored
Showing with 18 additions and 1 deletion.
  1. +1 −1  lib/fpm/package/dir.rb
  2. +17 −0 spec/fpm/package/dir_spec.rb
View
2  lib/fpm/package/dir.rb
@@ -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] == "/"
View
17 spec/fpm/package/dir_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.