-
Notifications
You must be signed in to change notification settings - Fork 743
Sanitize RegexSet input so alternation is properly handled #1756
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
Conversation
One thing to note: This will cause breakages to crates that make incorrect assumptions about how the regex inputs are handled and do not account for the implicitly-added anchors (such as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really sorry for the lag in getting to this, this somehow slipped through my inbox.
This looks fine to me though as you note is a (minor) breaking change.
I've retriggered the CI builds just to confirm they're green but.. would there be a chance of adding a test for this? It should be trivial by specifying the bindgen-flags:
in the test. There should be plenty of examples available but let me know if you find any issue.
Really sorry for the massive lag again.
Sorry this got stalled, I've added a test case. |
This is breaking a couple existing test-cases unfortunately. That needs looking into. Depending on how much of an edge case they are, it may be ok to change their arguments or such. |
Those failures are because of |
I did some research/analysis on dependent crates in #1783 , which might be useful for determining how much this breaks. The list of all uses of |
I think changing those tests to use Thanks again for doing that research. |
0aba94c
to
cbce27c
Compare
74b3867
to
c14079d
Compare
@emilio Now each commit in this branch independently passes tests. I assume this should wait until v0.61.0, whenever that happens, since it is a breaking change, but I thought I would make it clear I think the PR is ready. |
@kulp. Do you think it would make sense to emit a warning if the user still uses |
☔ The latest upstream changes (presumably #2284) made this pull request unmergeable. Please resolve the merge conflicts. |
c14079d
to
ca3d861
Compare
@pvdrz thanks for rebasing. It looks like I missed v0.61.0. Maybe I was being paranoid though, and we could merge this any time, since although it is a breaking change, that becomes visible only the next time we do a release. So maybe there is nothing that should hold this up any longer? I will leave it to your collective judgment since I cannot spend more cycles on it in the near term. |
Oh, now I remember; I was thinking it needed to be ensured not to be released in a point-release like 0.60.5, but instead in a semver-ish breaking release like 0.61.0. Probably this is putting the cart before the horse, and instead we should just merge this, and then make sure the next release bumps the correct version number. |
I'm going to bump versions in this PR and merge it |
697273a
to
8338caa
Compare
8338caa
to
94167f3
Compare
…#1756) * tests: Avoid using globs as regexes * Sanitize regex set input to properly handle alternation * Add test case for alternates/anchors interaction * emit warning if wildcard pattern is used * update changelog and bump versions Co-authored-by: Darren Kulp <[email protected]> Co-authored-by: Christian Poveda <[email protected]>
Resolves #1755 by wrapping the regexes provided to a
RegexSet
in a capture group, so the added anchors work properly with alternation.This doesn't resolve the issue of implicit/hidden regex modifications performed by this crate, which should still be properly documented.