Merge pull request #5778 from Homebrew/dependabot/bundler/Library/Homebrew/vendor/backports-3.12.0

Bump backports from 3.11.4 to 3.12.0 in /Library/Homebrew/vendor
This commit is contained in:
Mike McQuaid 2019-02-21 12:19:51 +00:00 committed by GitHub
commit eb880f636c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 72 additions and 3 deletions

2
.gitignore vendored
View File

@ -61,6 +61,7 @@
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.1*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.2*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.3*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.6*
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/2.*.rb
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/force/
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib/backports/rails/
@ -109,6 +110,7 @@
**/vendor/bundle-standalone/ruby/*/gems/parallel-*/
**/vendor/bundle-standalone/ruby/*/gems/parser-*/
**/vendor/bundle-standalone/ruby/*/gems/powerpack-*/
**/vendor/bundle-standalone/ruby/*/gems/psych-*/
**/vendor/bundle-standalone/ruby/*/gems/rainbow-*/
**/vendor/bundle-standalone/ruby/*/gems/rubocop-0*/
**/vendor/bundle-standalone/ruby/*/gems/ruby-progressbar-*/

View File

@ -7,7 +7,7 @@ GEM
minitest (~> 5.1)
tzinfo (~> 1.1)
ast (2.4.0)
backports (3.11.4)
backports (3.12.0)
concurrent-ruby (1.1.4)
connection_pool (2.2.2)
domain_name (0.5.20180417)

View File

@ -10,7 +10,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.5/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-5.2.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/backports-3.11.4/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/backports-3.12.0/lib"
$:.unshift "#{path}/"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/connection_pool-2.2.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-18/2.3.0/unf_ext-0.0.7.5"
@ -34,9 +34,11 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.13.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.6.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/powerpack-0.1.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-18/2.3.0/psych-3.1.0"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/psych-3.1.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.4.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.64.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.65.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.32.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.1.0/lib"

View File

@ -0,0 +1,65 @@
unless String.method_defined? :undump
class String
def undump
# Making sure to return a String and not a subclass
string = to_s
raise 'string contains null byte' if string["\0"]
raise 'non-ASCII character detected' unless string.ascii_only?
#raise '.force_encoding("...") format is not supported by backports' if string.match(/\A".*"\.force_encoding\("[^"]*"\)\z/)
match = string.match(/\A(".*?"?)(?:\.force_encoding\("([^"]*)"\))?\z/)
if match
string = match[1]
encoding = match[2]
else
raise %(invalid dumped string; not wrapped with '"' nor '"...".force_encoding("...")' form)
end
# Ruby 1.9.3 does weird things to encoding during gsub
encoding ||= string.encoding.to_s
# Unescaped have an even number of backslashes in front of them
# because the double-quote is included, the unescaped quotes are where the size is odd
nb_unescaped_quote = string.scan(/\\*"/).select { |s| s.size.odd? }.size
raise 'unterminated dumped string' if nb_unescaped_quote == 1
if string[-1] != '"' || nb_unescaped_quote > 2
raise %(invalid dumped string; not wrapped with '"' nor '"...".force_encoding("...")' form)
end
string = string[1...-1]
if RUBY_VERSION >= '1.9'
# Look-arounds are not supported in ruby 1.8. Using a string with Regexp avoids the SyntaxError in 1.8.7
# \xY, \x3Y and finishing with \x
regex = Regexp.new("(?<!\\)(?:\\\\)*\\x(?![0-9a-f]{2})".gsub('\\', '\\\\\\\\'), Regexp::IGNORECASE)
raise 'invalid hex escape' if string[regex]
end
# The real #undump ignores the \C, \c and \M escapes
# Code injection is avoided by:
# * only allowing \u to have {}, so \\\\#{injection} will not eval the injection
# * only allowing the first character after the \\ to not be alpha/num/space, so \\\\#@inst_var_access is ignored
# To reduce the number of calls to eval a little, we wrap everything in a (...)+ so that consecutive escapes are
# handled at the same time.
result = string.gsub(/(\\+(u\{[\w ]+\}|[^cCM][\w]*))+/) do |s|
begin
eval("\"#{s}\"")
rescue SyntaxError => e
raise RuntimeError, e.message, e.backtrace
end
end
if encoding
begin
Encoding.find(encoding)
rescue ArgumentError
raise "dumped string has unknown encoding name"
end
result = result.force_encoding(encoding)
end
result
end
end
end