aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Fontaine2016-11-03 18:17:10 +0100
committerBaptiste Fontaine2016-11-03 18:17:11 +0100
commitbfa19b338518f50ec7e5c2d2ed4919fa50217dee (patch)
tree843c8fdcbd61f4c9fa30d87f01018e45f43c36aa
parent09f438aeccab6b0aba40b14763b9ba7be7917836 (diff)
downloadbrew-bfa19b338518f50ec7e5c2d2ed4919fa50217dee.tar.bz2
audit: Escape interpolated string in regexp
This avoids issues with names containing special characters like e.g. [ Fixes #1431
-rw-r--r--Library/Homebrew/dev-cmd/audit.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb
index 3c1901763..568051b43 100644
--- a/Library/Homebrew/dev-cmd/audit.rb
+++ b/Library/Homebrew/dev-cmd/audit.rb
@@ -741,7 +741,7 @@ class FormulaAuditor
end
bin_names.each do |name|
["system", "shell_output", "pipe_output"].each do |cmd|
- if text =~ /(def test|test do).*#{cmd}[\(\s]+['"]#{name}[\s'"]/m
+ if text =~ /(def test|test do).*#{cmd}[\(\s]+['"]#{Regexp.escape name}[\s'"]/m
problem %(fully scope test #{cmd} calls e.g. #{cmd} "\#{bin}/#{name}")
end
end