Pathname#relative_path_from failing when there are certain unicode characters in the path #3396
Milestone
Comments
kares
added a commit
that referenced
this issue
Jun 23, 2017
upper bound check should not halt the loop since we're going pos-- (and there's a chance were able to find a match at a lower position)
this bug slipped quite into oblivion - its an ugly piece show-casing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
jruby-9.0.0.0 :007 > x = "joe"
=> "joe"
jruby-9.0.0.0 :008 > y = "joe/⸀䐀攀氀攀琀攀䴀攀/fred"
=> "joe/⸀䐀攀氀攀琀攀䴀攀/fred"
jruby-9.0.0.0 :009 > Pathname.new(y).relative_path_from(Pathname.new(x))
TypeError: no implicit conversion from nil to integer
from org/jruby/RubyString.java:2870:in []' from /services/medusa/.rvm/rubies/jruby-9.0.0.0/lib/ruby/stdlib/pathname.rb:48:inchop_basename'
from /services/medusa/.rvm/rubies/jruby-9.0.0.0/lib/ruby/stdlib/pathname.rb:113:in cleanpath_aggressive' from /services/medusa/.rvm/rubies/jruby-9.0.0.0/lib/ruby/stdlib/pathname.rb:91:incleanpath'
from /services/medusa/.rvm/rubies/jruby-9.0.0.0/lib/ruby/stdlib/pathname.rb:493:in relative_path_from' from (irb):9:in'
from org/jruby/RubyKernel.java:979:in eval' from org/jruby/RubyKernel.java:1292:inloop'
from org/jruby/RubyKernel.java:1099:in catch' from org/jruby/RubyKernel.java:1099:incatch'
from /services/medusa/.rvm/rubies/jruby-9.0.0.0/bin/irb:13:in `'
Here's the MRI version, which works:
2.2.3 :006 > x = "joe"
=> "joe"
2.2.3 :007 > y = "joe/⸀䐀攀氀攀琀攀䴀攀/fred"
=> "joe/⸀䐀攀氀攀琀攀䴀攀/fred"
2.2.3 :008 > Pathname.new(y).relative_path_from(Pathname.new(x))
=> #Pathname:⸀䐀攀氀攀琀攀䴀攀/fred
I discovered this at the same time as issue #3392. They appear to be different problems, though.
The text was updated successfully, but these errors were encountered: