ruby-changes:41949
From: usa <ko1@a...>
Date: Tue, 8 Mar 2016 00:44:38 +0900 (JST)
Subject: [ruby-changes:41949] usa:r54023 (trunk): * ruby.c (warn_cr_in_shebang): meaningless check on DOSISH platforms.
usa 2016-03-08 00:44:34 +0900 (Tue, 08 Mar 2016) New Revision: 54023 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54023 Log: * ruby.c (warn_cr_in_shebang): meaningless check on DOSISH platforms. fixed a test failure introduced at r53998. Modified files: trunk/ChangeLog trunk/ruby.c trunk/test/ruby/test_rubyoptions.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 54022) +++ ChangeLog (revision 54023) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Mar 8 00:42:22 2016 NAKAMURA Usaku <usa@r...> + + * ruby.c (warn_cr_in_shebang): meaningless check on DOSISH platforms. + fixed a test failure introduced at r53998. + Tue Mar 8 00:27:53 2016 CHIKANAGA Tomoyuki <nagachika@r...> * ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb: fix method name typo. Index: ruby.c =================================================================== --- ruby.c (revision 54022) +++ ruby.c (revision 54023) @@ -1668,6 +1668,7 @@ process_options(int argc, char **argv, s https://github.com/ruby/ruby/blob/trunk/ruby.c#L1668 return (VALUE)iseq; } +#ifndef DOSISH static void warn_cr_in_shebang(const char *str, long len) { @@ -1675,6 +1676,7 @@ warn_cr_in_shebang(const char *str, long https://github.com/ruby/ruby/blob/trunk/ruby.c#L1676 rb_warn("shebang line ends with \\r may cause a problem"); } } +#endif struct load_file_arg { VALUE parser; @@ -1723,7 +1725,9 @@ load_file_internal(VALUE argp_v) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1725 line_start++; RSTRING_GETMEM(line, str, len); if (len > 2 && str[0] == '#' && str[1] == '!') { +#ifndef DOSISH if (line_start == 1) warn_cr_in_shebang(str, len); +#endif if ((p = strstr(str+2, ruby_engine)) != 0) { goto start_read; } @@ -1741,7 +1745,9 @@ load_file_internal(VALUE argp_v) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1745 return 0; RSTRING_GETMEM(line, str, len); +#ifndef DOSISH warn_cr_in_shebang(str, len); +#endif if ((p = strstr(str, ruby_engine)) == 0) { /* not ruby script, assume -x flag */ goto search_shebang; Index: test/ruby/test_rubyoptions.rb =================================================================== --- test/ruby/test_rubyoptions.rb (revision 54022) +++ test/ruby/test_rubyoptions.rb (revision 54023) @@ -314,7 +314,7 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L314 assert_in_out_err([{'RUBYOPT' => nil}], "#!ruby -KU -Eutf-8\r\np \"\u3042\"\r\n", ["\"\u3042\""], /shebang line ends with \\r/, - encoding: Encoding::UTF_8) + encoding: Encoding::UTF_8) if /mswin|mingw/ !~ RUBY_PLATFORM bug4118 = '[ruby-dev:42680]' assert_in_out_err(%w[], "#!/bin/sh\n""#!shebang\n""#!ruby\n""puts __LINE__\n", -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/