Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ec127ebb903b
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: befa5c52149d
Choose a head ref
  • 2 commits
  • 97 files changed
  • 1 contributor

Commits on Nov 14, 2016

  1. Copy the full SHA
    62f5320 View commit details
  2. Copy the full SHA
    befa5c5 View commit details
Showing with 1,813 additions and 1,367 deletions.
  1. +4 −4 core/pom.xml
  2. +4 −4 default.build.properties
  3. +2 −2 lib/pom.xml
  4. +1 −1 lib/ruby/stdlib/cgi/cookie.rb
  5. +30 −11 lib/ruby/stdlib/cgi/util.rb
  6. +46 −15 lib/ruby/stdlib/csv.rb
  7. +1 −1 lib/ruby/stdlib/debug.rb
  8. +7 −7 lib/ruby/stdlib/delegate.rb
  9. +1 −1 lib/ruby/stdlib/digest.rb
  10. +39 −5 lib/ruby/stdlib/digest/sha2.rb
  11. +17 −9 lib/ruby/stdlib/drb/drb.rb
  12. +1 −1 lib/ruby/stdlib/drb/extservm.rb
  13. +30 −35 lib/ruby/stdlib/drb/timeridconv.rb
  14. +7 −3 lib/ruby/stdlib/e2mmap.rb
  15. +106 −75 lib/ruby/stdlib/erb.rb
  16. +9 −6 lib/ruby/stdlib/fiddle/import.rb
  17. +145 −276 lib/ruby/stdlib/fileutils.rb
  18. +1 −1 lib/ruby/stdlib/find.rb
  19. +55 −40 lib/ruby/stdlib/forwardable.rb
  20. +1 −1 lib/ruby/stdlib/getoptlong.rb
  21. +9 −6 lib/ruby/stdlib/ipaddr.rb
  22. +27 −15 lib/ruby/stdlib/irb.rb
  23. +2 −2 lib/ruby/stdlib/irb/cmd/chws.rb
  24. +1 −1 lib/ruby/stdlib/irb/cmd/fork.rb
  25. +1 −1 lib/ruby/stdlib/irb/cmd/help.rb
  26. +3 −3 lib/ruby/stdlib/irb/cmd/load.rb
  27. +3 −3 lib/ruby/stdlib/irb/cmd/pushws.rb
  28. +4 −4 lib/ruby/stdlib/irb/cmd/subirb.rb
  29. +3 −3 lib/ruby/stdlib/irb/notifier.rb
  30. +1 −1 lib/ruby/stdlib/irb/output-method.rb
  31. +1 −1 lib/ruby/stdlib/irb/workspace.rb
  32. +57 −20 lib/ruby/stdlib/logger.rb
  33. +3 −25 lib/ruby/stdlib/mathn.rb
  34. +2 −2 lib/ruby/stdlib/monitor.rb
  35. +1 −1 lib/ruby/stdlib/mutex_m.rb
  36. +5 −5 lib/ruby/stdlib/net/ftp.rb
  37. +37 −32 lib/ruby/stdlib/net/http.rb
  38. +6 −1 lib/ruby/stdlib/net/http/generic_request.rb
  39. +30 −21 lib/ruby/stdlib/net/http/header.rb
  40. +5 −3 lib/ruby/stdlib/net/http/response.rb
  41. +3 −0 lib/ruby/stdlib/net/http/responses.rb
  42. +3 −3 lib/ruby/stdlib/net/imap.rb
  43. +4 −4 lib/ruby/stdlib/net/pop.rb
  44. +23 −5 lib/ruby/stdlib/net/protocol.rb
  45. +14 −10 lib/ruby/stdlib/net/smtp.rb
  46. +8 −4 lib/ruby/stdlib/open-uri.rb
  47. +113 −100 lib/ruby/stdlib/optparse.rb
  48. +17 −0 lib/ruby/stdlib/optparse/kwargs.rb
  49. +19 −11 lib/ruby/stdlib/ostruct.rb
  50. +17 −3 lib/ruby/stdlib/pp.rb
  51. +8 −7 lib/ruby/stdlib/prime.rb
  52. +12 −6 lib/ruby/stdlib/pstore.rb
  53. +10 −8 lib/ruby/stdlib/resolv.rb
  54. +1 −1 lib/ruby/stdlib/rexml/attribute.rb
  55. +7 −4 lib/ruby/stdlib/rexml/functions.rb
  56. +2 −2 lib/ruby/stdlib/rexml/quickpath.rb
  57. +1 −1 lib/ruby/stdlib/rexml/text.rb
  58. +1 −1 lib/ruby/stdlib/rexml/xpath_parser.rb
  59. +1 −1 lib/ruby/stdlib/rinda/ring.rb
  60. +1 −1 lib/ruby/stdlib/rinda/tuplespace.rb
  61. +1 −7 lib/ruby/stdlib/rss/rss.rb
  62. +40 −15 lib/ruby/stdlib/set.rb
  63. +8 −6 lib/ruby/stdlib/shell.rb
  64. +1 −1 lib/ruby/stdlib/shell/builtin-command.rb
  65. +8 −8 lib/ruby/stdlib/shell/process-controller.rb
  66. +1 −1 lib/ruby/stdlib/shell/system-command.rb
  67. +11 −3 lib/ruby/stdlib/shellwords.rb
  68. +1 −1 lib/ruby/stdlib/singleton.rb
  69. +199 −19 lib/ruby/stdlib/socket.rb
  70. +3 −3 lib/ruby/stdlib/sync.rb
  71. +1 −1 lib/ruby/stdlib/thwait.rb
  72. +10 −6 lib/ruby/stdlib/time.rb
  73. +1 −1 lib/ruby/stdlib/tmpdir.rb
  74. +1 −1 lib/ruby/stdlib/tracer.rb
  75. +8 −3 lib/ruby/stdlib/un.rb
  76. +93 −86 lib/ruby/stdlib/unicode_normalize/tables.rb
  77. +26 −3 lib/ruby/stdlib/uri/common.rb
  78. +39 −49 lib/ruby/stdlib/uri/generic.rb
  79. +19 −16 lib/ruby/stdlib/uri/http.rb
  80. +8 −5 lib/ruby/stdlib/uri/mailto.rb
  81. +1 −1 lib/ruby/stdlib/webrick/config.rb
  82. +1 −1 lib/ruby/stdlib/webrick/cookie.rb
  83. +2 −2 lib/ruby/stdlib/webrick/httpauth/digestauth.rb
  84. +1 −1 lib/ruby/stdlib/webrick/httpauth/htdigest.rb
  85. +2 −2 lib/ruby/stdlib/webrick/httpproxy.rb
  86. +3 −1 lib/ruby/stdlib/webrick/httprequest.rb
  87. +8 −4 lib/ruby/stdlib/webrick/httpresponse.rb
  88. +1 −0 lib/ruby/stdlib/webrick/httpservlet/cgihandler.rb
  89. +2 −1 lib/ruby/stdlib/webrick/httpservlet/filehandler.rb
  90. +1 −0 lib/ruby/stdlib/webrick/httpstatus.rb
  91. +1 −1 lib/ruby/stdlib/webrick/server.rb
  92. +6 −1 lib/ruby/stdlib/webrick/ssl.rb
  93. +36 −11 lib/ruby/stdlib/webrick/utils.rb
  94. +31 −276 lib/ruby/stdlib/win32/resolv.rb
  95. +253 −0 lib/ruby/stdlib/win32/resolv9x.rb
  96. +12 −8 lib/ruby/stdlib/yaml/store.rb
  97. +0 −2 tool/{globals_2_3_1.rb → globals_2_4_0.rb}
