Skip to content

Commit 9e977e0

Browse files
committed
Merge branch 'master-2.3' into dist/2.3/xenial
2 parents adeadc4 + b7e4980 commit 9e977e0

File tree

124 files changed

+2468
-521
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+2468
-521
lines changed

ChangeLog

Lines changed: 620 additions & 0 deletions
Large diffs are not rendered by default.

array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1766,8 +1766,8 @@ rb_ary_insert(int argc, VALUE *argv, VALUE ary)
17661766

17671767
rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
17681768
rb_ary_modify_check(ary);
1769-
if (argc == 1) return ary;
17701769
pos = NUM2LONG(argv[0]);
1770+
if (argc == 1) return ary;
17711771
if (pos == -1) {
17721772
pos = RARRAY_LEN(ary);
17731773
}

class.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ Init_class_hierarchy(void)
549549
{
550550
rb_cBasicObject = boot_defclass("BasicObject", 0);
551551
rb_cObject = boot_defclass("Object", rb_cBasicObject);
552+
rb_gc_register_mark_object(rb_cObject);
552553
rb_cModule = boot_defclass("Module", rb_cObject);
553554
rb_cClass = boot_defclass("Class", rb_cModule);
554555

@@ -846,18 +847,23 @@ rb_include_class_new(VALUE module, VALUE super)
846847

847848
static int include_modules_at(const VALUE klass, VALUE c, VALUE module, int search_super);
848849

850+
static void
851+
ensure_includable(VALUE klass, VALUE module)
852+
{
853+
rb_frozen_class_p(klass);
854+
Check_Type(module, T_MODULE);
855+
if (!NIL_P(rb_refinement_module_get_refined_class(module))) {
856+
rb_raise(rb_eArgError, "refinement module is not allowed");
857+
}
858+
OBJ_INFECT(klass, module);
859+
}
860+
849861
void
850862
rb_include_module(VALUE klass, VALUE module)
851863
{
852864
int changed = 0;
853865

854-
rb_frozen_class_p(klass);
855-
856-
if (!RB_TYPE_P(module, T_MODULE)) {
857-
Check_Type(module, T_MODULE);
858-
}
859-
860-
OBJ_INFECT(klass, module);
866+
ensure_includable(klass, module);
861867

862868
changed = include_modules_at(klass, RCLASS_ORIGIN(klass), module, TRUE);
863869
if (changed < 0)
@@ -962,11 +968,7 @@ rb_prepend_module(VALUE klass, VALUE module)
962968
VALUE origin;
963969
int changed = 0;
964970

965-
rb_frozen_class_p(klass);
966-
967-
Check_Type(module, T_MODULE);
968-
969-
OBJ_INFECT(klass, module);
971+
ensure_includable(klass, module);
970972

971973
origin = RCLASS_ORIGIN(klass);
972974
if (origin == klass) {

compile.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#undef RUBY_UNTYPED_DATA_WARNING
2929
#define RUBY_UNTYPED_DATA_WARNING 0
3030

31+
#define ISEQ_TYPE_ONCE_GUARD ISEQ_TYPE_DEFINED_GUARD
32+
3133
#define FIXNUM_INC(n, i) ((n)+(INT2FIX(i)&~FIXNUM_FLAG))
3234
#define FIXNUM_OR(n, i) ((n)|INT2FIX(i))
3335

@@ -5489,7 +5491,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
54895491
int ic_index = iseq->body->is_size++;
54905492
NODE *dregx_node = NEW_NODE(NODE_DREGX, node->u1.value, node->u2.value, node->u3.value);
54915493
NODE *block_node = NEW_NODE(NODE_SCOPE, 0, dregx_node, 0);
5492-
const rb_iseq_t * block_iseq = NEW_CHILD_ISEQ(block_node, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, line);
5494+
const rb_iseq_t *block_iseq = NEW_CHILD_ISEQ(block_node, make_name_for_block(iseq),
5495+
ISEQ_TYPE_ONCE_GUARD, line);
54935496

54945497
ADD_INSN2(ret, line, once, block_iseq, INT2FIX(ic_index));
54955498

@@ -5993,8 +5996,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
59935996
}
59945997
case NODE_PRELUDE:{
59955998
const rb_compile_option_t *orig_opt = ISEQ_COMPILE_DATA(iseq)->option;
5999+
rb_compile_option_t new_opt = *orig_opt;
59966000
if (node->nd_orig) {
5997-
rb_compile_option_t new_opt = *orig_opt;
59986001
rb_iseq_make_compile_option(&new_opt, node->nd_orig);
59996002
ISEQ_COMPILE_DATA(iseq)->option = &new_opt;
60006003
}

configure.in

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,24 @@ AC_DEFUN([RUBY_TRY_LDFLAGS], [
787787
save_LDFLAGS=
788788
])
789789

790+
: ${RPATHFLAG=''}
791+
rpathflag=''
792+
AS_IF([test x"${RPATHFLAG}" = x], [
793+
AS_CASE(["$target_os"],
794+
[hpux*], [AS_IF([test "$rb_cv_prog_gnu_ld" = no], [rpathflag='+b '])],
795+
[aix*], [rpathflag='-blibpath:'],
796+
[for rpathflag in -R "-rpath "; do
797+
AS_CASE("$rpathflag",
798+
[*" "], [AS_CASE(["${linker_flag}"],
799+
[*,], [rpathflag=`echo "$rpathflag" | tr ' ' ,`])])
800+
rpathflag="${linker_flag}${rpathflag}"
801+
RUBY_TRY_LDFLAGS([${rpathflag}.], [], [rpathflag=])
802+
AS_IF([test "x${rpathflag}" != x], [])
803+
done])
804+
], [
805+
rpathflag=`echo "$RPATHFLAG" | sed 's/%.*//'`
806+
])
807+
790808
AS_CASE([$RUBY_PATCHLEVEL], [-*],
791809
[particular_werror_flags=yes], [particular_werror_flags=no])
792810
AC_ARG_ENABLE(werror,
@@ -986,7 +1004,7 @@ AC_ARG_WITH(opt-dir,
9861004
[
9871005
val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -I\1/include|g;s/^ //"`
9881006
CPPFLAGS="$CPPFLAGS $val"
989-
val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -L\1/lib|g;s/^ //"`
1007+
val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -L\1/lib${rpathflag:+ $rpathflag\\\\1/lib}|g;s/^ //"`
9901008
LDFLAGS="$LDFLAGS $val"
9911009
LDFLAGS_OPTDIR="$val"
9921010
OPT_DIR="$withval"
@@ -1319,15 +1337,13 @@ AC_ARG_WITH([gmp],
13191337
AS_IF([test "x$with_gmp" != xno],
13201338
[AC_CHECK_HEADERS(gmp.h)
13211339
AS_IF([test "x$ac_cv_header_gmp_h" != xno],
1322-
AC_CHECK_LIB([gmp], [__gmpz_init]))
1323-
with_gmp="$ac_cv_lib_gmp___gmpz_init"
1324-
AS_IF([test -z "$with_gmp"], [with_gmp=no])])
1340+
AC_SEARCH_LIBS([__gmpz_init], [gmp]))])
13251341

13261342
AC_ARG_WITH([jemalloc],
13271343
[AS_HELP_STRING([--with-jemalloc],[use jemalloc allocator])],
13281344
[with_jemalloc=$withval], [with_jemalloc=no])
13291345
AS_IF([test "x$with_jemalloc" = xyes],[
1330-
AC_CHECK_LIB([jemalloc], [malloc_conf], [], [with_jemalloc=no])
1346+
AC_SEARCH_LIBS([malloc_conf], [jemalloc], [], [with_jemalloc=no])
13311347
AC_CHECK_HEADER(jemalloc/jemalloc.h, [
13321348
AC_DEFINE(RUBY_ALTERNATIVE_MALLOC_HEADER, [<jemalloc/jemalloc.h>])
13331349
])
@@ -3158,7 +3174,6 @@ AC_SUBST(LIBEXT)dnl
31583174
AC_SUBST(ASMEXT, S)dnl
31593175

31603176
STATIC=
3161-
: ${PATHFLAG=''}
31623177

31633178
if test "$with_dln_a_out" != yes; then
31643179
rb_cv_dlopen=unknown
@@ -3197,9 +3212,6 @@ if test "$with_dln_a_out" != yes; then
31973212
: ${LDSHARED='$(LD) -b'}
31983213
XLDFLAGS="$XLDFLAGS -Wl,-E"
31993214
: ${LIBPATHENV=SHLIB_PATH}
3200-
if test "$rb_cv_prog_gnu_ld" = no; then
3201-
RPATHFLAG=' +b %1$-s'
3202-
fi
32033215
rb_cv_dlopen=yes],
32043216
[solaris*], [ if test "$GCC" = yes; then
32053217
: ${LDSHARED='$(CC) -shared'}
@@ -3270,7 +3282,6 @@ if test "$with_dln_a_out" != yes; then
32703282
TRY_LINK='$(CC) $(LDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS)'
32713283
TRY_LINK="$TRY_LINK"' $(CFLAGS) $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)'
32723284
: ${LIBPATHENV=LIBPATH}
3273-
RPATHFLAG=" ${linker_flag}-blibpath:%1\$-s:${prefix}/lib:${LIBPATH:-/usr/lib:/lib}"
32743285
rb_cv_dlopen=yes],
32753286
[nto-qnx*], [ DLDFLAGS="$DLDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
32763287
: ${LDSHARED='$(LD) -Bshareable -x'}
@@ -3306,21 +3317,11 @@ if test "$with_dln_a_out" != yes; then
33063317
])
33073318
fi
33083319

3309-
if test "$enable_rpath" = yes; then
3310-
if test x"${RPATHFLAG}" = x; then
3311-
for rpathflag in -R "-rpath "; do
3312-
AS_CASE("$rpathflag",
3313-
[*" "], [AS_CASE(["${linker_flag}"],
3314-
[*,], [rpathflag=`echo "$rpathflag" | tr ' ' ,`])])
3315-
rpathflag="${linker_flag}${rpathflag}"
3316-
RUBY_TRY_LDFLAGS([${rpathflag}.], [], [rpathflag=])
3317-
if test "x${rpathflag}" != x; then
3320+
AS_IF([test "$enable_rpath:${RPATHFLAG}" = yes:], [
3321+
AS_IF([test "x$rpathflag" != x], [
33183322
RPATHFLAG=" ${rpathflag}%1\$-s"
3319-
break
3320-
fi
3321-
done
3322-
fi
3323-
fi
3323+
])
3324+
])
33243325
fi
33253326
if test "${LDSHAREDXX}" = ""; then
33263327
AS_CASE(["${LDSHARED}"],
@@ -4045,12 +4046,6 @@ AS_CASE(["$target_os"],
40454046
FIRSTMAKEFILE=GNUmakefile:nacl/GNUmakefile.in
40464047
])
40474048

4048-
AS_CASE(["$with_gmp: $SOLIBS "], [no:* | *' -lgmp '*|*' $(LIBS) '*], [],
4049-
[SOLIBS="-lgmp $SOLIBS"])
4050-
4051-
AS_CASE(["$with_jemalloc: $LIBS "], [no:* | *' -ljemalloc '*], [],
4052-
[LIBS="-ljemalloc $LIBS"])
4053-
40544049
MINIOBJS="$MINIDLNOBJ"
40554050

40564051
AS_CASE(["$THREAD_MODEL"],

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
ruby2.3 (2.3.5-0nkmi1) unstable; urgency=medium
2+
3+
* new upstream version
4+
5+
-- Sorah Fukumori <[email protected]> Thu, 14 Sep 2017 16:11:22 +0000
6+
17
ruby2.3 (2.3.4-0nkmi1~xenial) xenial; urgency=medium
28

39
* new upstream version

dir.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,8 +1470,13 @@ join_path(const char *path, long len, int dirsep, const char *name, size_t namle
14701470
}
14711471

14721472
#ifdef HAVE_GETATTRLIST
1473+
# if defined HAVE_FGETATTRLIST
1474+
# define is_case_sensitive(dirp, path) is_case_sensitive(dirp)
1475+
# else
1476+
# define is_case_sensitive(dirp, path) is_case_sensitive(path)
1477+
# endif
14731478
static int
1474-
is_case_sensitive(DIR *dirp)
1479+
is_case_sensitive(DIR *dirp, const char *path)
14751480
{
14761481
struct {
14771482
u_int32_t length;
@@ -1482,8 +1487,13 @@ is_case_sensitive(DIR *dirp)
14821487
const int idx = VOL_CAPABILITIES_FORMAT;
14831488
const uint32_t mask = VOL_CAP_FMT_CASE_SENSITIVE;
14841489

1490+
# if defined HAVE_FGETATTRLIST
14851491
if (fgetattrlist(dirfd(dirp), &al, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW))
14861492
return -1;
1493+
# else
1494+
if (getattrlist(path, &al, attrbuf, sizeof(attrbuf), FSOPT_NOFOLLOW))
1495+
return -1;
1496+
# endif
14871497
if (!(cap->valid[idx] & mask))
14881498
return -1;
14891499
return (cap->capabilities[idx] & mask) != 0;
@@ -1778,7 +1788,7 @@ glob_helper(
17781788
}
17791789
# endif
17801790
# ifdef HAVE_GETATTRLIST
1781-
if (is_case_sensitive(dirp) == 0)
1791+
if (is_case_sensitive(dirp, path) == 0)
17821792
flags |= FNM_CASEFOLD;
17831793
# endif
17841794
while ((dp = READDIR(dirp, enc)) != NULL) {

eval.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@ exc_setup_cause(VALUE exc, VALUE cause)
458458
}
459459
#endif
460460
if (!NIL_P(cause) && cause != exc) {
461+
if (OBJ_FROZEN(exc))
462+
exc = rb_obj_dup(exc);
461463
rb_ivar_set(exc, id_cause, cause);
462464
}
463465
return exc;
@@ -469,6 +471,17 @@ sysstack_error_p(VALUE exc)
469471
return exc == sysstack_error || (!SPECIAL_CONST_P(exc) && RBASIC_CLASS(exc) == rb_eSysStackError);
470472
}
471473

474+
static inline int
475+
special_exception_p(rb_thread_t *th, VALUE exc)
476+
{
477+
enum ruby_special_exceptions i;
478+
const VALUE *exceptions = th->vm->special_exceptions;
479+
for (i = 0; i < ruby_special_error_count; ++i) {
480+
if (exceptions[i] == exc) return TRUE;
481+
}
482+
return FALSE;
483+
}
484+
472485
static void
473486
setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
474487
{
@@ -486,14 +499,17 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
486499
mesg = rb_exc_new(rb_eRuntimeError, 0, 0);
487500
nocause = 0;
488501
}
502+
else if (special_exception_p(th, mesg)) {
503+
mesg = ruby_vm_special_exception_copy(mesg);
504+
}
489505
if (cause != Qundef) {
490-
exc_setup_cause(mesg, cause);
506+
mesg = exc_setup_cause(mesg, cause);
491507
}
492508
else if (nocause) {
493-
exc_setup_cause(mesg, Qnil);
509+
mesg = exc_setup_cause(mesg, Qnil);
494510
}
495511
else if (!rb_ivar_defined(mesg, id_cause)) {
496-
exc_setup_cause(mesg, get_thread_errinfo(th));
512+
mesg = exc_setup_cause(mesg, get_thread_errinfo(th));
497513
}
498514

499515
file = rb_source_loc(&line);
@@ -502,9 +518,6 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
502518
if (sysstack_error_p(mesg)) {
503519
if (NIL_P(rb_attr_get(mesg, idBt))) {
504520
at = rb_vm_backtrace_object();
505-
if (mesg == sysstack_error) {
506-
mesg = ruby_vm_sysstack_error_copy();
507-
}
508521
rb_ivar_set(mesg, idBt, at);
509522
rb_ivar_set(mesg, idBt_locations, at);
510523
}

ext/-test-/thread_fd_close/depend

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# AUTOGENERATED DEPENDENCIES START
2+
thread_fd_close.o: $(RUBY_EXTCONF_H)
3+
thread_fd_close.o: $(arch_hdrdir)/ruby/config.h
4+
thread_fd_close.o: $(hdrdir)/ruby/defines.h
5+
thread_fd_close.o: $(hdrdir)/ruby/encoding.h
6+
thread_fd_close.o: $(hdrdir)/ruby/intern.h
7+
thread_fd_close.o: $(hdrdir)/ruby/io.h
8+
thread_fd_close.o: $(hdrdir)/ruby/missing.h
9+
thread_fd_close.o: $(hdrdir)/ruby/oniguruma.h
10+
thread_fd_close.o: $(hdrdir)/ruby/ruby.h
11+
thread_fd_close.o: $(hdrdir)/ruby/st.h
12+
thread_fd_close.o: $(hdrdir)/ruby/subst.h
13+
thread_fd_close.o: thread_fd_close.c
14+
# AUTOGENERATED DEPENDENCIES END
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# frozen_string_literal: true
2+
create_makefile('-test-/thread_fd_close')

0 commit comments

Comments
 (0)