Skip to content

Commit ef85955

Browse files
committed
Merge pull request #13 from github/merge-upstream-2.1.1
Merge upstream 2.1.1
2 parents f08d508 + 5b54c3b commit ef85955

File tree

159 files changed

+2518
-681
lines changed

Some content is hidden

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

159 files changed

+2518
-681
lines changed

ChangeLog

Lines changed: 571 additions & 1 deletion
Large diffs are not rendered by default.

NEWS

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ with all sufficient information, see the ChangeLog file.
114114
* Process.clock_getres
115115

116116
* String
117+
* "literal".freeze is now optimized to return the same object
117118
* New methods:
118119
* String#scrub and String#scrub! verify and fix invalid byte sequence.
119120
If you want to use this function with older Ruby,
@@ -133,6 +134,10 @@ with all sufficient information, see the ChangeLog file.
133134

134135
=== Core classes compatibility issues (excluding feature bug fixes)
135136

137+
* Dir
138+
* incompatible changes:
139+
* Dir#glob returns composed characters (previously Apple Modofied UTF-8).
140+
136141
* Hash
137142
* incompatible changes:
138143
* Hash#reject will return plain Hash object in the future versions, that
@@ -250,7 +255,7 @@ String
250255
* REXML::Parsers::SAX2Parser
251256
* Fixes wrong number of arguments of entitydecl event. Document of the event
252257
says "an array of the entity declaration" but implementation passes two
253-
or more arguments. It is an implementation bug but it breaks backword
258+
or more arguments. It is an implementation bug but it breaks backward
254259
compatibility.
255260

256261
* REXML::Parsers::StreamParser
@@ -271,6 +276,8 @@ String
271276
* Improved, iterative resolver (compared to RubyGems 2.1 and earlier)
272277
* Support for a sharing a GEM_HOME across ruby platforms and versions
273278

279+
* Updated to 2.2.2. Fixes some minor bugs and performance regressions.
280+
274281
For a complete list of enhancements and bug fixes see:
275282
https://github.com/rubygems/rubygems/tree/master/History.txt
276283

benchmark/driver.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def measure executable, file
242242
cmd = "#{executable} #{@ruby_arg} #{file}"
243243

244244
m = Benchmark.measure{
245-
`#{cmd}`
245+
system(cmd, out: File::NULL)
246246
}
247247

248248
if $? != 0

bootstraptest/test_method.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,8 +957,8 @@ class C < B
957957

958958
assert_normal_exit %q{
959959
begin
960-
Process.setrlimit(Process::RLIMIT_STACK, 4_202_496)
961-
# FreeBSD fails this less than 4M + 8K bytes.
960+
Process.setrlimit(Process::RLIMIT_STACK, 4_206_592)
961+
# FreeBSD SEGVs this less than 4M + 12K bytes.
962962
rescue Exception
963963
exit
964964
end

class.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
322322
if (RB_TYPE_P(clone, T_CLASS)) {
323323
class_init_copy_check(clone, orig);
324324
}
325-
rb_obj_init_copy(clone, orig);
325+
if (!OBJ_INIT_COPY(clone, orig)) return clone;
326326
if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) {
327327
RBASIC_SET_CLASS(clone, rb_singleton_class_clone(orig));
328328
rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone);

compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
12031203
node = node->nd_next;
12041204
i += 1;
12051205
}
1206-
iseq->arg_keyword_check = (args->kw_rest_arg->nd_vid & ID_SCOPE_MASK) == ID_JUNK;
1206+
iseq->arg_keyword_check = args->kw_rest_arg->nd_cflag != 0;
12071207
iseq->arg_keywords = i;
12081208
iseq->arg_keyword_required = r;
12091209
iseq->arg_keyword_table = ALLOC_N(ID, i);

