ruby-changes:52884
From: nobu <ko1@a...>
Date: Tue, 16 Oct 2018 18:11:16 +0900 (JST)
Subject: [ruby-changes:52884] nobu:r65096 (trunk): string.c: grapheme cluster regexp failure
nobu 2018-10-16 18:11:12 +0900 (Tue, 16 Oct 2018) New Revision: 65096 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65096 Log: string.c: grapheme cluster regexp failure * string.c (get_reg_grapheme_cluster): show error info and relax to rb_fatal from rb_bug. Modified files: trunk/string.c Index: string.c =================================================================== --- string.c (revision 65095) +++ string.c (revision 65096) @@ -8428,10 +8428,13 @@ get_reg_grapheme_cluster(rb_encoding *en https://github.com/ruby/ruby/blob/trunk/string.c#L8428 } if (!reg_grapheme_cluster) { const OnigUChar source[] = "\\X"; + OnigErrorInfo einfo; int r = onig_new(®_grapheme_cluster, source, source + sizeof(source) - 1, - ONIG_OPTION_DEFAULT, enc, OnigDefaultSyntax, NULL); + ONIG_OPTION_DEFAULT, enc, OnigDefaultSyntax, &einfo); if (r) { - rb_bug("cannot compile grapheme cluster regexp"); + UChar message[ONIG_MAX_ERROR_MESSAGE_LEN]; + onig_error_code_to_str(message, r, &einfo); + rb_fatal("cannot compile grapheme cluster regexp: %s", (char *)message); } if (encidx == rb_utf8_encindex()) { reg_grapheme_cluster_utf8 = reg_grapheme_cluster; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/