Skip to content

Convert to lower, not upper, for casecmp#7950

Merged
headius merged 1 commit intojruby:masterfrom
headius:casecmp_sort_bug
Oct 10, 2023
Merged

Convert to lower, not upper, for casecmp#7950
headius merged 1 commit intojruby:masterfrom
headius:casecmp_sort_bug

Conversation

@headius
Copy link
Member

@headius headius commented Oct 9, 2023

This matches the CRuby code at this point, but it's not clear to me how or why it was set up to use the upper case table many years ago.

Fixes #7946

This matches the CRuby code at this point, but it's not clear to
me how or why it was set up to use the upper case table many years
ago.

Fixes jruby#7946
@headius headius added this to the JRuby 9.4.4.0 milestone Oct 9, 2023
@headius
Copy link
Member Author

headius commented Oct 9, 2023

It appears this changed in CRuby around 2.7 timeframe, via this commit by @jeremyevans:

ruby/ruby@082424e

I don't have a good explanation for why this change fixes #7946 except that perhaps the upper case logic is conflicting with arabic characters, which have no upper case. Case folding can also be locale-specific and have other oddities.

@jeremyevans Was that change just made for consistency with the other forms or was there a more specific bug fixed?

@jeremyevans
Copy link
Contributor

The change in ruby/ruby@082424e was made solely for consistency, not to fix a bug.

@headius headius marked this pull request as ready for review October 9, 2023 22:03
headius added a commit to headius/jruby that referenced this pull request Oct 9, 2023
A number of things here seemed odd and did not match CRuby, so I
completed the re-porting based on 3.3 HEAD (master).

It led to a few failures across specs and MRI tests so I am moving
it to a separate PR for investigation.

See jruby#7950
@headius headius merged commit 8ffcb5e into jruby:master Oct 10, 2023
@headius headius deleted the casecmp_sort_bug branch October 10, 2023 03:11
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.

In some cases sorting using String.casecmp results in Comparison method violates its general contract!

2 participants