lang/ruby25: apply upstream patch to fix segfault
PR: 225470 Submitted by: Charlie Li <ml+freebsd@vishwin.info> Obtained from: https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61523 Differential Revision: https://reviews.freebsd.org/D14073
This commit is contained in:
parent
c5355726b5
commit
aa5e3913d2
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=461970
6 changed files with 10043 additions and 1 deletions
|
@ -175,7 +175,7 @@ RUBY24= "" # PLIST_SUB helpers
|
|||
# Ruby 2.5
|
||||
#
|
||||
RUBY_RELVERSION= 2.5.0
|
||||
RUBY_PORTREVISION= 0
|
||||
RUBY_PORTREVISION= 1
|
||||
RUBY_PORTEPOCH= 1
|
||||
RUBY_PATCHLEVEL= 0
|
||||
RUBY25= "" # PLIST_SUB helpers
|
||||
|
|
5011
lang/ruby25/files/patch-ext_ripper_ripper.c
Normal file
5011
lang/ruby25/files/patch-ext_ripper_ripper.c
Normal file
File diff suppressed because it is too large
Load diff
45
lang/ruby25/files/patch-ext_ripper_ripper.y
Normal file
45
lang/ruby25/files/patch-ext_ripper_ripper.y
Normal file
|
@ -0,0 +1,45 @@
|
|||
--- ext/ripper/ripper.y.orig 2017-12-25 07:00:33 UTC
|
||||
+++ ext/ripper/ripper.y
|
||||
@@ -1983,18 +1983,10 @@ mlhs_node : user_variable
|
||||
lhs : user_variable
|
||||
{
|
||||
$$ = assignable(var_field($1), 0, &@$);
|
||||
-#if 0
|
||||
- if (!$$) $$ = new_begin(0, &@$);
|
||||
-#endif
|
||||
-
|
||||
}
|
||||
| keyword_variable
|
||||
{
|
||||
$$ = assignable(var_field($1), 0, &@$);
|
||||
-#if 0
|
||||
- if (!$$) $$ = new_begin(0, &@$);
|
||||
-#endif
|
||||
-
|
||||
}
|
||||
| primary_value '[' opt_call_args rbracket
|
||||
{
|
||||
@@ -9957,11 +9949,13 @@ assignable_gen(struct parser_params *parser, ID id, NO
|
||||
#ifdef RIPPER
|
||||
ID id = get_id(lhs);
|
||||
# define assignable_result(x) (lhs)
|
||||
+# define assignable_error() (lhs)
|
||||
# define parser_yyerror(parser, x) (lhs = assign_error_gen(parser, lhs))
|
||||
#else
|
||||
# define assignable_result(x) assignable_result0(x, location)
|
||||
+# define assignable_error() new_begin(0, location)
|
||||
#endif
|
||||
- if (!id) return assignable_result(0);
|
||||
+ if (!id) return assignable_error();
|
||||
switch (id) {
|
||||
case keyword_self:
|
||||
yyerror0("Can't change the value of self");
|
||||
@@ -10024,7 +10018,7 @@ assignable_gen(struct parser_params *parser, ID id, NO
|
||||
compile_error(PARSER_ARG "identifier %"PRIsVALUE" is not valid to set", rb_id2str(id));
|
||||
}
|
||||
error:
|
||||
- return assignable_result(0);
|
||||
+ return assignable_error();
|
||||
#undef assignable_result
|
||||
#undef parser_yyerror
|
||||
}
|
4926
lang/ruby25/files/patch-parse.c
Normal file
4926
lang/ruby25/files/patch-parse.c
Normal file
File diff suppressed because it is too large
Load diff
45
lang/ruby25/files/patch-parse.y
Normal file
45
lang/ruby25/files/patch-parse.y
Normal file
|
@ -0,0 +1,45 @@
|
|||
--- parse.y.orig 2017-12-21 06:52:15 UTC
|
||||
+++ parse.y
|
||||
@@ -1983,18 +1983,10 @@ mlhs_node : user_variable
|
||||
lhs : user_variable
|
||||
{
|
||||
$$ = assignable(var_field($1), 0, &@$);
|
||||
- /*%%%*/
|
||||
- if (!$$) $$ = new_begin(0, &@$);
|
||||
- /*%
|
||||
- %*/
|
||||
}
|
||||
| keyword_variable
|
||||
{
|
||||
$$ = assignable(var_field($1), 0, &@$);
|
||||
- /*%%%*/
|
||||
- if (!$$) $$ = new_begin(0, &@$);
|
||||
- /*%
|
||||
- %*/
|
||||
}
|
||||
| primary_value '[' opt_call_args rbracket
|
||||
{
|
||||
@@ -9957,11 +9949,13 @@ assignable_gen(struct parser_params *parser, ID id, NO
|
||||
#ifdef RIPPER
|
||||
ID id = get_id(lhs);
|
||||
# define assignable_result(x) (lhs)
|
||||
+# define assignable_error() (lhs)
|
||||
# define parser_yyerror(parser, x) (lhs = assign_error_gen(parser, lhs))
|
||||
#else
|
||||
# define assignable_result(x) assignable_result0(x, location)
|
||||
+# define assignable_error() new_begin(0, location)
|
||||
#endif
|
||||
- if (!id) return assignable_result(0);
|
||||
+ if (!id) return assignable_error();
|
||||
switch (id) {
|
||||
case keyword_self:
|
||||
yyerror0("Can't change the value of self");
|
||||
@@ -10024,7 +10018,7 @@ assignable_gen(struct parser_params *parser, ID id, NO
|
||||
compile_error(PARSER_ARG "identifier %"PRIsVALUE" is not valid to set", rb_id2str(id));
|
||||
}
|
||||
error:
|
||||
- return assignable_result(0);
|
||||
+ return assignable_error();
|
||||
#undef assignable_result
|
||||
#undef parser_yyerror
|
||||
}
|
15
lang/ruby25/files/patch-test_ruby_test__parse.rb
Normal file
15
lang/ruby25/files/patch-test_ruby_test__parse.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
--- test/ruby/test_parse.rb.orig 2017-12-20 00:09:51 UTC
|
||||
+++ test/ruby/test_parse.rb
|
||||
@@ -746,6 +746,12 @@ x = __ENCODING__
|
||||
end
|
||||
END
|
||||
end
|
||||
+ assert_raise(SyntaxError) do
|
||||
+ eval "#{<<~"begin;"}\n#{<<~'end;'}", nil, __FILE__, __LINE__+1
|
||||
+ begin;
|
||||
+ x, true
|
||||
+ end;
|
||||
+ end
|
||||
end
|
||||
|
||||
def test_block_dup
|
Loading…
Reference in a new issue