aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2016-07-13 15:58:04 +0800
committerXu Cheng2016-07-13 19:11:46 +0800
commit91fb49d270f0837e851b3e6e6b0f53848f024f6c (patch)
tree8d2b1b4d03c0c1cf314d839d4d088eb688e4dda9 /Library
parent48a1e1b47fecdde0127274a55e85312dbf268164 (diff)
downloadbrew-91fb49d270f0837e851b3e6e6b0f53848f024f6c.tar.bz2
various: proper escape in regex
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/audit.rb2
-rw-r--r--Library/Homebrew/cmd/bottle.rb2
-rw-r--r--Library/Homebrew/cmd/create.rb2
3 files changed, 3 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index 90c08fc4a..d5ba7df2d 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -142,7 +142,7 @@ class FormulaAuditor
swig
]
- FILEUTILS_METHODS = FileUtils.singleton_methods(false).join "|"
+ FILEUTILS_METHODS = FileUtils.singleton_methods(false).map { |m| Regexp.escape(m) }.join "|"
def initialize(formula, options = {})
@formula = formula
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb
index 5b900a9ba..d9ba20daf 100644
--- a/Library/Homebrew/cmd/bottle.rb
+++ b/Library/Homebrew/cmd/bottle.rb
@@ -238,7 +238,7 @@ module Homebrew
ignores = []
if f.deps.any? { |dep| dep.name == "go" }
- ignores << %r{#{HOMEBREW_CELLAR}/go/[\d\.]+/libexec}
+ ignores << %r{#{Regexp.escape(HOMEBREW_CELLAR)}/go/[\d\.]+/libexec}
end
if ARGV.include? "--skip-relocation"
diff --git a/Library/Homebrew/cmd/create.rb b/Library/Homebrew/cmd/create.rb
index a7aa78e49..eb3bec46f 100644
--- a/Library/Homebrew/cmd/create.rb
+++ b/Library/Homebrew/cmd/create.rb
@@ -110,7 +110,7 @@ class FormulaCreator
when %r{github\.com/\S+/(\S+)/archive/}
@name = $1
else
- /(.*?)[-_.]?#{path.version}/.match path.basename
+ /(.*?)[-_.]?#{Regexp.escape(path.version)}/.match path.basename
@name = $1
end
end