From bfa19b338518f50ec7e5c2d2ed4919fa50217dee Mon Sep 17 00:00:00 2001 From: Baptiste Fontaine Date: Thu, 3 Nov 2016 18:17:10 +0100 Subject: [PATCH] audit: Escape interpolated string in regexp This avoids issues with names containing special characters like e.g. [ Fixes #1431 --- Library/Homebrew/dev-cmd/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 3c19017630..568051b436 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