4 ms·
It sounds like an interesting case study. Do these things get reported with a patch?: (a) add a new function that does regular expressions searching / matchin
by gorgoiler 4mo ago
It sounds like an interesting case study. Do these things get reported with a patch?:
(a) add a new function that does regular expressions searching / matching with a resource checker (eg a timer);
(b) write a local linter that reports an error for any use of the builtin regular expression tools;
(c) fix all the lint warnings;
(d) commit the linter.
- jamesfinlayson 4mo agoNo I think he was just looking to raise his profile, not to help.
- edelbitter 4mo agoThis stuff has been brewing for years, but since technically you could fix all instances with minimal StackOverflow downtime [1] and a slightly different pattern, few people worked on either using engines with data structures less prone to the worst case or adding the generic workarounds for those that have them. e.g. in cPython, until 3.11, there was no support for atomic grouping (roughly translation: "never backtrack inside of this expression"). There is little useful advice a linter can give, if there is no predictable-runtime way to express what you want within a single match step, because you really do want to unwind the stack and check for repeats (just without any of the exponential runtime stuff, please). [1]: https://meta.stackoverflow.com/questions/328376/why-does-stack-overflow-use-a-backtracking-regex-implementation https://meta.stackoverflow.com/questions/328376/why-does-sta...
- mmsc 4mo agoalready exists: https://joshua.hu/comparing-redos-detection-tools https://joshua.hu/comparing-redos-detection-tools. `recheck` and `redos-detector` are definitely the best. there's even an eslint plugin for the latter: https://github.com/tjenkinson/eslint-plugin-redos-detector https://github.com/tjenkinson/eslint-plugin-redos-detector