From: martin.vahi@...1.com Date: 2016-08-28T18:53:21+00:00 Subject: [ruby-core:77088] [Ruby trunk Bug#12710] "a string X".index("a string") Fails with Ruby 2.2.3p173 Issue #12710 has been updated by Martin Vahi. Interestingly, if the first s_0 assignment of the Ruby script is changed to ~~~ s_0="X"+`cd ..;pwd`.to_s[0..(-2)] ~~~ then it seems to work. ---------------------------------------- Bug #12710: "a string X".index("a string") Fails with Ruby 2.2.3p173 https://bugs.ruby-lang.org/issues/12710#change-60309 * Author: Martin Vahi * Status: Open * Priority: Normal * Assignee: * ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux] * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- The test case: ~~~ #!/usr/bin/env ruby s_0=`cd ..;pwd`.to_s s_1=`cd . ;pwd`.to_s x_0=s_1.index(s_0) puts("s_0=="+s_0) puts("s_1=="+s_1) puts("x_0=="+x_0.to_s) puts("x_0.class=="+x_0.class.to_s) # The console output: # =begin s_0==/home/ts2/tmp/xx10/aa AA s_1==/home/ts2/tmp/xx10/aa AA/bb BB x_0== x_0.class==NilClass =end # # The "ruby -v" gives: =begin ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux] =end ~~~ ---Files-------------------------------- rr.rb (402 Bytes) -- https://bugs.ruby-lang.org/ Unsubscribe: