merge revision(s) 64900: [Backport #15190]

Just a shebang is valid code

	[ruby-core:89240] [Bug #15190]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@65113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2018-10-17 08:27:39 +00:00
parent 2aab471a2c
commit 406a08c4d7
3 changed files with 5 additions and 6 deletions

6
ruby.c
View file

@ -1798,11 +1798,7 @@ load_file_internal(VALUE argp_v)
c = rb_io_getbyte(f);
if (c == INT2FIX('#')) {
c = rb_io_getbyte(f);
if (c == INT2FIX('!')) {
line = rb_io_gets(f);
if (NIL_P(line))
return 0;
if (c == INT2FIX('!') && !NIL_P(line = rb_io_gets(f))) {
RSTRING_GETMEM(line, str, len);
warn_cr_in_shebang(str, len);
if ((p = strstr(str, ruby_engine)) == 0) {

View file

@ -337,6 +337,9 @@ class TestRubyOptions < Test::Unit::TestCase
%w[4], [], bug4118)
assert_in_out_err(%w[-x], "#!/bin/sh\n""#!shebang\n""#!ruby\n""puts __LINE__\n",
%w[4], [], bug4118)
assert_ruby_status(%w[], "#!")
assert_in_out_err(%w[-c], "#!", ["Syntax OK"])
end
def test_sflag

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.4.5"
#define RUBY_RELEASE_DATE "2018-10-17"
#define RUBY_PATCHLEVEL 327
#define RUBY_PATCHLEVEL 328
#define RUBY_RELEASE_YEAR 2018
#define RUBY_RELEASE_MONTH 10