8 changes: 4 additions & 4 deletions core/pom.xml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ DO NOT MODIFIY - GENERATED CODE
<artifactId>jruby-core</artifactId>
<name>JRuby Core</name>
<properties>
<version.ruby>2.3.1</version.ruby>
<version.ruby>2.4.0</version.ruby>
<prawn.dir>${test.dir}/prawn</prawn.dir>
<spec.tags.dir>${spec.dir}/tags</spec.tags.dir>
<polyglot.dump.pom>pom.xml</polyglot.dump.pom>
@@ -28,7 +28,7 @@ DO NOT MODIFIY - GENERATED CODE
<jruby.test.memory.permgen>2G</jruby.test.memory.permgen>
<installer.gems>${jruby.win32ole.gem}</installer.gems>
<prawn.git.repo>git://github.com/sandal/prawn.git</prawn.git.repo>
<version.ruby.minor>1</version.ruby.minor>
<version.ruby.minor>0</version.ruby.minor>
<tzdata.version>2013d</tzdata.version>
<install4j.executable>/Applications/install4j 4/bin/install4jc</install4j.executable>
<jay.bin>jay</jay.bin>
@@ -40,7 +40,7 @@ DO NOT MODIFIY - GENERATED CODE
<rubyspec.1.8.dir>${rubyspec.dir}/1.8</rubyspec.1.8.dir>
<jruby.launch.memory>1024M</jruby.launch.memory>
<jruby.compile.memory>2G</jruby.compile.memory>
<version.ruby.major>2.3</version.ruby.major>
<version.ruby.major>2.4</version.ruby.major>
<unsafe.version>8.92.1</unsafe.version>
<release.dir>release</release.dir>
<create.sources.jar>false</create.sources.jar>
@@ -49,7 +49,7 @@ DO NOT MODIFIY - GENERATED CODE
<parser.dir>core/src/main/java/org/jruby/parser</parser.dir>
<jruby.basedir>${basedir}/..</jruby.basedir>
<rubyspec.dir>${spec.dir}/ruby</rubyspec.dir>
<version.ruby.revision>54768</version.ruby.revision>
<version.ruby.revision>56780</version.ruby.revision>
<jruby.test.memory>3G</jruby.test.memory>
<mspec.dir>${spec.dir}/mspec</mspec.dir>
<build.date>${maven.build.timestamp}</build.date>
8 changes: 4 additions & 4 deletions default.build.properties
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ rake.args=
install4j.executable=/Applications/install4j 4/bin/install4jc

