Skip to content

Fix a Pathname#relative_path_from crash on Windows. #713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

nex3
Copy link

@nex3 nex3 commented Sep 12, 2014

Pathname#relative_path_from uses String#casecmp to compare strings on Windows. This can return nil for strings with different encodings, and the code previously assumed that it always returned a Fixnum.

For example:

Pathname.new("foö".encode("UTF-8")).relative_path_from(
    Pathname.new("bär".encode("ISO-8859-1")))

Pathname#relative_path_from uses String#casecmp to compare strings on
Windows. This can return nil for strings with different encodings, and
the code previously assumed that it always returned a Fixnum.
nex3 added a commit to sass/sass that referenced this pull request Sep 12, 2014
@nobu nobu closed this in 8ae989f Sep 15, 2014
evanphx pushed a commit that referenced this pull request Sep 15, 2014
	* ext/pathname/lib/pathname.rb (SAME_PATHS):
	  Pathname#relative_path_from uses String#casecmp to compare strings
	  on case-insensitive filesystem platforms (e.g., Windows). This can
	  return nil for strings with different encodings, and the code
	  previously assumed that it always returned a Fixnum.  [Fix GH-713]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
evanphx pushed a commit that referenced this pull request Sep 17, 2014
	* ext/pathname/lib/pathname.rb (SAME_PATHS):
	  Pathname#relative_path_from uses String#casecmp to compare strings
	  on case-insensitive filesystem platforms (e.g., Windows). This can
	  return nil for strings with different encodings, and the code
	  previously assumed that it always returned a Fixnum.  [Fix GH-713]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
mmasaki pushed a commit to mmasaki/ruby that referenced this pull request Sep 18, 2014
* ext/pathname/lib/pathname.rb (SAME_PATHS):
  Pathname#relative_path_from uses String#casecmp to compare strings
  on case-insensitive filesystem platforms (e.g., Windows). This can
  return nil for strings with different encodings, and the code
  previously assumed that it always returned a Fixnum.  [Fix rubyGH-713]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
hsbt pushed a commit that referenced this pull request Mar 10, 2015
	* ext/pathname/lib/pathname.rb (SAME_PATHS):
	  Pathname#relative_path_from uses String#casecmp to compare strings
	  on case-insensitive filesystem platforms (e.g., Windows). This can
	  return nil for strings with different encodings, and the code
	  previously assumed that it always returned a Fixnum.  [Fix GH-713]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
hsbt pushed a commit that referenced this pull request Mar 10, 2015
	* ext/pathname/lib/pathname.rb (SAME_PATHS):
	  Pathname#relative_path_from uses String#casecmp to compare strings
	  on case-insensitive filesystem platforms (e.g., Windows). This can
	  return nil for strings with different encodings, and the code
	  previously assumed that it always returned a Fixnum.  [Fix GH-713]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant