Permalink
Browse files

Escape filenames during the install process. Fixes #196

  • Loading branch information...
1 parent 918e8c9 commit 9e469faf7df269c4585cfb67e87f4c5276fb52f0 @jordansissel committed Apr 2, 2012
Showing with 7 additions and 7 deletions.
  1. +7 −7 templates/rpm.erb
View
14 templates/rpm.erb
@@ -60,15 +60,15 @@ Obsoletes: <%= repl %>
%install
<% files.each do |path| -%>
-<% source = File.join(staging_path, path) -%>
+<% source = Shellwords.shellescape(File.join(staging_path, path)) -%>
<% # Copy to the build_path/BUILD/ to make rpmbuild happy -%>
-<% target = File.join(build_path, "BUILD", path) -%>
+<% target = Shellwords.shellescape(File.join(build_path, "BUILD", path)) -%>
<% dir = File.dirname(target) %>
-mkdir -p "<%= dir %>"
-if [ -f "<%= source %>" ] || [ -h "<%= source %>" ] ; then
- cp -d "<%= source %>" "<%= target %>"
-elif [ -d "<%= source %>" ] ; then
- mkdir "<%= target %>"
+mkdir -p <%= dir %>
+if [ -f <%= source %> ] || [ -h <%= source %> ] ; then
+ cp -d <%= source %> <%= target %>
+elif [ -d <%= source %> ] ; then
+ mkdir <%= target %>
fi
<% end %>

0 comments on commit 9e469fa

Please sign in to comment.