Skip to content

Revert "Fix incorrect handling of character range and capitalization … - #59425

Merged
pgovind merged 3 commits into
dotnet:mainfrom
pgovind:regex_regressions
Sep 23, 2021
Merged

pgovind merged 3 commits into
dotnet:mainfrom
pgovind:regex_regressions

Conversation

@pgovind

@pgovind pgovind commented Sep 21, 2021 •

Copy link
Copy Markdown

…in regex (#42282)"

This reverts commit 7c9c347.
Fixes #58958.

This reverts #42282 as the suggested fix for #58958. I'll have a follow up PR to add the reverted tests and disable them for a later fix

cc @danmoseley

@ghost

ghost commented Sep 21, 2021

Copy link
Copy Markdown

Tagging subscribers to this area: @eerhardt, @dotnet/area-system-text-regularexpressions
See info in area-owners.md if you want to be subscribed.

Issue Details

…in regex (#42282)"

This reverts commit 7c9c347.
Fixes #58958.

This reverts #42282 as the suggested fix for #58958. I'll have a follow up PR to add the reverted tests and disable them for a later fix

Author: pgovind
Assignees: -
Labels:

area-System.Text.RegularExpressions

Milestone: -

@jeffhandley jeffhandley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, this was a straight/clean revert with no conflicts; correct?

@pgovind

pgovind commented Sep 21, 2021

Copy link
Copy Markdown
Author

Just to confirm, this was a straight/clean revert with no conflicts; correct?

Yup yup. No conflicts. I verified every single line too locally before putting it up.

@danmoseley

Copy link
Copy Markdown
Contributor

Can we add a test like

Assert.Equal(new Regex("[\u012F-\u0130]", RegexOptions.IgnoreCase).IsMatch("\u0130")), new Regex("[\u012F\u0130]", RegexOptions.IgnoreCase).IsMatch("\u0130")));

That should fail before this change pass after, and presumably continue to pass if we take another run at a fix later.

@jeffhandley

Copy link
Copy Markdown
Member

I had suggested this approach to @pgovind. (#58958 (comment))

I recommend making 2 PRs: 1 that is a simple revert, and one that includes:

  1. Tests that had been added to assert Regex is incorrectly handling casing of some ranges #36149 was fixed, but with the tests marked as ignored, referencing the issue
  2. Tests that illustrate this issue in the simple repro, asserting that with the revert in place, those tests pass

I imagine we'd only port the clean revert PR into 6.0 GA, without porting the extra tests.

@danmoseley / @stephentoub, I thought the lowest-risk thing to port into 6.0 would be the simple revert, and that by backporting this PR we'd be minimizing the risk to 6.0, but then following up with another PR into main to add the tests suggested would be a good place for 7.0 to start out in. Would you rather see the PR to be ported with the fewest lines of code changed as possible in this PR, or in the release?

@stephentoub

Copy link
Copy Markdown
Member

Thanks. I'll defer to Dan, but my preference would be smallest diff from release/6.0.

@pgovind

pgovind commented Sep 21, 2021 •

Copy link
Copy Markdown
Author

Can we add a test like

I thought keeping the revert clean made sense too, so this PR has only the revert. I do have a follow up ready with a unit test similar to the one you're suggesting here: https://github.com/pgovind/runtime/tree/add_regression_tests

If you'd rather see the unit tests as part of this PR, I can push the changes to this branch. Up to you @danmoseley

@danmoseley

Copy link
Copy Markdown
Contributor

I'm fine with it being a strict revert. I could go either way but in this case if we minimized this change I'm not sure whether it would actually make it less risky...

I would prefer to include your tests in this PR, as it's normal to include change+tests together.

Nit - in your branch I don't see a test quite like the one above, only a test for [\u0120-\u0130]. I think it's interesting to also add a quick separate test that forever plainly documents that the two variations must produce the same result.

@pgovind
pgovind marked this pull request as draft September 22, 2021 18:47
@pgovind
pgovind marked this pull request as ready for review September 22, 2021 18:52
@pgovind

pgovind commented Sep 22, 2021

Copy link
Copy Markdown
Author

It wasn't possible to do a clean revert anymore with the source gen changes already merged (tagging @jeffhandley, since you already approved the PR). I did double check the revert here against the original commit and it's as clean as it can be I think.

@pgovind

pgovind commented Sep 22, 2021

Copy link
Copy Markdown
Author

Ok done, now this is a minimal change.

@jeffhandley jeffhandley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @pgovind. Sorry for the poor guidance on how to approach the revert.

@stephentoub stephentoub left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@stephentoub

stephentoub commented Sep 23, 2021 •

Copy link
Copy Markdown
Member

I just realized that you may have written the tests the way you did with the goal of a clean backport to release/6.0. If that's the case, you can ignore my feedback and we can apply it subsequently.

@pgovind
pgovind merged commit ffbcb46 into dotnet:main Sep 23, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect Regex matching in Turkish culture when ignoring case

4 participants