# Ruby versions
version.ruby=2.3.1
version.ruby.major=2.3
version.ruby.minor=1
version.ruby.revision=54768
version.ruby=2.4.0
version.ruby.major=2.4
version.ruby.minor=0
version.ruby.revision=56780
4 changes: 2 additions & 2 deletions lib/pom.xml
Original file line number Diff line number Diff line change
@@ -313,7 +313,7 @@ DO NOT MODIFIY - GENERATED CODE
<plugin>
<groupId>io.takari.polyglot</groupId>
<artifactId>polyglot-maven-plugin</artifactId>
<version>0.1.16</version>
<version>0.1.15</version>
<executions>
<execution>
<id>install_gems</id>
@@ -364,7 +364,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>io.takari.polyglot</groupId>
<artifactId>polyglot-ruby</artifactId>
<version>0.1.16</version>
<version>0.1.15</version>
</dependency>
</dependencies>
</plugin>
2 changes: 1 addition & 1 deletion lib/ruby/stdlib/cgi/cookie.rb
Original file line number Diff line number Diff line change
@@ -162,7 +162,7 @@ def self.parse(raw_cookie)
cookies = Hash.new([])
return cookies unless raw_cookie

raw_cookie.split(/[;,]\s?/).each do |pairs|
raw_cookie.split(/;\s?/).each do |pairs|
name, values = pairs.split('=',2)
next unless name and values
name = CGI.unescape(name)
41 changes: 30 additions & 11 deletions lib/ruby/stdlib/cgi/util.rb
Original file line number Diff line number Diff line change
@@ -31,10 +31,22 @@ def unescape(string,encoding=@@accept_charset)
'>' => '&gt;',
}