configure.in

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,22 @@ if test "$GCC" = yes; then
856856
for oflag in -fno-fast-math; do
857857
RUBY_TRY_CFLAGS($oflag, [RUBY_APPEND_OPTION(optflags, $oflag)])
858858
done
859+
AS_CASE(["$target"],
860+
[*-darwin*], [
861+
# doesn't seem necessary on Mac OS X
862+
],
863+
[[i[4-6]86*]], [
864+
RUBY_TRY_CFLAGS(-msse2 -mfpmath=sse, [
865+
RUBY_APPEND_OPTION(XCFLAGS, -msse2 -mfpmath=sse)
866+
])
867+
AS_CASE(["$XCFLAGS"],
868+
[[*-msse2*]], [
869+
RUBY_TRY_CFLAGS(-mstackrealign, [
870+
RUBY_APPEND_OPTION(XCFLAGS, -mstackrealign)
871+
])
872+
])
873+
]
874+
)
859875
fi
860876

861877
AC_ARG_WITH(opt-dir,
@@ -864,17 +880,11 @@ AC_ARG_WITH(opt-dir,
864880
[
865881
val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -I\1/include|g;s/^ //"`
866882
CPPFLAGS="$CPPFLAGS $val"
867-
val=`IFS="$PATH_SEPARATOR"
868-
for dir in $withval; do
869-
echo x ${LIBPATHFLAG} ${RPATHFLAG} |
870-
sed "s/^x *//;s${IFS}"'%1\\$-s'"${IFS}${dir}/lib${IFS}g;s${IFS}%s${IFS}${dir}/lib${IFS}g"
871-
done | tr '\012' ' '`
883+
val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -L\1/lib|g;s/^ //"`
884+
LDFLAGS="$LDFLAGS $val"
872885
LDFLAGS_OPTDIR="$val"
873-
test x"${LDFLAGS}" = x || LDFLAGS="$LDFLAGS "
874-
LDFLAGS="$LDFLAGS$val"
875-
test x"${DLDFLAGS}" = x || DLDFLAGS="$DLDFLAGS "
876-
DLDFLAGS="$DLDFLAGS$val"
877-
])
886+
OPT_DIR="$withval"
887+
], [OPT_DIR=])
878888

879889
test -z "${ac_env_CFLAGS_set}" -a -n "${cflags+set}" && eval CFLAGS="\"$cflags $ARCH_FLAG\""
880890
test -z "${ac_env_CXXFLAGS_set}" -a -n "${cxxflags+set}" && eval CXXFLAGS="\"$cxxflags $ARCH_FLAG\""
@@ -888,6 +898,7 @@ AC_ARG_WITH(winnt-ver,
888898
AS_CASE(["$target_os"],
889899
[mingw*], [
890900
RUBY_APPEND_OPTION(CPPFLAGS, -D_WIN32_WINNT=$with_winnt_ver)
901+
RUBY_APPEND_OPTION(CPPFLAGS, -D__MINGW_USE_VC2005_COMPAT)
891902
])
892903

893904
AS_CASE(["$target_os"],
@@ -1040,6 +1051,7 @@ main()
10401051
if test x"$ac_cv_type_NET_LUID" = xyes; then
10411052
AC_DEFINE(HAVE_TYPE_NET_LUID, 1)
10421053
fi
1054+
AC_CHECK_FUNCS(_gmtime64_s)
10431055
AC_LIBOBJ([langinfo])
10441056
],
10451057
[os2-emx*], [ LIBS="-lm $LIBS"
@@ -2437,7 +2449,7 @@ if test x"$enable_pthread" = xyes; then
24372449
pthread_get_stackaddr_np pthread_get_stacksize_np \
24382450
thr_stksegment pthread_stackseg_np pthread_getthrds_np \
24392451
pthread_cond_init pthread_condattr_setclock pthread_condattr_init \
2440-
pthread_sigmask)
2452+
pthread_sigmask pthread_setname_np)
24412453
if test "${host_os}" = "nacl"; then
24422454
ac_cv_func_pthread_attr_init=no
24432455
else
@@ -2657,7 +2669,7 @@ if test "$with_dln_a_out" != yes; then
26572669
: ${LDSHARED='$(CC) -shared'}
26582670
if test "$rb_cv_binary_elf" = yes; then
26592671
LDFLAGS="$LDFLAGS -rdynamic"
2660-
DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$(.TARGET)'
2672+
DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$@'
26612673
else
26622674
test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED='$(LD) -Bshareable'
26632675
fi
@@ -2760,6 +2772,21 @@ AC_SUBST(RPATHFLAG)
27602772
AC_SUBST(LIBPATHENV, "${LIBPATHENV-LD_LIBRARY_PATH}")
27612773
AC_SUBST(TRY_LINK)
27622774

