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: 0d4070d99355
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 81b467ab15b3
Choose a head ref
  • 7 commits
  • 10 files changed
  • 1 contributor

Commits on Dec 10, 2015

  1. Copy the full SHA
    95af734 View commit details
  2. Copy the full SHA
    dfab8c8 View commit details
  3. update time.rb from 2.2.3

    kares committed Dec 10, 2015
    Copy the full SHA
    399f99c View commit details
  4. Copy the full SHA
    132895e View commit details
  5. Copy the full SHA
    30768a6 View commit details
  6. Copy the full SHA
    9c0e46f View commit details
  7. Copy the full SHA
    81b467a View commit details
6 changes: 3 additions & 3 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.2.2</version.ruby>
<version.ruby>2.2.3</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>2</version.ruby.minor>
<version.ruby.minor>3</version.ruby.minor>
<tzdata.version>2013d</tzdata.version>
<install4j.executable>/Applications/install4j 4/bin/install4jc</install4j.executable>
<jay.bin>jay</jay.bin>
@@ -48,7 +48,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>50293</version.ruby.revision>
<version.ruby.revision>51636</version.ruby.revision>
<jruby.test.memory>3G</jruby.test.memory>
<mspec.dir>${spec.dir}/mspec</mspec.dir>
<build.date>${maven.build.timestamp}</build.date>
9 changes: 4 additions & 5 deletions core/src/main/java/org/jruby/ext/timeout/Timeout.java
Original file line number Diff line number Diff line change
@@ -46,7 +46,6 @@
import org.jruby.anno.JRubyMethod;
import org.jruby.exceptions.RaiseException;
import org.jruby.runtime.Helpers;
import org.jruby.runtime.Arity;
import org.jruby.runtime.Block;
import org.jruby.runtime.ThreadContext;
import static org.jruby.runtime.Visibility.*;
@@ -58,9 +57,9 @@
public class Timeout implements Library {
public void load(Ruby runtime, boolean wrap) throws IOException {
RubyModule timeout = runtime.defineModule("Timeout");
RubyClass superclass = runtime.getRuntimeError();
RubyClass timeoutError = runtime.defineClassUnder("Error", superclass, superclass.getAllocator(), timeout);
runtime.defineClassUnder("ExitException", runtime.getException(), runtime.getException().getAllocator(), timeout);
RubyClass RuntimeError = runtime.getRuntimeError();
RubyClass TimeoutError = runtime.defineClassUnder("Error", RuntimeError, RuntimeError.getAllocator(), timeout);
timeout.defineConstant("ExitException", TimeoutError);

// Here we create an "anonymous" exception type used for unrolling the stack.
// MRI creates a new one for *every call* to timeout, which can be costly.
@@ -76,7 +75,7 @@ public void load(Ruby runtime, boolean wrap) throws IOException {
timeout.defineAnnotatedMethods(Timeout.class);

// Toplevel defines
runtime.getObject().defineConstant("TimeoutError", timeoutError);
runtime.getObject().defineConstant("TimeoutError", TimeoutError);
runtime.getObject().defineAnnotatedMethods(TimeoutToplevel.class);
}

6 changes: 3 additions & 3 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.2.2
version.ruby=2.2.3
version.ruby.major=2.2
version.ruby.minor=2
version.ruby.revision=50293
version.ruby.minor=3
version.ruby.revision=51636
68 changes: 55 additions & 13 deletions lib/ruby/stdlib/cmath.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
##
# = Trigonometric and transcendental functions for complex numbers.
#
# CMath is a library that provides trigonometric and transcendental
# functions for complex numbers.
# functions for complex numbers. The functions in this module accept
# integers, floating-point numbers or complex numbers as arguments.
#
# Note that the selection of functions is similar, but not identical,
# to that in module math. The reason for having two modules is that
# some users aren't interested in complex numbers, and perhaps don't
# even know what they are. They would rather have Math.sqrt(-1) raise
# an exception than return a complex number.
#
# == Usage
#
# To start using this library, simply:
# To start using this library, simply require cmath library:
#
# require "cmath"
#
# Square root of a negative number is a complex number.
# And after call any CMath function. For example:
#
# CMath.sqrt(-9) #=> 0+3.0i
# CMath.exp(0 + 0i) #=> 1.0+0.0i
# CMath.log10(-5.to_c) #=> (0.6989700043360187+1.3643763538418412i)
#
# CMath.sqrt(-9) #=> 0+3.0i
#
# For more information you can see Complec class.

module CMath

@@ -44,9 +57,7 @@ module CMath
##
# Math::E raised to the +z+ power
#
# exp(Complex(0,0)) #=> 1.0+0.0i
# exp(Complex(0,PI)) #=> -1.0+1.2246467991473532e-16i
# exp(Complex(0,PI/2.0)) #=> 6.123233995736766e-17+1.0i
# CMath.exp(2i) #=> (-0.4161468365471424+0.9092974268256817i)
def exp(z)
begin
if z.real?
@@ -62,10 +73,11 @@ def exp(z)
end

##
# Returns the natural logarithm of Complex. If a second argument is given,
# Returns the natural logarithm of Complex. If a second argument is given,
# it will be the base of logarithm.
#
# log(Complex(0,0)) #=> -Infinity+0.0i
# CMath.log(1 + 4i) #=> (1.416606672028108+1.3258176636680326i)
# CMath.log(1 + 4i, 10) #=> (0.6152244606891369+0.5757952953408879i)
def log(*args)
begin
z, b = args
@@ -88,6 +100,8 @@ def log(*args)

##
# returns the base 2 logarithm of +z+
#
# CMath.log2(-1) => (0.0+4.532360141827194i)
def log2(z)
begin
if z.real? and z >= 0
@@ -102,6 +116,8 @@ def log2(z)

##
# returns the base 10 logarithm of +z+
#
# CMath.log10(-1) #=> (0.0+1.3643763538418412i)
def log10(z)
begin
if z.real? and z >= 0
@@ -116,9 +132,8 @@ def log10(z)

##
# Returns the non-negative square root of Complex.
# sqrt(-1) #=> 0+1.0i
# sqrt(Complex(-1,0)) #=> 0.0+1.0i
# sqrt(Complex(0,8)) #=> 2.0+2.0i
#
# CMath.sqrt(-1 + 0i) #=> 0.0+1.0i
def sqrt(z)
begin
if z.real?
@@ -144,12 +159,16 @@ def sqrt(z)

##
# returns the principal value of the cube root of +z+
#
# CMath.cbrt(1 + 4i) #=> (1.449461632813119+0.6858152562177092i)
def cbrt(z)
z ** (1.0/3)
end

##
# returns the sine of +z+, where +z+ is given in radians
#
# CMath.sin(1 + 1i) #=> (1.2984575814159773+0.6349639147847361i)
def sin(z)
begin
if z.real?
@@ -165,6 +184,8 @@ def sin(z)

##
# returns the cosine of +z+, where +z+ is given in radians
#
# CMath.cos(1 + 1i) #=> (0.8337300251311491-0.9888977057628651i)
def cos(z)
begin
if z.real?
@@ -180,6 +201,8 @@ def cos(z)

##
# returns the tangent of +z+, where +z+ is given in radians
#
# CMath.tan(1 + 1i) #=> (0.27175258531951174+1.0839233273386943i)
def tan(z)
begin
if z.real?
@@ -194,6 +217,8 @@ def tan(z)

##
# returns the hyperbolic sine of +z+, where +z+ is given in radians
#
# CMath.sinh(1 + 1i) #=> (0.6349639147847361+1.2984575814159773i)
def sinh(z)
begin
if z.real?
@@ -209,6 +234,8 @@ def sinh(z)

##
# returns the hyperbolic cosine of +z+, where +z+ is given in radians
#
# CMath.cosh(1 + 1i) #=> (0.8337300251311491+0.9888977057628651i)
def cosh(z)
begin
if z.real?
@@ -224,6 +251,8 @@ def cosh(z)

##
# returns the hyperbolic tangent of +z+, where +z+ is given in radians
#
# CMath.tanh(1 + 1i) #=> (1.0839233273386943+0.27175258531951174i)
def tanh(z)
begin
if z.real?
@@ -238,6 +267,8 @@ def tanh(z)

##
# returns the arc sine of +z+
#
# CMath.asin(1 + 1i) #=> (0.6662394324925153+1.0612750619050355i)
def asin(z)
begin
if z.real? and z >= -1 and z <= 1
@@ -252,6 +283,8 @@ def asin(z)

##
# returns the arc cosine of +z+
#
# CMath.acos(1 + 1i) #=> (0.9045568943023813-1.0612750619050357i)
def acos(z)
begin
if z.real? and z >= -1 and z <= 1
@@ -266,6 +299,8 @@ def acos(z)

##
# returns the arc tangent of +z+
#
# CMath.atan(1 + 1i) #=> (1.0172219678978514+0.4023594781085251i)
def atan(z)
begin
if z.real?
@@ -281,6 +316,8 @@ def atan(z)
##
# returns the arc tangent of +y+ divided by +x+ using the signs of +y+ and
# +x+ to determine the quadrant
#
# CMath.atan2(1 + 1i, 0) #=> (1.5707963267948966+0.0i)
def atan2(y,x)
begin
if y.real? and x.real?
@@ -295,6 +332,8 @@ def atan2(y,x)

##
# returns the inverse hyperbolic sine of +z+
#
# CMath.asinh(1 + 1i) #=> (1.0612750619050357+0.6662394324925153i)
def asinh(z)
begin
if z.real?
@@ -309,6 +348,8 @@ def asinh(z)

##
# returns the inverse hyperbolic cosine of +z+
#
# CMath.acosh(1 + 1i) #=> (1.0612750619050357+0.9045568943023813i)
def acosh(z)
begin
if z.real? and z >= 1
@@ -323,6 +364,8 @@ def acosh(z)

##
# returns the inverse hyperbolic tangent of +z+
#
# CMath.atanh(1 + 1i) #=> (0.4023594781085251+1.0172219678978514i)
def atanh(z)
begin
if z.real? and z >= -1 and z <= 1
@@ -397,4 +440,3 @@ def handle_no_method_error # :nodoc:
module_function :handle_no_method_error

end

21 changes: 10 additions & 11 deletions lib/ruby/stdlib/fileutils.rb
Original file line number Diff line number Diff line change
@@ -156,10 +156,10 @@ def uptodate?(new, old_list)
end
module_function :uptodate?

def remove_trailing_slash(dir)
def remove_tailing_slash(dir)
dir == '/' ? dir : dir.chomp(?/)
end
private_module_function :remove_trailing_slash
private_module_function :remove_tailing_slash

#
# Options: mode noop verbose
@@ -207,7 +207,7 @@ def mkdir_p(list, options = {})
fu_output_message "mkdir -p #{options[:mode] ? ('-m %03o ' % options[:mode]) : ''}#{list.join ' '}" if options[:verbose]
return *list if options[:noop]

list.map {|path| remove_trailing_slash(path)}.each do |path|
list.map {|path| remove_tailing_slash(path)}.each do |path|
# optimize for the most common case
begin
fu_mkdir path, options[:mode]
@@ -244,7 +244,7 @@ def mkdir_p(list, options = {})
OPT_TABLE['makedirs'] = [:mode, :noop, :verbose]

def fu_mkdir(path, mode) #:nodoc:
path = remove_trailing_slash(path)
path = remove_tailing_slash(path)
if mode
Dir.mkdir path, mode
File.chmod mode, path
@@ -272,7 +272,7 @@ def rmdir(list, options = {})
return if options[:noop]
list.each do |dir|
begin
Dir.rmdir(dir = remove_trailing_slash(dir))
Dir.rmdir(dir = remove_tailing_slash(dir))
if parents
until (parent = File.dirname(dir)) == '.' or parent == dir
dir = parent
@@ -518,7 +518,7 @@ def mv(src, dest, options = {})
begin
if destent.exist?
if destent.directory?
raise Errno::EEXIST, dest
raise Errno::EEXIST, d
else
destent.remove_file if rename_cannot_overwrite_file?
end
@@ -726,15 +726,14 @@ def remove_entry_secure(path, force = false)
end
# freeze tree root
euid = Process.euid
dot_file = fullpath + "/."
File.lstat(dot_file).tap {|fstat|
unless fu_stat_identical_entry?(st, fstat)
File.open(fullpath + '/.') {|f|
unless fu_stat_identical_entry?(st, f.stat)
# symlink (TOC-to-TOU attack?)
File.unlink fullpath
return
end
File.chown euid, -1, dot_file
File.chmod 0700, dot_file
f.chown euid, -1
f.chmod 0700
unless fu_stat_identical_entry?(st, File.lstat(fullpath))
# TOC-to-TOU attack?
File.unlink fullpath
11 changes: 3 additions & 8 deletions lib/ruby/stdlib/net/ftp.rb
Original file line number Diff line number Diff line change
@@ -377,15 +377,9 @@ def sendport(host, port) # :nodoc:
end
private :sendport

# Constructs a TCPServer socket, and sends it the PORT command
#
# Returns the constructed TCPServer socket
# Constructs a TCPServer socket
def makeport # :nodoc:
sock = TCPServer.open(@sock.addr[3], 0)
port = sock.addr[1]
host = sock.addr[3]
sendport(host, port)
return sock
TCPServer.open(@sock.addr[3], 0)
end
private :makeport

@@ -421,6 +415,7 @@ def transfercmd(cmd, rest_offset = nil) # :nodoc:
else
sock = makeport
begin
sendport(sock.addr[3], sock.addr[1])
if @resume and rest_offset
resp = sendcmd("REST " + rest_offset.to_s)
if resp[0] != ?3
3 changes: 1 addition & 2 deletions lib/ruby/stdlib/net/http.rb
Original file line number Diff line number Diff line change
@@ -928,8 +928,7 @@ def connect
if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
s.post_connection_check(@address)
end
# Commented out until JRuby implements OpenSSL::SSL::Session
#@ssl_session = s.session
@ssl_session = s.session
rescue => exception
D "Conn close because of connect error #{exception}"
@socket.close if @socket and not @socket.closed?
10 changes: 6 additions & 4 deletions lib/ruby/stdlib/net/http/response.rb
Original file line number Diff line number Diff line change
@@ -250,7 +250,8 @@ def inflater # :nodoc:
return yield @socket unless @decode_content
return yield @socket if self['content-range']

case self['content-encoding']
v = self['content-encoding']
case v && v.downcase
when 'deflate', 'gzip', 'x-gzip' then
self.delete 'content-encoding'

@@ -259,11 +260,11 @@ def inflater # :nodoc:
begin
yield inflate_body_io
ensure
e = $!
orig_err = $!
begin
inflate_body_io.finish
rescue
raise e
rescue => err
raise orig_err || err
end
end
when 'none', 'identity' then
@@ -358,6 +359,7 @@ def initialize socket
# Finishes the inflate stream.

def finish
return if @inflate.total_in == 0
@inflate.finish
end

8 changes: 7 additions & 1 deletion lib/ruby/stdlib/net/imap.rb
Original file line number Diff line number Diff line change
@@ -2625,7 +2625,13 @@ def body_ext_mpart
return param
end
disposition = body_fld_dsp
match(T_SPACE)

token = lookahead
if token.symbol == T_SPACE
shift_token
else
return param, disposition
end
language = body_fld_lang

token = lookahead
8 changes: 7 additions & 1 deletion lib/ruby/stdlib/time.rb
Original file line number Diff line number Diff line change
@@ -426,7 +426,13 @@ def strptime(date, format, now=self.now)
d = Date._strptime(date, format)
raise ArgumentError, "invalid strptime format - `#{format}'" unless d
if seconds = d[:seconds]
t = Time.at(seconds)
if sec_fraction = d[:sec_fraction]
usec = sec_fraction * 1000000
usec *= -1 if seconds < 0
else
usec = 0
end
t = Time.at(seconds, usec)
if zone = d[:zone]
force_zone!(t, zone)
end