# Escape special characters in HTML, namely &\"<>
# Escape special characters in HTML, namely '&\"<>
# CGI::escapeHTML('Usage: foo "bar" <baz>')
# # => "Usage: foo &quot;bar&quot; &lt;baz&gt;"
def escapeHTML(string)
enc = string.encoding
unless enc.ascii_compatible?
if enc.dummy?
origenc = enc
enc = Encoding::Converter.asciicompat_encoding(enc)
string = enc ? string.encode(enc) : string.b
end
table = Hash[TABLE_FOR_ESCAPE_HTML__.map {|pair|pair.map {|s|s.encode(enc)}}]
string = string.gsub(/#{"['&\"<>]".encode(enc)}/, table)
string.encode!(origenc) if origenc
return string
end
string.gsub(/['&\"<>]/, TABLE_FOR_ESCAPE_HTML__)
end

@@ -47,10 +59,14 @@ def escapeHTML(string)
# CGI::unescapeHTML("Usage: foo &quot;bar&quot; &lt;baz&gt;")
# # => "Usage: foo \"bar\" <baz>"
def unescapeHTML(string)
return string unless string.include? '&'
enc = string.encoding
if enc != Encoding::UTF_8 && [Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE].include?(enc)
return string.gsub(Regexp.new('&(apos|amp|quot|gt|lt|#[0-9]+|#x[0-9A-Fa-f]+);'.encode(enc))) do
unless enc.ascii_compatible?
if enc.dummy?
origenc = enc
enc = Encoding::Converter.asciicompat_encoding(enc)
string = enc ? string.encode(enc) : string.b
end
string = string.gsub(Regexp.new('&(apos|amp|quot|gt|lt|#[0-9]+|#x[0-9A-Fa-f]+);'.encode(enc))) do
case $1.encode(Encoding::US_ASCII)
when 'apos' then "'".encode(enc)
when 'amp' then '&'.encode(enc)
@@ -61,8 +77,15 @@ def unescapeHTML(string)
when /\A#x([0-9a-f]+)\z/i then $1.hex.chr(enc)
end
end
string.encode!(origenc) if origenc
return string
end
asciicompat = Encoding.compatible?(string, "a")
return string unless string.include? '&'
charlimit = case enc
when Encoding::UTF_8; 0x10ffff
when Encoding::ISO_8859_1; 256
else 128
end
string.gsub(/&(apos|amp|quot|gt|lt|\#[0-9]+|\#[xX][0-9A-Fa-f]+);/) do
match = $1.dup
case match
@@ -73,18 +96,14 @@ def unescapeHTML(string)
when 'lt' then '<'
when /\A#0*(\d+)\z/
n = $1.to_i
if enc == Encoding::UTF_8 or
enc == Encoding::ISO_8859_1 && n < 256 or
asciicompat && n < 128
if n < charlimit
n.chr(enc)
else
"&##{$1};"
end
when /\A#x([0-9a-f]+)\z/i
n = $1.hex
if enc == Encoding::UTF_8 or
enc == Encoding::ISO_8859_1 && n < 256 or
asciicompat && n < 128
if n < charlimit
n.chr(enc)
else
"&#x#{$1};"
61 changes: 46 additions & 15 deletions lib/ruby/stdlib/csv.rb
Original file line number Diff line number Diff line change
@@ -431,7 +431,11 @@ def delete(header_or_index, minimum_index = 0)
#
# This method returns the row for chaining.
#
# If no block is given, an Enumerator is returned.
#
def delete_if(&block)
block or return enum_for(__method__) { size }

@row.delete_if(&block)

self # for chaining
@@ -500,13 +504,15 @@ def field?(data)

#
# Yields each pair of the row as header and field tuples (much like
# iterating over a Hash).
# iterating over a Hash). This method returns the row for chaining.
#
# Support for Enumerable.
# If no block is given, an Enumerator is returned.
#
# This method returns the row for chaining.
# Support for Enumerable.
#
def each(&block)
block or return enum_for(__method__) { size }

@row.each(&block)

self # for chaining
@@ -822,7 +828,11 @@ def delete(index_or_header)
#
# This method returns the table for chaining.
#
# If no block is given, an Enumerator is returned.
#
def delete_if(&block)
block or return enum_for(__method__) { @mode == :row or @mode == :col_or_row ? size : headers.size }

if @mode == :row or @mode == :col_or_row # by index
@table.delete_if(&block)
else # by header
@@ -845,7 +855,11 @@ def delete_if(&block)
#
# This method returns the table for chaining.
#
# If no block is given, an Enumerator is returned.
#
def each(&block)
block or return enum_for(__method__) { @mode == :col ? headers.size : size }

if @mode == :col
headers.each { |header| block[[header, self[header]]] }
else
@@ -982,9 +996,10 @@ class MalformedCSVError < RuntimeError; end
# through the +options+ Hash passed to CSV::new().
#
# <b><tt>:downcase</tt></b>:: Calls downcase() on the header String.
# <b><tt>:symbol</tt></b>:: The header String is downcased, spaces are
# replaced with underscores, non-word characters
# are dropped, and finally to_sym() is called.
# <b><tt>:symbol</tt></b>:: Leading/trailing spaces are dropped, string is
# downcased, remaining spaces are replaced with
# underscores, non-word characters are dropped,
# and finally to_sym() is called.
#
# All built-in header converters transcode header data to UTF-8 before
# attempting a conversion. If your data cannot be transcoded to UTF-8 the
@@ -1019,6 +1034,7 @@ class MalformedCSVError < RuntimeError; end
# <b><tt>:skip_blanks</tt></b>:: +false+
# <b><tt>:force_quotes</tt></b>:: +false+
# <b><tt>:skip_lines</tt></b>:: +nil+
# <b><tt>:liberal_parsing</tt></b>:: +false+
#
DEFAULT_OPTIONS = {
col_sep: ",",
@@ -1033,6 +1049,7 @@ class MalformedCSVError < RuntimeError; end
skip_blanks: false,
force_quotes: false,
skip_lines: nil,
liberal_parsing: false,
}.freeze

#
@@ -1499,6 +1516,10 @@ def self.table(path, options = Hash.new)
# a comment. If the passed object does
# not respond to <tt>match</tt>,
# <tt>ArgumentError</tt> is thrown.
# <b><tt>:liberal_parsing</tt></b>:: When set to a +true+ value, CSV will
# attempt to parse input not conformant
# with RFC 4180, such as double quotes
# in unquoted fields.
#
# See CSV::DEFAULT_OPTIONS for the default settings.
#
@@ -1622,6 +1643,8 @@ def header_converters
def skip_blanks?() @skip_blanks end
# Returns +true+ if all output fields are quoted. See CSV::new for details.
def force_quotes?() @force_quotes end
# Returns +true+ if illegal input is handled. See CSV::new for details.
def liberal_parsing?() @liberal_parsing end

#
# The Encoding CSV is parsing or writing in. This will be the Encoding you
@@ -1847,40 +1870,47 @@ def shift
# If we are continuing a previous column
if part[-1] == @quote_char && part.count(@quote_char) % 2 != 0
# extended column ends
csv.last << part[0..-2]
csv[-1] = csv[-1].push(part[0..-2]).join("")
if csv.last =~ @parsers[:stray_quote]
raise MalformedCSVError,
"Missing or stray quote in line #{lineno + 1}"
end
csv.last.gsub!(@quote_char * 2, @quote_char)
in_extended_col = false
else
csv.last << part
csv.last << @col_sep
csv.last.push(part, @col_sep)
end
elsif part[0] == @quote_char
# If we are starting a new quoted column
if part[-1] != @quote_char || part.count(@quote_char) % 2 != 0
if part.count(@quote_char) % 2 != 0
# start an extended column
csv << part[1..-1]
csv.last << @col_sep
csv << [part[1..-1], @col_sep]
in_extended_col = true
else
elsif part[-1] == @quote_char
# regular quoted column
csv << part[1..-2]
if csv.last =~ @parsers[:stray_quote]
raise MalformedCSVError,
"Missing or stray quote in line #{lineno + 1}"
end
csv.last.gsub!(@quote_char * 2, @quote_char)
elsif @liberal_parsing
csv << part
else
raise MalformedCSVError,
"Missing or stray quote in line #{lineno + 1}"
end
elsif part =~ @parsers[:quote_or_nl]
# Unquoted field with bad characters.
if part =~ @parsers[:nl_or_lf]
raise MalformedCSVError, "Unquoted fields do not allow " +
"\\r or \\n (line #{lineno + 1})."
else
raise MalformedCSVError, "Illegal quoting in line #{lineno + 1}."
if @liberal_parsing
csv << part
else
raise MalformedCSVError, "Illegal quoting in line #{lineno + 1}."
end
end
else
# Regular ole unquoted field.
@@ -1945,7 +1975,7 @@ def inspect
str << " encoding:" << @encoding.name
# show other attributes
%w[ lineno col_sep row_sep
quote_char skip_blanks ].each do |attr_name|
quote_char skip_blanks liberal_parsing ].each do |attr_name|
if a = instance_variable_get("@#{attr_name}")
str << " " << attr_name << ":" << a.inspect
end
@@ -2079,6 +2109,7 @@ def init_parsers(options)
# store the parser behaviors
@skip_blanks = options.delete(:skip_blanks)
@field_size_limit = options.delete(:field_size_limit)
@liberal_parsing = options.delete(:liberal_parsing)

# prebuild Regexps for faster parsing
esc_row_sep = escape_re(@row_sep)
2 changes: 1 addition & 1 deletion lib/ruby/stdlib/debug.rb
Original file line number Diff line number Diff line change
@@ -182,7 +182,7 @@ def Tracer.trace_func(*vars)
# Debug is not available in safe mode.

class DEBUGGER__
MUTEX = Mutex.new # :nodoc:
MUTEX = Thread::Mutex.new # :nodoc:

class Context # :nodoc:
DEBUG_LAST_CMD = []
14 changes: 7 additions & 7 deletions lib/ruby/stdlib/delegate.rb
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ class Delegator < BasicObject
kernel = ::Kernel.dup
kernel.class_eval do
alias __raise__ raise
[:to_s,:inspect,:=~,:!~,:===,:<=>,:eql?,:hash].each do |m|
[:to_s, :inspect, :=~, :!~, :===, :<=>, :eql?, :hash].each do |m|
undef_method m
end
private_instance_methods.each do |m|
@@ -175,7 +175,7 @@ def marshal_dump
ivars = instance_variables.reject {|var| /\A@delegate_/ =~ var}
[
:__v2__,
ivars, ivars.map{|var| instance_variable_get(var)},
ivars, ivars.map {|var| instance_variable_get(var)},
__getobj__
]
end
@@ -186,7 +186,7 @@ def marshal_dump
def marshal_load(data)
version, vars, values, obj = data
if version == :__v2__
vars.each_with_index{|var, i| instance_variable_set(var, values[i])}
vars.each_with_index {|var, i| instance_variable_set(var, values[i])}
__setobj__(obj)
else
__setobj__(data)
@@ -234,7 +234,7 @@ def initialize_dup(obj) # :nodoc:
end

@delegator_api = self.public_instance_methods
def self.public_api # :nodoc:
def self.public_api # :nodoc:
@delegator_api
end
end
@@ -305,7 +305,7 @@ def self.public_api # :nodoc:
# Non-Nil: 7
# Unique: 6
#
class SimpleDelegator<Delegator
class SimpleDelegator < Delegator
# Returns the current object method calls are being delegated to.
def __getobj__
unless defined?(@delegate_sd_obj)
@@ -379,9 +379,9 @@ def DelegateClass(superclass)
klass = Class.new(Delegator)
methods = superclass.instance_methods
methods -= ::Delegator.public_api
methods -= [:to_s,:inspect,:=~,:!~,:===]
methods -= [:to_s, :inspect, :=~, :!~, :===]
klass.module_eval do
def __getobj__ # :nodoc:
def __getobj__ # :nodoc:
unless defined?(@delegate_dc_obj)
return yield if block_given?
__raise__ ::ArgumentError, "not delegated"
Loading