[#59445] [ruby-trunk - Bug #9335][Open] dynamic rescue regression in Ruby 2.1 — "fdr (Daniel Farina)" <daniel@...>
[#59462] [ruby-trunk - Bug #9342][Open] [PATCH] SizedQueue#clear does not notify waiting threads in Ruby 1.9.3 — "jsc (Justin Collins)" <redmine@...>
[#59466] [ruby-trunk - Bug #9343][Open] [PATCH] SizedQueue#max= wakes up waiters properly — "normalperson (Eric Wong)" <normalperson@...>
Issue #9343 has been updated by Eric Wong.
[#59498] [ruby-trunk - Bug #9352][Open] [BUG] rb_sys_fail_str(connect(2) for [fe80::1%lo0]:3000) - errno == 0 — "kain (Claudio Poli)" <claudio@...>
[#59516] [ruby-trunk - Bug #9356][Open] TCPSocket.new does not seem to handle INTR — "charliesome (Charlie Somerville)" <charliesome@...>
Issue #9356 has been updated by Shugo Maeda.
[#59517] [ruby-trunk - Bug #9357][Open] TracePoint's c_return traces return from call to 'trace' — "andhapp (Anuj Dutta)" <anuj@...>
[#59538] [ruby-trunk - Feature #9362][Assigned] Minimize cache misshit to gain optimal speed — "shyouhei (Shyouhei Urabe)" <shyouhei@...>
Intersting challenge.
On 01/06/2014 04:52 PM, SASADA Koichi wrote:
On 01/06/2014 06:11 PM, Urabe Shyouhei wrote:
(2014/01/06 23:10), Urabe Shyouhei wrote:
On 01/07/2014 07:36 AM, SASADA Koichi wrote:
Hi, I noticed a trivial typo in array.c, and it fails building struct.c
Eric Wong <normalperson@yhbt.net> wrote:
Btw, I just pushed a few trivial fixes up (a few more failures below):
OK, last update of the night :o I think everything is good on 32-bit...
Eric Wong <normalperson@yhbt.net> wrote:
Btw, I started working on cachelined-time branch on git://80x24.org/ruby
Eric Wong <normalperson@yhbt.net> wrote:
On 01/06/2014 12:02 PM, Eric Wong wrote:
Urabe Shyouhei <shyouhei@ruby-lang.org> wrote:
[#59564] [ruby-trunk - Bug #9365][Open] Sporadic TypeError (wrong argument type Thread (expected VM/thread)) from IO#close (via Net:HTTP) — "ggiesemann (Geoffrey Giesemann)" <geoffwa@...>
Issue #9365 has been updated by Geoffrey Giesemann.
[#59728] Ruby 2.1.0 in Production: known bugs and patches — Aman Gupta <ruby@...1.net>
Last week, we upgraded the github.com rails app to ruby 2.1.0 in production.
Hello Aman,
[#59770] bug report did not propagate to ruby-core — Mean Login <meanlogin@...>
https://bugs.ruby-lang.org/issues/9416
[#59791] About unmarshallable DRb objects life-time — Rodrigo Rosenfeld Rosas <rr.rosas@...>
A while ago I created a proof-of-concept that I intended to use in my
On 15 Jan 2014, at 11:58, Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com> wrote:
Em 15-01-2014 19:42, Eric Hodel escreveu:
On 16 Jan 2014, at 02:15, Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com> wrote:
Em 16-01-2014 19:43, Eric Hodel escreveu:
On 17 Jan 2014, at 04:22, Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com> wrote:
Em 17-01-2014 19:53, Eric Hodel escreveu:
On 18 Jan 2014, at 15:12, Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com> wrote:
Em 20-01-2014 21:51, Eric Hodel escreveu:
On 21 Jan 2014, at 02:01, Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com> wrote:
Em 21-01-2014 19:36, Eric Hodel escreveu:
[#59807] [ruby-trunk - misc #9421] [Open] [PATCH] doc/contributing.rdoc: allow/encourage other git hosts — normalperson@...
Issue #9421 has been reported by Eric Wong.
[#59882] [ruby-trunk - Feature #9428] [Rejected] Inline argument expressions and re-assignment — matz@...
Issue #9428 has been updated by Yukihiro Matsumoto.
On 2014/01/20 11:32, matz@ruby-lang.org wrote:
[#59909] [ruby-trunk - Feature #9425] [PATCH] st: use power-of-two sizes to avoid slow modulo ops — shyouhei@...
Issue #9425 has been updated by Shyouhei Urabe.
shyouhei@ruby-lang.org wrote:
[#60229] [ruby-trunk - Feature #9427] [Feedback] [PATCH] io.c: remove socket check for sendfile — akr@...
Issue #9427 has been updated by Akira Tanaka.
[#60377] Re: [ruby-cvs:51920] nobu:r44775 (trunk): socket.c: suppress warnings — Eric Wong <normalperson@...>
nobu@ruby-lang.org wrote:
[ruby-core:60303] [ruby-trunk - Feature #8678] Allow invalid string to work with regexp
Issue #8678 has been updated by Hiroshi SHIBATA.
Target version changed from 2.1.0 to current: 2.2.0
----------------------------------------
Feature #8678: Allow invalid string to work with regexp
https://bugs.ruby-lang.org/issues/8678#change-44788
* Author: Yui NARUSE
* Status: Assigned
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* Category: M17N
* Target version: current: 2.2.0
----------------------------------------
Legacy Ruby 1.8 could regexp match with broken strings.
People can find characters from binary data on the age.
After Ruby 1.9, Ruby raises Exception if it does regexp match with broken strings.
So it became hard to work with character-wise regexp matching with binary data.
Following patch allows it with the constant Regexp::LOOSEENCODING.
commit eb0111ff7ae3f563ce201c4a5f724f121336d42d
Author: NARUSE, Yui <naruse@ruby-lang.org>
Date: Mon Jul 22 05:37:44 2013 +0900
* Regexp
* New constant:
* Regexp::ENCODINGLOOSE: declare execute matching even if the target string
is invalid byte sequence. [experimental]
diff --git a/NEWS b/NEWS
index f5fe388..ade0b03 100644
--- a/NEWS
+++ b/NEWS
@@ -35,6 +35,11 @@ with all sufficient information, see the ChangeLog file.
* misc
* Mutex#owned? is no longer experimental.
+* Regexp
+ * New constant:
+ * Regexp::ENCODINGLOOSE: declare execute matching even if the target string
+ is invalid byte sequence. [experimental]
+
* String
* New methods:
* String#scrub and String#scrub! verify and fix invalid byte sequence.
diff --git a/re.c b/re.c
index e5cc79d..230a2e0 100644
--- a/re.c
+++ b/re.c
@@ -256,6 +256,7 @@ rb_memsearch(const void *x0, long m, const void *y0, long n, rb_encoding *enc)
#define REG_LITERAL FL_USER5
#define REG_ENCODING_NONE FL_USER6
+#define REG_ENCODING_LOOSE FL_USER7
#define KCODE_FIXED FL_USER4
@@ -263,6 +264,7 @@ rb_memsearch(const void *x0, long m, const void *y0, long n, rb_encoding *enc)
(ONIG_OPTION_IGNORECASE|ONIG_OPTION_MULTILINE|ONIG_OPTION_EXTEND)
#define ARG_ENCODING_FIXED 16
#define ARG_ENCODING_NONE 32
+#define ARG_ENCODING_LOOSE 64
static int
char_to_option(int c)
@@ -1251,7 +1253,8 @@ rb_reg_prepare_enc(VALUE re, VALUE str, int warn)
{
rb_encoding *enc = 0;
- if (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) {
+ if (!(RBASIC(re)->flags & REG_ENCODING_LOOSE) &&
+ rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) {
rb_raise(rb_eArgError,
"invalid byte sequence in %s",
rb_enc_name(rb_enc_get(str)));
@@ -2433,6 +2436,9 @@ rb_reg_initialize(VALUE obj, const char *s, long len, rb_encoding *enc,
if (options & ARG_ENCODING_NONE) {
re->basic.flags |= REG_ENCODING_NONE;
}
+ if (options & ARG_ENCODING_LOOSE) {
+ re->basic.flags |= REG_ENCODING_LOOSE;
+ }
re->ptr = make_regexp(RSTRING_PTR(unescaped), RSTRING_LEN(unescaped), enc,
options & ARG_REG_OPTION_MASK, err,
@@ -3091,6 +3097,7 @@ rb_reg_options(VALUE re)
options = RREGEXP(re)->ptr->options & ARG_REG_OPTION_MASK;
if (RBASIC(re)->flags & KCODE_FIXED) options |= ARG_ENCODING_FIXED;
if (RBASIC(re)->flags & REG_ENCODING_NONE) options |= ARG_ENCODING_NONE;
+ if (RBASIC(re)->flags & REG_ENCODING_LOOSE) options |= ARG_ENCODING_LOOSE;
return options;
}
@@ -3579,6 +3586,8 @@ Init_Regexp(void)
rb_define_const(rb_cRegexp, "FIXEDENCODING", INT2FIX(ARG_ENCODING_FIXED));
/* see Regexp.options and Regexp.new */
rb_define_const(rb_cRegexp, "NOENCODING", INT2FIX(ARG_ENCODING_NONE));
+ /* see Regexp.options and Regexp.new */
+ rb_define_const(rb_cRegexp, "LOOSEENCODING", INT2FIX(ARG_ENCODING_LOOSE));
rb_global_variable(®_cache);
diff --git a/string.c b/string.c
index 1d784e3..caf0baf 100644
--- a/string.c
+++ b/string.c
@@ -3970,7 +3970,7 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
cp = sp;
str_enc = STR_ENC_GET(str);
rb_enc_associate(dest, str_enc);
- ENC_CODERANGE_SET(dest, rb_enc_asciicompat(str_enc) ? ENC_CODERANGE_7BIT : ENC_CODERANGE_VALID);
+ /*ENC_CODERANGE_SET(dest, rb_enc_asciicompat(str_enc) ? ENC_CODERANGE_7BIT : ENC_CODERANGE_VALID);*/
do {
n++;
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 11e86ec..b8f6897 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -8,6 +8,10 @@ class TestRegexp < Test::Unit::TestCase
$VERBOSE = nil
end
+ def u(str)
+ str.dup.force_encoding(Encoding::UTF_8)
+ end
+
def teardown
$VERBOSE = @verbose
end
@@ -958,6 +962,17 @@ class TestRegexp < Test::Unit::TestCase
}
end
+ def test_encoding_loose
+ str = u("\x80\xE3\x81\x82\x81")
+ assert_equal(0, Regexp.new(".", Regexp::LOOSEENCODING) =~ str)
+ assert_equal(1, Regexp.new(u('\p{Any}'), Regexp::LOOSEENCODING) =~ str)
+ assert_equal(1, Regexp.new("\u3042", Regexp::LOOSEENCODING) =~ str)
+ assert_equal(1, Regexp.new(u('\p{Hiragana}'), Regexp::LOOSEENCODING) =~ str)
+ assert_equal(0, Regexp.new(u('\A.\p{Hiragana}.\z'), Regexp::LOOSEENCODING) =~ str)
+ str = u("\xf1\x80\xE3\x81\x82\x81")
+ assert_equal(0, Regexp.new(u('\A..\p{Hiragana}.\z'), Regexp::LOOSEENCODING) =~ str)
+ end
+
# This assertion is for porting x2() tests in testpy.py of Onigmo.
def assert_match_at(re, str, positions, msg = nil)
re = Regexp.new(re) unless re.is_a?(Regexp)
--
http://bugs.ruby-lang.org/