On 9/3/21 4:28 PM, Aaron Conole wrote: > As Frode Nordahl points out in [0], it is possible for the > python regex module to enter a case of catastrophic backtracking > which causes oscillation between states and hangs the checkpatch > script. > > One suggested solution to these cases is to use an anchor[1] in > the regex, which should force the backtrack to exit early. > However, when I tested this, it didn't seem to improve anything > (since the start is already anchored, and trying to anchor the > end results in the same hang). > > Instead, we explicitly check that the line ends with '\\' before > trying to match on the 'if-inside-a-macro' check. A new check > is added to catch the case in checkpatch. > > Signed-off-by: Aaron Conole <[email protected]> > > 0: https://mail.openvswitch.org/pipermail/ovs-dev/2021-August/386881.html > 1: > https://stackoverflow.com/questions/22072406/preventing-any-backtracking-in-regex-past-a-specific-pattern > --- > NOTE: [0] above is accepted in OVN upstream and may require a slightly > modified fix. > > tests/checkpatch.at | 16 ++++++++++++++++ > utilities/checkpatch.py | 10 +++++++--- > 2 files changed, 23 insertions(+), 3 deletions(-)
Applied. Thanks! Best regards, Ilya Maximets. _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
