/patches/ruby/2.1.0/railsexpress/01-current-2.1.1-fixes.patch
Patch | 4227 lines | 3895 code | 332 blank | 0 comment | 0 complexity | 5cc9064f0dee3da79ab793c6a21b40bb MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- diff --git a/ChangeLog b/ChangeLog
- index 0349f7c..66ef0e4 100644
- --- a/ChangeLog
- +++ b/ChangeLog
- @@ -1,3 +1,216 @@
- +Thu Feb 6 08:23:28 2014 Eric Wong <e@80x24.org>
- +
- + * ext/thread/thread.c (rb_szqueue_max_set): use correct queue and
- + limit wakeups. [Bug #9343][ruby-core:60517]
- + * test/thread/test_queue.rb (test_sized_queue_assign_max):
- + test for bug
- +
- +Thu Feb 6 11:27:39 2014 Eric Hodel <drbrain@segment7.net>
- +
- + * lib/rubygems: RubyGems 2.2.2 which contains the following bug fixes:
- + http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.2.2+%2F+2014-02-05
- + https://bugs.ruby-lang.org/issues/9489
- +
- +Thu Feb 6 11:23:59 2014 Koichi Sasada <ko1@atdot.net>
- +
- + * gc.c (ruby_gc_set_params): if RUBY_GC_OLDMALLOC_LIMIT is provided,
- + then set objspace->rgengc.oldmalloc_increase_limit.
- + Without this fix, the env variable RUBY_GC_OLDMALLOC_LIMIT
- + does not work.
- +
- + * gc.c (get_envparam_int): accept a value equals to lowerbounds.
- +
- + * gc.c (get_envparam_double): ditto.
- +
- +Wed Feb 5 23:57:05 2014 Charlie Somerville <charliesome@ruby-lang.org>
- +
- + * ext/thread/thread.c (rb_szqueue_push): check GET_SZQUEUE_WAITERS
- + instead of GET_QUEUE_WAITERS to prevent deadlock. Patch by Eric Wong.
- + [Bug #9302] [ruby-core:59324]
- +
- + * test/thread/test_queue.rb: add test
- +
- +Wed Feb 5 23:43:30 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- +
- + * hash.c (rb_objid_hash): should return `long'. brushup r44534.
- +
- + * object.c (rb_obj_hash): follow above change.
- +
- +Wed Feb 5 23:43:30 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- +
- + * hash.c (rb_any_hash): should treat the return value of rb_objid_hash()
- + as `long', because ruby assumes the hash value of the object id of
- + an object is `long'.
- + this fixes test failures on mswin64 introduced at r44525.
- +
- +Wed Feb 5 23:43:30 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- +
- + * hash.c (rb_objid_hash): return hash value from object ID with a
- + salt, extract from rb_any_hash().
- +
- + * object.c (rb_obj_hash): return same value as rb_any_hash().
- + fix r44125. [ruby-core:59638] [Bug #9381]
- +
- +Wed Feb 5 22:28:41 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- +
- + * vm_insnhelper.c (vm_search_super_method): allow bound method from a
- + module, yet another method transplanting.
- +
- +Wed Feb 5 22:28:41 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- +
- + * vm_insnhelper.c (vm_search_super_method): when super called in a
- + bound UnboundMethod generated from a module, no superclass is
- + found since the current defined class is the module, then call
- + method_missing in that case. [ruby-core:59619] [Bug #9377]
- +
- +Wed Feb 5 21:57:40 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- +
- + * ext/socket/socket.c (rsock_syserr_fail_host_port): add errno
- + argument version anduse rb_syserr_fail_str() instead of
- + rb_sys_fail_str() with restoring errno.
- +
- + * ext/socket/socket.c (rsock_syserr_fail_path): ditto, and
- + rb_syserr_fail().
- +
- + * ext/socket/socket.c (rsock_sys_fail_sockaddr): ditto, use
- + rsock_syserr_fail_raddrinfo().
- +
- + * ext/socket/socket.c (rsock_sys_fail_raddrinfo): ditto.
- +
- + * ext/socket/socket.c (setup_domain_and_type): ditto.
- +
- +Wed Feb 5 21:57:40 2014 Eric Wong <normalperson@yhbt.net>
- +
- + * ext/socket/socket.c (rsock_sys_fail_host_port): save and restore errno
- + before calling rb_sys_fail_str to prevent [BUG] errno == 0.
- + Patch by Eric Wong. [ruby-core:59498] [Bug #9352]
- +
- + * ext/socket/socket.c (rsock_sys_fail_path): ditto
- + * ext/socket/socket.c (rsock_sys_fail_sockaddr): ditto
- + * ext/socket/socket.c (rsock_sys_fail_raddrinfo): ditto
- + * ext/socket/socket.c (rsock_sys_fail_raddrinfo_or_sockaddr): ditto
- +
- +Wed Feb 5 21:12:02 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- +
- + * lib/timeout.rb (Timeout::ExitException.catch): pass arguments
- + for new instance.
- +
- + * lib/timeout.rb (Timeout::ExitException#exception): fallback to
- + Timeout::Error if couldn't throw. [ruby-dev:47872] [Bug #9380]
- +
- + * lib/timeout.rb (Timeout#timeout): initialize ExitException with
- + message for the fallback case.
- +
- +Wed Feb 5 21:12:02 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- +
- + * lib/timeout.rb (Timeout#timeout): should not rescue ordinarily
- + raised ExitException, which should not be thrown.
- +
- + * lib/timeout.rb (Timeout::ExitException.catch): set @thread only if
- + it ought to be caught.
- +
- + * lib/timeout.rb (Timeout#timeout): when a custom exception is given,
- + no instance is needed to be caught, so defer creating new instance
- + until it is raised. [ruby-core:59511] [Bug #9354]
- +
- +Wed Feb 5 17:55:28 2014 Aman Gupta <ruby@tmm1.net>
- +
- + * array.c (ary_add_hash): Fix consistency issue between Array#uniq and
- + Array#uniq! [Bug #9340] [ruby-core:59457]
- + * test/ruby/test_array.rb (class TestArray): regression test for above.
- +
- +Wed Feb 5 11:48:42 2014 Charlie Somerville <charliesome@ruby-lang.org>
- +
- + * struct.c (rb_struct_set): return assigned value from setter method
- + rather than struct object. [Bug #9353] [ruby-core:59509]
- +
- + * test/ruby/test_struct.rb (test_setter_method_returns_value): add test
- +
- +Wed Feb 5 11:13:21 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- +
- + * string.c (rb_str_modify_expand): enable capacity and disable
- + assocation with packed objects when setting capa, so that
- + pack("p") string fails to unpack properly after modified.
- +
- +Sun Feb 2 22:39:28 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- +
- + * lib/delegate.rb (Delegator): keep source information methods
- + which start and end with '__'. [ruby-core:59718] [Bug #9403]
- +
- +Fri Jan 31 12:10:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- +
- + * proc.c (mnew_from_me): keep iclass as-is, to make inheritance
- + chain consistent. [ruby-core:59358] [Bug #9315]
- +
- + * proc.c (method_owner): return the original defined_class from
- + prepended iclass, instead.
- +
- +Fri Jan 31 12:05:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- +
- + * configure.in: let mingw do something black-magic, and check if
- + _gmtime64_s() is available actually.
- +
- + * win32/win32.c (gmtime_s, localtime_s): use _gmtime64_s() and
- + _localtime64_s() if available, not depending on very confusing
- + mingw variants macros. based on the patch by phasis68 (Heesob
- + Park) at [ruby-core:58764]. [ruby-core:58391] [Bug #9119]
- +
- +Thu Jan 30 15:02:35 2014 Shugo Maeda <shugo@ruby-lang.org>
- +
- + * configure.in: use $@ instead of $(.TARGET) because .TARGET is not
- + supported by GNU make.
- +
- +Mon Jan 27 16:49:52 2014 Kenta Murata <mrkn@mrkn.jp>
- +
- + * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): Add an additional
- + digit for the quotient to be compatible with bigdecimal 1.2.1 and
- + the former. [ruby-core:59365] [#9316] [#9305]
- +
- + * test/bigdecimal/test_bigdecimal.rb: tests for the above change.
- +
- + * ext/bigdecimal/bigdecimal.gemspec: bigdecimal version 1.2.4.
- +
- +Mon Jan 27 16:45:34 2014 Yamashita Yuu <yamashita@geishatokyo.com>
- +
- + * ext/openssl/ossl_ssl.c (Init_ossl_ssl): Declare a constant
- + `OP_MSIE_SSLV2_RSA_PADDING` only if the macro is defined. The
- + `SSL_OP_MSIE_SSLV2_RSA_PADDING` has been removed from latest
- + snapshot of OpenSSL 1.0.1. [Fixes GH-488]
- +
- +Thu Jan 23 10:37:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- +
- + * hash.c (HAS_EXTRA_STATES): warn extra states only when something
- + differ. [ruby-core:59254] [Bug #9275]
- +
- +Thu Jan 9 14:05:24 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- +
- + * win32/{setup.mak,Makefile.sub}: update fake.rb like
- + template/fake.rb.in.
- +
- +Thu Jan 9 14:05:24 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- +
- + * win32/Makefile.sub (fake.rb): should depend on version.h because
- + if RUBY_VERSION is updated, fake.rb need to say the new version
- + to avoid install error in rbconfig.rb.
- +
- +Thu Jan 9 08:21:00 2014 Aman Gupta <ruby@tmm1.net>
- +
- + * test/net/imap/cacert.pem: generate new CA cert, since the last one
- + expired. [Bug #9341] [ruby-core:59459]
- + * test/net/imap/server.crt: new server cert signed with updated CA.
- + * test/net/imap/Makefile: add `make regen_certs` to automate this
- + process.
- +
- +Thu Dec 26 03:28:11 2013 Koichi Sasada <ko1@atdot.net>
- +
- + * vm_insnhelper.c (argument_error): insert dummy frame to make
- + a backtrace object intead of modify backtrace string array.
- + [Bug #9295]
- +
- + * test/ruby/test_backtrace.rb: add a test for this patch.
- + fix test to compare a result of Exception#backtrace with
- + a result of Exception#backtrace_locations.
- +
- Wed Dec 25 16:58:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (rb_mod_define_method): consider visibility only if self
- diff --git a/NEWS b/NEWS
- index 59251a4..afd15fa 100644
- --- a/NEWS
- +++ b/NEWS
- @@ -114,6 +114,7 @@ with all sufficient information, see the ChangeLog file.
- * Process.clock_getres
-
- * String
- + * "literal".freeze is now optimized to return the same object
- * New methods:
- * String#scrub and String#scrub! verify and fix invalid byte sequence.
- If you want to use this function with older Ruby,
- @@ -133,6 +134,10 @@ with all sufficient information, see the ChangeLog file.
-
- === Core classes compatibility issues (excluding feature bug fixes)
-
- +* Dir
- + * incompatible changes:
- + * Dir#glob returns composed characters (previously Apple Modofied UTF-8).
- +
- * Hash
- * incompatible changes:
- * Hash#reject will return plain Hash object in the future versions, that
- @@ -250,7 +255,7 @@ String
- * REXML::Parsers::SAX2Parser
- * Fixes wrong number of arguments of entitydecl event. Document of the event
- says "an array of the entity declaration" but implementation passes two
- - or more arguments. It is an implementation bug but it breaks backword
- + or more arguments. It is an implementation bug but it breaks backward
- compatibility.
-
- * REXML::Parsers::StreamParser
- @@ -271,6 +276,8 @@ String
- * Improved, iterative resolver (compared to RubyGems 2.1 and earlier)
- * Support for a sharing a GEM_HOME across ruby platforms and versions
-
- + * Updated to 2.2.2. Fixes some minor bugs and performance regressions.
- +
- For a complete list of enhancements and bug fixes see:
- https://github.com/rubygems/rubygems/tree/master/History.txt
-
- diff --git a/array.c b/array.c
- index 45713c5..ff77a3e 100644
- --- a/array.c
- +++ b/array.c
- @@ -3904,7 +3904,9 @@ ary_add_hash(VALUE hash, VALUE ary)
-
- for (i=0; i<RARRAY_LEN(ary); i++) {
- VALUE elt = RARRAY_AREF(ary, i);
- - rb_hash_aset(hash, elt, elt);
- + if (rb_hash_lookup2(hash, elt, Qundef) == Qundef) {
- + rb_hash_aset(hash, elt, elt);
- + }
- }
- return hash;
- }
- diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb
- index 4282bc6..0a7cb0a 100644
- --- a/bootstraptest/test_method.rb
- +++ b/bootstraptest/test_method.rb
- @@ -957,8 +957,8 @@ assert_equal 'ok', %q{
-
- assert_normal_exit %q{
- begin
- - Process.setrlimit(Process::RLIMIT_STACK, 4_202_496)
- - # FreeBSD fails this less than 4M + 8K bytes.
- + Process.setrlimit(Process::RLIMIT_STACK, 4_206_592)
- + # FreeBSD SEGVs this less than 4M + 12K bytes.
- rescue Exception
- exit
- end
- diff --git a/configure.in b/configure.in
- index ea14b94..84f176d 100644
- --- a/configure.in
- +++ b/configure.in
- @@ -888,6 +888,7 @@ AC_ARG_WITH(winnt-ver,
- AS_CASE(["$target_os"],
- [mingw*], [
- RUBY_APPEND_OPTION(CPPFLAGS, -D_WIN32_WINNT=$with_winnt_ver)
- + RUBY_APPEND_OPTION(CPPFLAGS, -D__MINGW_USE_VC2005_COMPAT)
- ])
-
- AS_CASE(["$target_os"],
- @@ -1040,6 +1041,7 @@ main()
- if test x"$ac_cv_type_NET_LUID" = xyes; then
- AC_DEFINE(HAVE_TYPE_NET_LUID, 1)
- fi
- + AC_CHECK_FUNCS(_gmtime64_s)
- AC_LIBOBJ([langinfo])
- ],
- [os2-emx*], [ LIBS="-lm $LIBS"
- @@ -2656,7 +2658,7 @@ if test "$with_dln_a_out" != yes; then
- : ${LDSHARED='$(CC) -shared'}
- if test "$rb_cv_binary_elf" = yes; then
- LDFLAGS="$LDFLAGS -rdynamic"
- - DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$(.TARGET)'
- + DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$@'
- else
- test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED='$(LD) -Bshareable'
- fi
- diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
- index e0b7c01..8537817 100644
- --- a/ext/bigdecimal/bigdecimal.c
- +++ b/ext/bigdecimal/bigdecimal.c
- @@ -1221,8 +1221,10 @@ BigDecimal_divide(Real **c, Real **res, Real **div, VALUE self, VALUE r)
-
- *div = b;
- mx = a->Prec + vabs(a->exponent);
- - if (mx<b->Prec + vabs(b->exponent)) mx = b->Prec + vabs(b->exponent);
- - mx =(mx + 1) * VpBaseFig();
- + if (mx < b->Prec + vabs(b->exponent)) mx = b->Prec + vabs(b->exponent);
- + mx++; /* NOTE: An additional digit is needed for the compatibility to
- + the version 1.2.1 and the former. */
- + mx = (mx + 1) * VpBaseFig();
- GUARD_OBJ((*c), VpCreateRbObject(mx, "#0"));
- GUARD_OBJ((*res), VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
- VpDivd(*c, *res, a, b);
- diff --git a/ext/bigdecimal/bigdecimal.gemspec b/ext/bigdecimal/bigdecimal.gemspec
- index 676e05b..7be9d72 100644
- --- a/ext/bigdecimal/bigdecimal.gemspec
- +++ b/ext/bigdecimal/bigdecimal.gemspec
- @@ -1,5 +1,5 @@
- # -*- ruby -*-
- -_VERSION = "1.2.3"
- +_VERSION = "1.2.4"
- date = %w$Date:: $[1]
-
- Gem::Specification.new do |s|
- diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
- index ec71350..206470c 100644
- --- a/ext/openssl/ossl_ssl.c
- +++ b/ext/openssl/ossl_ssl.c
- @@ -2229,7 +2229,9 @@ Init_ossl_ssl()
- ossl_ssl_def_const(OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG);
- ossl_ssl_def_const(OP_SSLREF2_REUSE_CERT_TYPE_BUG);
- ossl_ssl_def_const(OP_MICROSOFT_BIG_SSLV3_BUFFER);
- +#if defined(SSL_OP_MSIE_SSLV2_RSA_PADDING)
- ossl_ssl_def_const(OP_MSIE_SSLV2_RSA_PADDING);
- +#endif
- ossl_ssl_def_const(OP_SSLEAY_080_CLIENT_DH_BUG);
- ossl_ssl_def_const(OP_TLS_D5_BUG);
- ossl_ssl_def_const(OP_TLS_BLOCK_PADDING_BUG);
- diff --git a/ext/socket/rubysocket.h b/ext/socket/rubysocket.h
- index 97c02fc..c74fb32 100644
- --- a/ext/socket/rubysocket.h
- +++ b/ext/socket/rubysocket.h
- @@ -374,6 +374,12 @@ void rsock_init_sockopt(void);
- void rsock_init_sockifaddr(void);
- void rsock_init_socket_init(void);
-
- +NORETURN(void rsock_syserr_fail_host_port(int err, const char *, VALUE, VALUE));
- +NORETURN(void rsock_syserr_fail_path(int err, const char *, VALUE));
- +NORETURN(void rsock_syserr_fail_sockaddr(int err, const char *mesg, struct sockaddr *addr, socklen_t len));
- +NORETURN(void rsock_syserr_fail_raddrinfo(int err, const char *mesg, VALUE rai));
- +NORETURN(void rsock_syserr_fail_raddrinfo_or_sockaddr(int err, const char *mesg, VALUE addr, VALUE rai));
- +
- NORETURN(void rsock_sys_fail_host_port(const char *, VALUE, VALUE));
- NORETURN(void rsock_sys_fail_path(const char *, VALUE));
- NORETURN(void rsock_sys_fail_sockaddr(const char *, struct sockaddr *addr, socklen_t len));
- diff --git a/ext/socket/socket.c b/ext/socket/socket.c
- index 5fd7465..c7fc5b7 100644
- --- a/ext/socket/socket.c
- +++ b/ext/socket/socket.c
- @@ -15,6 +15,12 @@ static VALUE sock_s_unpack_sockaddr_in(VALUE, VALUE);
- void
- rsock_sys_fail_host_port(const char *mesg, VALUE host, VALUE port)
- {
- + rsock_syserr_fail_host_port(errno, mesg, host, port);
- +}
- +
- +void
- +rsock_syserr_fail_host_port(int err, const char *mesg, VALUE host, VALUE port)
- +{
- VALUE message;
-
- port = rb_String(port);
- @@ -22,13 +28,20 @@ rsock_sys_fail_host_port(const char *mesg, VALUE host, VALUE port)
- message = rb_sprintf("%s for \"%s\" port %s",
- mesg, StringValueCStr(host), StringValueCStr(port));
-
- - rb_sys_fail_str(message);
- + rb_syserr_fail_str(err, message);
- }
-
- void
- rsock_sys_fail_path(const char *mesg, VALUE path)
- {
- + rsock_syserr_fail_path(errno, mesg, path);
- +}
- +
- +void
- +rsock_syserr_fail_path(int err, const char *mesg, VALUE path)
- +{
- VALUE message;
- +
- if (RB_TYPE_P(path, T_STRING)) {
- if (memchr(RSTRING_PTR(path), '\0', RSTRING_LEN(path))) {
- path = rb_str_inspect(path);
- @@ -39,45 +52,64 @@ rsock_sys_fail_path(const char *mesg, VALUE path)
- message = rb_sprintf("%s for \"%s\"", mesg,
- StringValueCStr(path));
- }
- - rb_sys_fail_str(message);
- + rb_syserr_fail_str(err, message);
- }
- else {
- - rb_sys_fail(mesg);
- + rb_syserr_fail(err, mesg);
- }
- }
-
- void
- rsock_sys_fail_sockaddr(const char *mesg, struct sockaddr *addr, socklen_t len)
- {
- + rsock_syserr_fail_sockaddr(errno, mesg, addr, len);
- +}
- +
- +void
- +rsock_syserr_fail_sockaddr(int err, const char *mesg, struct sockaddr *addr, socklen_t len)
- +{
- VALUE rai;
-
- rai = rsock_addrinfo_new(addr, len, PF_UNSPEC, 0, 0, Qnil, Qnil);
-
- - rsock_sys_fail_raddrinfo(mesg, rai);
- + rsock_syserr_fail_raddrinfo(err, mesg, rai);
- }
-
- void
- rsock_sys_fail_raddrinfo(const char *mesg, VALUE rai)
- {
- + rsock_syserr_fail_raddrinfo(errno, mesg, rai);
- +}
- +
- +void
- +rsock_syserr_fail_raddrinfo(int err, const char *mesg, VALUE rai)
- +{
- VALUE str, message;
-
- str = rsock_addrinfo_inspect_sockaddr(rai);
- message = rb_sprintf("%s for %s", mesg, StringValueCStr(str));
-
- - rb_sys_fail_str(message);
- + rb_syserr_fail_str(err, message);
- }
-
- void
- rsock_sys_fail_raddrinfo_or_sockaddr(const char *mesg, VALUE addr, VALUE rai)
- {
- + rsock_syserr_fail_raddrinfo_or_sockaddr(errno, mesg, addr, rai);
- +}
- +
- +void
- +rsock_syserr_fail_raddrinfo_or_sockaddr(int err, const char *mesg, VALUE addr, VALUE rai)
- +{
- if (NIL_P(rai)) {
- StringValue(addr);
- - rsock_sys_fail_sockaddr(mesg,
- +
- + rsock_syserr_fail_sockaddr(err, mesg,
- (struct sockaddr *)RSTRING_PTR(addr),
- (socklen_t)RSTRING_LEN(addr)); /* overflow should be checked already */
- }
- else
- - rsock_sys_fail_raddrinfo(mesg, rai);
- + rsock_syserr_fail_raddrinfo(err, mesg, rai);
- }
-
- static void
- diff --git a/ext/thread/thread.c b/ext/thread/thread.c
- index b8be5d8..a8f675c 100644
- --- a/ext/thread/thread.c
- +++ b/ext/thread/thread.c
- @@ -437,7 +437,7 @@ rb_szqueue_max_set(VALUE self, VALUE vmax)
- diff = max - GET_SZQUEUE_ULONGMAX(self);
- }
- RSTRUCT_SET(self, SZQUEUE_MAX, vmax);
- - while (diff > 0 && !NIL_P(t = rb_ary_shift(GET_QUEUE_QUE(self)))) {
- + while (diff-- > 0 && !NIL_P(t = rb_ary_shift(GET_SZQUEUE_WAITERS(self)))) {
- rb_thread_wakeup_alive(t);
- }
- return vmax;
- @@ -459,7 +459,7 @@ static VALUE
- rb_szqueue_push(VALUE self, VALUE obj)
- {
- struct waiting_delete args;
- - args.waiting = GET_QUEUE_WAITERS(self);
- + args.waiting = GET_SZQUEUE_WAITERS(self);
- args.th = rb_thread_current();
-
- while (queue_length(self) >= GET_SZQUEUE_ULONGMAX(self)) {
- diff --git a/gc.c b/gc.c
- index 19e942d..e51b727 100644
- --- a/gc.c
- +++ b/gc.c
- @@ -2916,7 +2916,9 @@ gc_before_sweep(rb_objspace_t *objspace)
- }
- }
-
- - if (0) fprintf(stderr, "%d\t%d\t%u\t%u\t%d\n", (int)rb_gc_count(), objspace->rgengc.need_major_gc,
- + if (0) fprintf(stderr, "%d\t%d\t%u\t%u\t%d\n",
- + (int)rb_gc_count(),
- + (int)objspace->rgengc.need_major_gc,
- (unsigned int)objspace->rgengc.oldmalloc_increase,
- (unsigned int)objspace->rgengc.oldmalloc_increase_limit,
- (unsigned int)gc_params.oldmalloc_limit_max);
- @@ -5647,7 +5649,7 @@ get_envparam_int(const char *name, unsigned int *default_value, int lower_bound)
-
- if (ptr != NULL) {
- val = atoi(ptr);
- - if (val > lower_bound) {
- + if (val >= lower_bound) {
- if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%d (%d)\n", name, val, *default_value);
- *default_value = val;
- return 1;
- @@ -5667,7 +5669,7 @@ get_envparam_double(const char *name, double *default_value, double lower_bound)
-
- if (ptr != NULL) {
- val = strtod(ptr, NULL);
- - if (val > lower_bound) {
- + if (val >= lower_bound) {
- if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%f (%f)\n", name, val, *default_value);
- *default_value = val;
- return 1;
- @@ -5746,7 +5748,10 @@ ruby_gc_set_params(int safe_level)
- get_envparam_double("RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR", &gc_params.malloc_limit_growth_factor, 1.0);
-
- #ifdef RGENGC_ESTIMATE_OLDMALLOC
- - get_envparam_int("RUBY_GC_OLDMALLOC_LIMIT", &gc_params.oldmalloc_limit_min, 0);
- + if (get_envparam_int("RUBY_GC_OLDMALLOC_LIMIT", &gc_params.oldmalloc_limit_min, 0)) {
- + rb_objspace_t *objspace = &rb_objspace;
- + objspace->rgengc.oldmalloc_increase_limit = gc_params.oldmalloc_limit_min;
- + }
- get_envparam_int("RUBY_GC_OLDMALLOC_LIMIT_MAX", &gc_params.oldmalloc_limit_max, 0);
- get_envparam_double("RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR", &gc_params.oldmalloc_limit_growth_factor, 1.0);
- #endif
- diff --git a/hash.c b/hash.c
- index 1fa40b1..1c285c2 100644
- --- a/hash.c
- +++ b/hash.c
- @@ -27,12 +27,24 @@
- # endif
- #endif
-
- -#define HAS_MISC_ATTRIBUTES(hash, klass) ( \
- - (klass = rb_obj_class(hash)) != rb_cHash || \
- - (klass = 0, \
- - FL_TEST((hash), FL_EXIVAR|FL_TAINT|HASH_PROC_DEFAULT) || \
- - !NIL_P(RHASH_IFNONE(hash))))
- -#define HASH_REJECT_COPY_MISC_ATTRIBUTES 1
- +#define HAS_EXTRA_STATES(hash, klass) ( \
- + ((klass = has_extra_methods(rb_obj_class(hash))) != 0) || \
- + FL_TEST((hash), FL_EXIVAR|FL_TAINT|HASH_PROC_DEFAULT) || \
- + !NIL_P(RHASH_IFNONE(hash)))
- +#define HASH_REJECT_COPY_EXTRA_STATES 1
- +
- +static VALUE
- +has_extra_methods(VALUE klass)
- +{
- + const VALUE base = rb_cHash;
- + VALUE c = klass;
- + while (c != base) {
- + st_table *mtbl = RCLASS_M_TBL(c);
- + if (mtbl && mtbl->num_entries) return klass;
- + c = RCLASS_SUPER(c);
- + }
- + return 0;
- +}
-
- static VALUE rb_hash_s_try_convert(VALUE, VALUE);
-
- @@ -111,6 +123,8 @@ rb_hash(VALUE obj)
- return hval;
- }
-
- +long rb_objid_hash(st_index_t index);
- +
- static st_index_t
- rb_any_hash(VALUE a)
- {
- @@ -119,9 +133,7 @@ rb_any_hash(VALUE a)
-
- if (SPECIAL_CONST_P(a)) {
- if (a == Qundef) return 0;
- - hnum = rb_hash_start((st_index_t)a);
- - hnum = rb_hash_uint(hnum, (st_index_t)rb_any_hash);
- - hnum = rb_hash_end(hnum);
- + hnum = rb_objid_hash((st_index_t)a);
- }
- else if (BUILTIN_TYPE(a) == T_STRING) {
- hnum = rb_str_hash(a);
- @@ -134,6 +146,15 @@ rb_any_hash(VALUE a)
- return (st_index_t)RSHIFT(hnum, 1);
- }
-
- +long
- +rb_objid_hash(st_index_t index)
- +{
- + st_index_t hnum = rb_hash_start(index);
- + hnum = rb_hash_uint(hnum, (st_index_t)rb_any_hash);
- + hnum = rb_hash_end(hnum);
- + return hnum;
- +}
- +
- static const struct st_hash_type objhash = {
- rb_any_cmp,
- rb_any_hash,
- @@ -1133,11 +1154,11 @@ rb_hash_reject(VALUE hash)
- RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
- if (RTEST(ruby_verbose)) {
- VALUE klass;
- - if (HAS_MISC_ATTRIBUTES(hash, klass)) {
- -#if HASH_REJECT_COPY_MISC_ATTRIBUTES
- - rb_warn("copying unguaranteed attributes: %+"PRIsVALUE, hash);
- - rb_warn("following atributes will not be copied in the future version:");
- - if (klass != rb_cHash) {
- + if (HAS_EXTRA_STATES(hash, klass)) {
- +#if HASH_REJECT_COPY_EXTRA_STATES
- + rb_warn("copying extra states: %+"PRIsVALUE, hash);
- + rb_warn("following states will not be copied in the future version:");
- + if (klass) {
- rb_warn(" subclass: %+"PRIsVALUE, klass);
- }
- if (FL_TEST(hash, FL_EXIVAR)) {
- @@ -1153,8 +1174,7 @@ rb_hash_reject(VALUE hash)
- else if (!NIL_P(RHASH_IFNONE(hash)))
- rb_warn(" default value: %+"PRIsVALUE, RHASH_IFNONE(hash));
- #else
- - rb_warn("unguaranteed attributes are not copied: %+"PRIsVALUE, hash);
- - rb_warn("following atributes are ignored now:");
- + rb_warn("extra states are no longer copied: %+"PRIsVALUE, hash);
- #endif
- }
- }
- diff --git a/lib/delegate.rb b/lib/delegate.rb
- index c33f7e4..d790229 100644
- --- a/lib/delegate.rb
- +++ b/lib/delegate.rb
- @@ -48,7 +48,7 @@ class Delegator < BasicObject
- undef_method m
- end
- private_instance_methods.each do |m|
- - if /\Ablock_given\?\z|iterator\?\z|\A__raise__\z/ =~ m
- + if /\Ablock_given\?\z|iterator\?\z|\A__.*__\z/ =~ m
- next
- end
- undef_method m
- diff --git a/lib/rubygems.rb b/lib/rubygems.rb
- index 73c4846..456273e 100644
- --- a/lib/rubygems.rb
- +++ b/lib/rubygems.rb
- @@ -8,7 +8,7 @@
- require 'rbconfig'
-
- module Gem
- - VERSION = '2.2.0'
- + VERSION = '2.2.2'
- end
-
- # Must be first since it unloads the prelude from 1.9.2
- @@ -572,7 +572,7 @@ module Gem
- # gem's paths are inserted before site lib directory by default.
-
- def self.load_path_insert_index
- - index = $LOAD_PATH.index ConfigMap[:sitelibdir]
- + index = $LOAD_PATH.index RbConfig::CONFIG['sitelibdir']
-
- index
- end
- @@ -743,8 +743,8 @@ module Gem
- def self.prefix
- prefix = File.dirname RUBYGEMS_DIR
-
- - if prefix != File.expand_path(ConfigMap[:sitelibdir]) and
- - prefix != File.expand_path(ConfigMap[:libdir]) and
- + if prefix != File.expand_path(RbConfig::CONFIG['sitelibdir']) and
- + prefix != File.expand_path(RbConfig::CONFIG['libdir']) and
- 'lib' == File.basename(RUBYGEMS_DIR) then
- prefix
- end
- @@ -765,6 +765,10 @@ module Gem
- f.flock(File::LOCK_EX)
- f.read
- end
- + rescue Errno::EACCES
- + open path, 'rb' do |f|
- + f.read
- + end
- end
-
- ##
- @@ -772,8 +776,8 @@ module Gem
-
- def self.ruby
- if @ruby.nil? then
- - @ruby = File.join(ConfigMap[:bindir],
- - "#{ConfigMap[:ruby_install_name]}#{ConfigMap[:EXEEXT]}")
- + @ruby = File.join(RbConfig::CONFIG['bindir'],
- + "#{RbConfig::CONFIG['ruby_install_name']}#{RbConfig::CONFIG['EXEEXT']}")
-
- @ruby = "\"#{@ruby}\"" if @ruby =~ /\s/
- end
- @@ -785,8 +789,7 @@ module Gem
- # Returns a String containing the API compatibility version of Ruby
-
- def self.ruby_api_version
- - @ruby_api_version ||=
- - "#{ConfigMap[:MAJOR]}.#{ConfigMap[:MINOR]}.#{ConfigMap[:TEENY]}"
- + @ruby_api_version ||= RbConfig::CONFIG['ruby_version'].dup
- end
-
- ##
- diff --git a/lib/rubygems/available_set.rb b/lib/rubygems/available_set.rb
- index d8655af..fabdd6e 100644
- --- a/lib/rubygems/available_set.rb
- +++ b/lib/rubygems/available_set.rb
- @@ -4,9 +4,12 @@ class Gem::AvailableSet
-
- Tuple = Struct.new(:spec, :source)
-
- + attr_accessor :remote # :nodoc:
- +
- def initialize
- @set = []
- @sorted = nil
- + @remote = true
- end
-
- attr_reader :set
- diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
- index a52377f..470a6eb 100644
- --- a/lib/rubygems/basic_specification.rb
- +++ b/lib/rubygems/basic_specification.rb
- @@ -207,6 +207,24 @@ class Gem::BasicSpecification
- end
-
- ##
- + # Returns the paths to the source files for use with analysis and
- + # documentation tools. These paths are relative to full_gem_path.
- +
- + def source_paths
- + paths = raw_require_paths.dup
- +
- + if @extensions then
- + ext_dirs = @extensions.map do |extension|
- + extension.split(File::SEPARATOR, 2).first
- + end.uniq
- +
- + paths.concat ext_dirs
- + end
- +
- + paths.uniq
- + end
- +
- + ##
- # Return a Gem::Specification from this gem
-
- def to_spec
- diff --git a/lib/rubygems/commands/contents_command.rb b/lib/rubygems/commands/contents_command.rb
- index 9721884..603f1d0 100644
- --- a/lib/rubygems/commands/contents_command.rb
- +++ b/lib/rubygems/commands/contents_command.rb
- @@ -94,11 +94,11 @@ prefix or only the files that are requireable.
- spec.files.sort.map do |file|
- case file
- when /\A#{spec.bindir}\//
- - [Gem::ConfigMap[:bindir], $POSTMATCH]
- + [RbConfig::CONFIG['bindir'], $POSTMATCH]
- when /\.so\z/
- - [Gem::ConfigMap[:archdir], file]
- + [RbConfig::CONFIG['archdir'], file]
- else
- - [Gem::ConfigMap[:rubylibdir], file]
- + [RbConfig::CONFIG['rubylibdir'], file]
- end
- end
- end
- diff --git a/lib/rubygems/commands/generate_index_command.rb b/lib/rubygems/commands/generate_index_command.rb
- index a7db013..ca6f694 100644
- --- a/lib/rubygems/commands/generate_index_command.rb
- +++ b/lib/rubygems/commands/generate_index_command.rb
- @@ -62,7 +62,7 @@ Marshal::MINOR_VERSION constants. It is used to ensure compatibility.
- end
-
- def execute
- - # This is always true becasue it's the only way now.
- + # This is always true because it's the only way now.
- options[:build_modern] = true
-
- if not File.exist?(options[:directory]) or
- diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
- index 4485eb1..8219eef 100644
- --- a/lib/rubygems/commands/install_command.rb
- +++ b/lib/rubygems/commands/install_command.rb
- @@ -228,7 +228,18 @@ to write the specification by hand. For example:
- def install_gem_without_dependencies name, req # :nodoc:
- gem = nil
-
- - if remote? then
- + if local? then
- + if name =~ /\.gem$/ and File.file? name then
- + source = Gem::Source::SpecificFile.new name
- + spec = source.spec
- + else
- + source = Gem::Source::Local.new
- + spec = source.find_gem name, req
- + end
- + gem = source.download spec if spec
- + end
- +
- + if remote? and not gem then
- dependency = Gem::Dependency.new name, req
- dependency.prerelease = options[:prerelease]
-
- @@ -236,13 +247,6 @@ to write the specification by hand. For example:
- gem = fetcher.download_to_cache dependency
- end
-
- - if local? and not gem then
- - source = Gem::Source::Local.new
- - spec = source.find_gem name, req
- -
- - gem = source.download spec
- - end
- -
- inst = Gem::Installer.new gem, options
- inst.install
-
- diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
- index face77f..681db0d 100644
- --- a/lib/rubygems/commands/setup_command.rb
- +++ b/lib/rubygems/commands/setup_command.rb
- @@ -13,7 +13,7 @@ class Gem::Commands::SetupCommand < Gem::Command
-
- super 'setup', 'Install RubyGems',
- :format_executable => true, :document => %w[ri],
- - :site_or_vendor => :sitelibdir,
- + :site_or_vendor => 'sitelibdir',
- :destdir => '', :prefix => '', :previous_version => ''
-
- add_option '--previous-version=VERSION',
- @@ -36,7 +36,7 @@ class Gem::Commands::SetupCommand < Gem::Command
-
- add_option '--[no-]vendor',
- 'Install into vendorlibdir not sitelibdir' do |vendor, options|
- - options[:site_or_vendor] = vendor ? :vendorlibdir : :sitelibdir
- + options[:site_or_vendor] = vendor ? 'vendorlibdir' : 'sitelibdir'
- end
-
- add_option '--[no-]format-executable',
- @@ -343,19 +343,19 @@ TEXT
- site_or_vendor = options[:site_or_vendor]
-
- if prefix.empty? then
- - lib_dir = Gem::ConfigMap[site_or_vendor]
- - bin_dir = Gem::ConfigMap[:bindir]
- + lib_dir = RbConfig::CONFIG[site_or_vendor]
- + bin_dir = RbConfig::CONFIG['bindir']
- else
- # Apple installed RubyGems into libdir, and RubyGems <= 1.1.0 gets
- # confused about installation location, so switch back to
- # sitelibdir/vendorlibdir.
- if defined?(APPLE_GEM_HOME) and
- # just in case Apple and RubyGems don't get this patched up proper.
- - (prefix == Gem::ConfigMap[:libdir] or
- + (prefix == RbConfig::CONFIG['libdir'] or
- # this one is important
- - prefix == File.join(Gem::ConfigMap[:libdir], 'ruby')) then
- - lib_dir = Gem::ConfigMap[site_or_vendor]
- - bin_dir = Gem::ConfigMap[:bindir]
- + prefix == File.join(RbConfig::CONFIG['libdir'], 'ruby')) then
- + lib_dir = RbConfig::CONFIG[site_or_vendor]
- + bin_dir = RbConfig::CONFIG['bindir']
- else
- lib_dir = File.join prefix, 'lib'
- bin_dir = File.join prefix, 'bin'
- diff --git a/lib/rubygems/compatibility.rb b/lib/rubygems/compatibility.rb
- index 5e8618f..d06ade1 100644
- --- a/lib/rubygems/compatibility.rb
- +++ b/lib/rubygems/compatibility.rb
- @@ -33,6 +33,8 @@ end
- module Gem
- RubyGemsVersion = VERSION
-
- + # TODO remove at RubyGems 3
- +
- RbConfigPriorities = %w[
- MAJOR
- MINOR
- @@ -45,7 +47,7 @@ module Gem
- unless defined?(ConfigMap)
- ##
- # Configuration settings from ::RbConfig
- - ConfigMap = Hash.new do |cm, key|
- + ConfigMap = Hash.new do |cm, key| # TODO remove at RubyGems 3
- cm[key] = RbConfig::CONFIG[key.to_s]
- end
- else
- diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb
- index 1acae9b..cf14017 100644
- --- a/lib/rubygems/config_file.rb
- +++ b/lib/rubygems/config_file.rb
- @@ -137,9 +137,10 @@ class Gem::ConfigFile
- attr_reader :ssl_verify_mode
-
- ##
- - # Path name of directory or file of openssl CA certificate, used for remote https connection
- + # Path name of directory or file of openssl CA certificate, used for remote
- + # https connection
-
- - attr_reader :ssl_ca_cert
- + attr_accessor :ssl_ca_cert
-
- ##
- # Path name of directory or file of openssl client certificate, used for remote https connection with client authentication
- diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
- index 715c0b7..6924f48 100644
- --- a/lib/rubygems/defaults.rb
- +++ b/lib/rubygems/defaults.rb
- @@ -29,22 +29,22 @@ module Gem
- def self.default_dir
- path = if defined? RUBY_FRAMEWORK_VERSION then
- [
- - File.dirname(ConfigMap[:sitedir]),
- + File.dirname(RbConfig::CONFIG['sitedir']),
- 'Gems',
- - ConfigMap[:ruby_version]
- + RbConfig::CONFIG['ruby_version']
- ]
- - elsif ConfigMap[:rubylibprefix] then
- + elsif RbConfig::CONFIG['rubylibprefix'] then
- [
- - ConfigMap[:rubylibprefix],
- + RbConfig::CONFIG['rubylibprefix'],
- 'gems',
- - ConfigMap[:ruby_version]
- + RbConfig::CONFIG['ruby_version']
- ]
- else
- [
- - ConfigMap[:libdir],
- + RbConfig::CONFIG['libdir'],
- ruby_engine,
- 'gems',
- - ConfigMap[:ruby_version]
- + RbConfig::CONFIG['ruby_version']
- ]
- end
-
- @@ -74,7 +74,7 @@ module Gem
-
- def self.user_dir
- parts = [Gem.user_home, '.gem', ruby_engine]
- - parts << ConfigMap[:ruby_version] unless ConfigMap[:ruby_version].empty?
- + parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
- File.join parts
- end
-
- @@ -100,7 +100,7 @@ module Gem
- # Deduce Ruby's --program-prefix and --program-suffix from its install name
-
- def self.default_exec_format
- - exec_format = ConfigMap[:ruby_install_name].sub('ruby', '%s') rescue '%s'
- + exec_format = RbConfig::CONFIG['ruby_install_name'].sub('ruby', '%s') rescue '%s'
-
- unless exec_format =~ /%s/ then
- raise Gem::Exception,
- @@ -117,7 +117,7 @@ module Gem
- if defined? RUBY_FRAMEWORK_VERSION then # mac framework support
- '/usr/bin'
- else # generic install
- - ConfigMap[:bindir]
- + RbConfig::CONFIG['bindir']
- end
- end
-
- diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
- index b7babf6..da6994a 100644
- --- a/lib/rubygems/dependency_installer.rb
- +++ b/lib/rubygems/dependency_installer.rb
- @@ -419,6 +419,7 @@ class Gem::DependencyInstaller
-
- request_set = as.to_request_set install_development_deps
- request_set.soft_missing = @force
- + request_set.remote = false unless consider_remote?
-
- installer_set = Gem::Resolver::InstallerSet.new @domain
- installer_set.always_install.concat request_set.always_install
- diff --git a/lib/rubygems/deprecate.rb b/lib/rubygems/deprecate.rb
- index 274d6a5..e19360d 100644
- --- a/lib/rubygems/deprecate.rb
- +++ b/lib/rubygems/deprecate.rb
- @@ -50,7 +50,7 @@ module Gem::Deprecate
- class_eval {
- old = "_deprecated_#{name}"
- alias_method old, name
- - define_method name do |*args, &block| # TODO: really works on 1.8.7?
- + define_method name do |*args, &block|
- klass = self.kind_of? Module
- target = klass ? "#{self}." : "#{self.class}#"
- msg = [ "NOTE: #{target}#{name} is deprecated",
- diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb
- index 402aa96..990fd18 100644
- --- a/lib/rubygems/ext/ext_conf_builder.rb
- +++ b/lib/rubygems/ext/ext_conf_builder.rb
- @@ -34,7 +34,11 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
- ENV["RUBYOPT"] = ["-r#{siteconf_path}", rubyopt].compact.join(' ')
- cmd = [Gem.ruby, File.basename(extension), *args].join ' '
-
- - run cmd, results
- + begin
- + run cmd, results
- + ensure
- + FileUtils.mv 'mkmf.log', dest_path if File.exist? 'mkmf.log'
- + end
-
- ENV["DESTDIR"] = nil
- ENV["RUBYOPT"] = rubyopt
- diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
- index f8eb2c2..c809816 100644
- --- a/lib/rubygems/installer.rb
- +++ b/lib/rubygems/installer.rb
- @@ -480,7 +480,7 @@ class Gem::Installer
- #
-
- def shebang(bin_file_name)
- - ruby_name = Gem::ConfigMap[:ruby_install_name] if @env_shebang
- + ruby_name = RbConfig::CONFIG['ruby_install_name'] if @env_shebang
- path = File.join gem_dir, spec.bindir, bin_file_name
- first_line = File.open(path, "rb") {|file| file.gets}
-
- @@ -493,7 +493,7 @@ class Gem::Installer
-
- if which = Gem.configuration[:custom_shebang]
- # replace bin_file_name with "ruby" to avoid endless loops
- - which = which.gsub(/ #{bin_file_name}$/," #{Gem::ConfigMap[:ruby_install_name]}")
- + which = which.gsub(/ #{bin_file_name}$/," #{RbConfig::CONFIG['ruby_install_name']}")
-
- which = which.gsub(/\$(\w+)/) do
- case $1
- @@ -641,7 +641,7 @@ version = "#{Gem::Requirement.default}"
- if ARGV.first
- str = ARGV.first
- str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
- - if str =~ /\\A_(.*)_\\z/
- + if str =~ /\\A_(.*)_\\z/ and Gem::Version.correct?($1) then
- version = $1
- ARGV.shift
- end
- diff --git a/lib/rubygems/package/tar_header.rb b/lib/rubygems/package/tar_header.rb
- index 28da1db..f9ab13a 100644
- --- a/lib/rubygems/package/tar_header.rb
- +++ b/lib/rubygems/package/tar_header.rb
- @@ -134,7 +134,7 @@ class Gem::Package::TarHeader
- vals[:gid] ||= 0
- vals[:mtime] ||= 0
- vals[:checksum] ||= ""
- - vals[:typeflag] ||= "0"
- + vals[:typeflag] = "0" if vals[:typeflag].nil? || vals[:typeflag].empty?
- vals[:magic] ||= "ustar"
- vals[:version] ||= "00"
- vals[:uname] ||= "wheel"
- diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
- index e050959..1bcd754 100644
- --- a/lib/rubygems/platform.rb
- +++ b/lib/rubygems/platform.rb
- @@ -16,7 +16,7 @@ class Gem::Platform
- attr_accessor :version
-
- def self.local
- - arch = Gem::ConfigMap[:arch]
- + arch = RbConfig::CONFIG['arch']
- arch = "#{arch}_60" if arch =~ /mswin32$/
- @local ||= new(arch)
- end
- diff --git a/lib/rubygems/rdoc.rb b/lib/rubygems/rdoc.rb
- index 52249dc..633bd89 100644
- --- a/lib/rubygems/rdoc.rb
- +++ b/lib/rubygems/rdoc.rb
- @@ -193,7 +193,7 @@ class Gem::RDoc # :nodoc: all
- ::RDoc::Parser::C.reset
-
- args = @spec.rdoc_options
- - args.concat @spec.require_paths
- + args.concat @spec.source_paths
- args.concat @spec.extra_rdoc_files
-
- case config_args = Gem.configuration[:rdoc]
- diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
- index e32c024..58991ca 100644
- --- a/lib/rubygems/remote_fetcher.rb
- +++ b/lib/rubygems/remote_fetcher.rb
- @@ -131,11 +131,19 @@ class Gem::RemoteFetcher
-
- FileUtils.mkdir_p cache_dir rescue nil unless File.exist? cache_dir
-
- - # Always escape URI's to deal with potential spaces and such
- - unless URI::Generic === source_uri
- - source_uri = URI.parse(URI.const_defined?(:DEFAULT_PARSER) ?
- - URI::DEFAULT_PARSER.escape(source_uri.to_s) :
- - URI.escape(source_uri.to_s))
- + # Always escape URI's to deal with potential spaces and such
- + # It should also be considered that source_uri may already be
- + # a valid URI with escaped characters. e.g. "{DESede}" is encoded
- + # as "%7BDESede%7D". If this is escaped again the percentage
- + # symbols will be escaped.
- + unless source_uri.is_a?(URI::Generic)
- + begin
- + source_uri = URI.parse(source_uri)
- + rescue
- + source_uri = URI.parse(URI.const_defined?(:DEFAULT_PARSER) ?
- + URI::DEFAULT_PARSER.escape(source_uri.to_s) :
- + URI.escape(source_uri.to_s))
- + end
- end
-
- scheme = source_uri.scheme
- @@ -285,20 +293,20 @@ class Gem::RemoteFetcher
- def cache_update_path uri, path = nil, update = true
- mtime = path && File.stat(path).mtime rescue nil
-
- - if mtime && Net::HTTPNotModified === fetch_path(uri, mtime, true)
- - Gem.read_binary(path)
- - else
- - data = fetch_path(uri)
- + data = fetch_path(uri, mtime)
-
- - if update and path then
- - open(path, 'wb') do |io|
- - io.flock(File::LOCK_EX)
- - io.write data
- - end
- - end
- + if data == nil # indicates the server returned 304 Not Modified
- + return Gem.read_binary(path)
- + end
-
- - data
- + if update and path
- + open(path, 'wb') do |io|
- + io.flock(File::LOCK_EX)
- + io.write data
- + end
- end
- +
- + data
- end
-
- ##
- diff --git a/lib/rubygems/request.rb b/lib/rubygems/request.rb
- index e870763..d2f076f 100644
- --- a/lib/rubygems/request.rb
- +++ b/lib/rubygems/request.rb
- @@ -48,15 +48,14 @@ class Gem::Request
- connection.key = OpenSSL::PKey::RSA.new pem
- end
-
- + store.set_default_paths
- + add_rubygems_trusted_certs(store)
- if Gem.configuration.ssl_ca_cert
- if File.directory? Gem.configuration.ssl_ca_cert
- store.add_path Gem.configuration.ssl_ca_cert
- else
- store.add_file Gem.configuration.ssl_ca_cert
- end
- - else
- - store.set_default_paths
- - add_rubygems_trusted_certs(store)
- end
- connection.cert_store = store
- rescue LoadError => e
- @@ -106,7 +105,8 @@ class Gem::Request
- request = @request_class.new @uri.request_uri
-
- unless @uri.nil? || @uri.user.nil? || @uri.user.empty? then
- - request.basic_auth @uri.user, @uri.password
- + request.basic_auth Gem::UriFormatter.new(@uri.user).unescape,
- + Gem::UriFormatter.new(@uri.password).unescape
- end
-
- request.add_field 'User-Agent', @user_agent
- diff --git a/lib/rubygems/request_set.rb b/lib/rubygems/request_set.rb
- index aa3f27c..fb54e34 100644
- --- a/lib/rubygems/request_set.rb
- +++ b/lib/rubygems/request_set.rb
- @@ -39,6 +39,11 @@ class Gem::RequestSet
- attr_accessor :ignore_dependencies
-
- ##
- + # When false no remote sets are used for resolving gems.
- +
- + attr_accessor :remote
- +
- + ##
- # Sets used for resolution
-
- attr_reader :sets # :nodoc:
- @@ -71,6 +76,7 @@ class Gem::RequestSet
- @git_set = nil
- @ignore_dependencies = false
- @install_dir = Gem.dir
- + @remote = true
- @requests = []
- @sets = []
- @soft_missing = false
- @@ -150,6 +156,7 @@ class Gem::RequestSet
- gemdeps = options[:gemdeps]
-
- @install_dir = options[:install_dir] || Gem.dir
- + @remote = options[:domain] != :local
-
- load_gemdeps gemdeps, options[:without_groups]
-
- @@ -235,6 +242,7 @@ class Gem::RequestSet
- @sets << @vendor_set
-
- set = Gem::Resolver.compose_sets(*@sets)
- + set.remote = @remote
-
- resolver = Gem::Resolver.new @dependencies, set
- resolver.development = @development
- diff --git a/lib/rubygems/request_set/lockfile.rb b/lib/rubygems/request_set/lockfile.rb
- index 522caf1..0433d2a 100644
- --- a/lib/rubygems/request_set/lockfile.rb
- +++ b/lib/rubygems/request_set/lockfile.rb
- @@ -303,7 +303,12 @@ class Gem::RequestSet::Lockfile
- type, data, = get [:text, :requirement]
-
- if type == :text and column == 4 then
- - last_spec = set.add name, data, Gem::Platform::RUBY
- + version, platform = data.split '-', 2
- +
- + platform =
- + platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY
- +
- + last_spec = set.add name, version, platform
- else
- dependency = parse_dependency name, data
-
- diff --git a/lib/rubygems/resolver.rb b/lib/rubygems/resolver.rb
- index d455e03..65e92bb 100644
- --- a/lib/rubygems/resolver.rb
- +++ b/lib/rubygems/resolver.rb
- @@ -59,6 +59,8 @@ class Gem::Resolver
-
- sets = sets.map do |set|
- case set
- + when Gem::Resolver::BestSet then
- + set
- when Gem::Resolver::ComposedSet then
- set.sets
- else
- @@ -179,27 +181,6 @@ class Gem::Resolver
- end
-
- ##
- - # Finds the State in +states+ that matches the +conflict+ so that we can try
- - # other possible sets.
- - #
- - # If no good candidate is found, the first state is tried.
- -
- - def find_conflict_state conflict, states # :nodoc:
- - until states.empty? do
- - state = states.pop
- -
- - explain :consider, state.dep, conflict.failed_dep
- -
- - if conflict.for_spec? state.spec
- - state.conflicts << [state.spec, conflict]
- - return state
- - end
- - end
- -
- - nil
- - end
- -
- - ##
- # Extracts the specifications that may be able to fulfill +dependency+ and
- # returns those that match the local platform and all those that match.
-
- diff --git a/lib/rubygems/resolver/api_set.rb b/lib/rubygems/resolver/api_set.rb
- index 89ee3c9..5475e62 100644
- --- a/lib/rubygems/resolver/api_set.rb
- +++ b/lib/rubygems/resolver/api_set.rb
- @@ -25,10 +25,12 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
- # http://guides.rubygems.org/rubygems-org-api
-
- def initialize dep_uri = 'https://rubygems.org/api/v1/dependencies'
- + super()
- +
- dep_uri = URI dep_uri unless URI === dep_uri # for ruby 1.8
-
- @dep_uri = dep_uri
- - @uri = dep_uri + '../../..'
- + @uri = dep_uri + '../..'
-
- @data = Hash.new { |h,k| h[k] = [] }
- @source = Gem::Source.new @uri
- @@ -41,6 +43,8 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
- def find_all req
- res = []
-
- + return res unless @remote
- +
- versions(req.name).each do |ver|
- if req.dependency.match? req.name, ver[:number]
- res << Gem::Resolver::APISpecification.new(self, ver)
- @@ -55,6 +59,7 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
- # data for DependencyRequests +reqs+.
-
- def prefetch reqs
- + return unless @remote
- names = reqs.map { |r| r.dependency.name }
- needed = names - @data.keys
-
- diff --git a/lib/rubygems/resolver/best_set.rb b/lib/rubygems/resolver/best_set.rb
- index fa6c9f8..20bb948 100644
- --- a/lib/rubygems/resolver/best_set.rb
- +++ b/lib/rubygems/resolver/best_set.rb
- @@ -12,11 +12,30 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet
- def initialize sources = Gem.sources
- super()
-
- - sources.each_source do |source|
- + @sources = sources
- + end
- +
- + ##
- + # Picks which sets to use for the configured sources.
- +
- + def pick_sets # :nodoc:
- + @sources.each_source do |source|
- @sets << source.dependency_resolver_set
- end
- end
-
- + def find_all req # :nodoc:
- + pick_sets if @remote and @sets.empty?
- +
- + super
- + end
- +
- + def prefetch reqs # :nodoc:
- + pick_sets if @remote and @sets.empty?
- +
- + super
- + end
- +
- def pretty_print q # :nodoc:
- q.group 2, '[BestSet', ']' do
- q.breakable
- diff --git a/lib/rubygems/resolver/composed_set.rb b/lib/rubygems/resolver/composed_set.rb
- index 19227e0..6f912b0 100644
- --- a/lib/rubygems/resolver/composed_set.rb
- +++ b/lib/rubygems/resolver/composed_set.rb
- @@ -16,10 +16,21 @@ class Gem::Resolver::ComposedSet < Gem::Resolver::Set
- # Gem::Resolver::compose_sets instead.
-
- def initialize *sets
- + super()
- +
- @sets = sets
- end
-
- ##
- + # Sets the remote network access for all composed sets.
- +
- + def remote= remote
- + super
- +
- + @sets.each { |set| set.remote = remote }
- + end
- +
- + ##
- # Finds all specs matching +req+ in all sets.
-
- def find_all req
- diff --git a/lib/rubygems/resolver/git_set.rb b/lib/rubygems/resolver/git_set.rb
- index 1a2b230..d32710e 100644
- --- a/lib/rubygems/resolver/git_set.rb
- +++ b/lib/rubygems/resolver/git_set.rb
- @@ -33,6 +33,8 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
- attr_reader :specs # :nodoc:
-
- def initialize # :nodoc:
- + super()
- +
- @git = ENV['git'] || 'git'
- @need_submodules = {}
- @repositories = {}
- @@ -91,6 +93,7 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set
- @repositories.each do |name, (repository, reference)|
- source = Gem::Source::Git.new name, repository, reference
- source.root_dir = @root_dir
- + source.remote = @remote
-
- source.specs.each do |spec|
- git_spec = Gem::Resolver::GitSpecification.new self, spec, source
- diff --git a/lib/rubygems/resolver/index_set.rb b/lib/rubygems/resolver/index_set.rb
- index a6ef56b..ef01f0f 100644
- --- a/lib/rubygems/resolver/index_set.rb
- +++ b/lib/rubygems/resolver/index_set.rb
- @@ -5,6 +5,8 @@
- class Gem::Resolver::IndexSet < Gem::Resolver::Set
-
- def initialize source = nil # :nodoc:
- + super()
- +
- @f =
- if source then
- sources = Gem::SourceList.from [source]
- @@ -34,6 +36,8 @@ class Gem::Resolver::IndexSet < Gem::Resolver::Set
- def find_all req
- res = []
-
- + return res unless @remote
- +
- name = req.dependency.name
-
- @all[name].each do |uri, n|
- diff --git a/lib/rubygems/resolver/installer_set.rb b/lib/rubygems/resolver/installer_set.rb
- index e35e0aa..045c893 100644
- --- a/lib/rubygems/resolver/installer_set.rb
- +++ b/lib/rubygems/resolver/installer_set.rb
- @@ -24,15 +24,17 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
- # Creates a new InstallerSet that will look for gems in +domain+.
-
- def initialize domain
- + super()
- +
- @domain = domain
- + @remote = consider_remote?
-
- @f = Gem::SpecFetcher.fetcher
-
- - @all = Hash.new { |h,k| h[k] = [] }
- @always_install = []
- @ignore_dependencies = false
- @ignore_installed = false
- - @loaded_remote_specs = []
- + @remote_set = Gem::Resolver::BestSet.new
- @specs = {}
- end
-
- @@ -79,16 +81,7 @@ class Gem::Resolver::InstallerSet < Gem::Resolv…
Large files files are truncated, but you can click here to view the full file