2775+
if test "x$OPT_DIR" != x; then
2776+
pat=`echo "${LDFLAGS_OPTDIR}" | sed ['s/[][\\.*|]/\\\\&/']`
2777+
LDFLAGS=`echo "${LDFLAGS}" | sed "s| ${pat}||"`
2778+
val=`IFS="$PATH_SEPARATOR"
2779+
for dir in $OPT_DIR; do
2780+
echo x ${LIBPATHFLAG} ${RPATHFLAG} |
2781+
sed "s/^x *//;s${IFS}"'%1\\$-s'"${IFS}${dir}/lib${IFS}g;s${IFS}%s${IFS}${dir}/lib${IFS}g"
2782+
done | tr '\012' ' '`
2783+
test x"${LDFLAGS}" = x || LDFLAGS="$LDFLAGS "
2784+
LDFLAGS="$LDFLAGS$val"
2785+
test x"${DLDFLAGS}" = x || DLDFLAGS="$DLDFLAGS "
2786+
DLDFLAGS="$DLDFLAGS$val"
2787+
LDFLAGS_OPTDIR="$val"
2788+
fi
2789+
27632790
AS_CASE(["$target_cpu-$target_os"],
27642791
[*-darwin*], [
27652792
AC_CHECK_HEADERS([execinfo.h])

encoding.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ must_encindex(int index)
158158
rb_raise(rb_eEncodingError, "encoding index out of bound: %d",
159159
index);
160160
}
161-
if (ENC_TO_ENCINDEX(enc) != index) {
161+
if (ENC_TO_ENCINDEX(enc) != (int)(index & ENC_INDEX_MASK)) {
162162
rb_raise(rb_eEncodingError, "wrong encoding index %d for %s (expected %d)",
163163
index, rb_enc_name(enc), ENC_TO_ENCINDEX(enc));
164164
}
@@ -594,12 +594,18 @@ rb_enc_from_index(int index)
594594
if (!enc_table.list) {
595595
rb_enc_init();
596596
}
597-
if (index < 0 || enc_table.count <= index) {
597+
if (index < 0 || enc_table.count <= (index &= ENC_INDEX_MASK)) {
598598
return 0;
599599
}
600600
return enc_table.list[index].enc;
601601
}
602602

603+
rb_encoding *
604+
rb_enc_get_from_index(int index)
605+
{
606+
return must_encindex(index);
607+
}
608+
603609
int
604610
rb_enc_registered(const char *name)
605611
{
@@ -937,7 +943,7 @@ rb_obj_encoding(VALUE obj)
937943
if (idx < 0) {
938944
rb_raise(rb_eTypeError, "unknown encoding");
939945
}
940-
return rb_enc_from_encoding_index(idx);
946+
return rb_enc_from_encoding_index(idx & ENC_INDEX_MASK);
941947
}
942948

943949
int

eval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ rb_mod_s_constants(int argc, VALUE *argv, VALUE mod)
380380
VALUE cbase = 0;
381381
void *data = 0;
382382

383-
if (argc > 0) {
384-
return rb_mod_constants(argc, argv, rb_cModule);
383+
if (argc > 0 || mod != rb_cModule) {
384+
return rb_mod_constants(argc, argv, mod);
385385
}
386386

387387
while (cref) {

ext/-test-/tracepoint/tracepoint.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ tracepoint_track_objspace_events(VALUE self)
6464
VALUE result = rb_ary_new();
6565

6666
rb_tracepoint_enable(tpval);
67-
rb_yield(Qundef);
68-
rb_tracepoint_disable(tpval);
67+
rb_ensure(rb_yield, Qundef, rb_tracepoint_disable, tpval);
6968

7069
rb_ary_push(result, SIZET2NUM(track.newobj_count));
7170
rb_ary_push(result, SIZET2NUM(track.free_count));

0 commit comments

Comments
 (0)