aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMax Howell2010-01-13 05:37:58 +0000
committerMax Howell2010-01-13 11:23:15 +0000
commit1ead7d380ab85946f156ef64a0bc6324691b1704 (patch)
tree6718ee3e327988f0fef343112b4f89cae73fd933 /Library/Homebrew
parentd8c3b3a80a94bbc121539cd8d52eb252fb26c577 (diff)
downloadbrew-1ead7d380ab85946f156ef64a0bc6324691b1704.tar.bz2
Escape any spaces in path during strip step
Not using path.basename for mktemp due to risk of bugs due to incorrect escaping. But mainly, mktemp gives a unique name and this operation is procedural.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/brew.h.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb
index 32688d64c..f11448d21 100644
--- a/Library/Homebrew/brew.h.rb
+++ b/Library/Homebrew/brew.h.rb
@@ -442,11 +442,13 @@ private
puts "strip #{path}" if ARGV.verbose?
path.chmod 0644 # so we can strip
unless path.stat.nlink > 1
- `strip #{args} #{path}`
+ system "strip", *(args+path)
else
+ path = path.to_s.gsub ' ', '\\ '
+
# strip unlinks the file and recreates it, thus breaking hard links!
# is this expected behaviour? patch does it too… still, this fixes it
- tmp = `/usr/bin/mktemp -t #{path.basename}`.chomp
+ tmp = `/usr/bin/mktemp -t homebrew_strip`.chomp
`/usr/bin/strip #{args} -o #{tmp} #{path}`
`/bin/cat #{tmp} > #{path}`
File.unlink tmp