mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-19 17:04:00 +00:00
Add a missing .* to the backtracking explosion fix for 823431
This commit is contained in:
@@ -1229,7 +1229,7 @@ sub print_usage {
|
|||||||
$desc .= ". Optional suffix s=seconds, m=minutes, h=hours, "
|
$desc .= ". Optional suffix s=seconds, m=minutes, h=hours, "
|
||||||
. "d=days; if no suffix, $s is used.";
|
. "d=days; if no suffix, $s is used.";
|
||||||
}
|
}
|
||||||
$desc = join("\n$rpad", grep { $_ } $desc =~ m/(.{0,$rcol})(?:\s+|$)/g);
|
$desc = join("\n$rpad", grep { $_ } $desc =~ m/(.{0,$rcol}(?!\W))(?:\s+|(?<=\W)|$)/g);
|
||||||
$desc =~ s/ +$//mg;
|
$desc =~ s/ +$//mg;
|
||||||
if ( $short ) {
|
if ( $short ) {
|
||||||
$usage .= sprintf(" --%-${maxs}s -%s %s\n", $long, $short, $desc);
|
$usage .= sprintf(" --%-${maxs}s -%s %s\n", $long, $short, $desc);
|
||||||
@@ -4505,7 +4505,7 @@ sub parse_insert {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( my @into = ($query =~ m/
|
if ( my @into = ($query =~ m/
|
||||||
(?=VALUE|SE(?:T|LECT)) # Avoid a backtracking explosion
|
(?=.*?(?:VALUE|SE(?:T|LECT))) # Avoid a backtracking explosion
|
||||||
(?:INTO\s+)? # INTO, optional
|
(?:INTO\s+)? # INTO, optional
|
||||||
(.+?)\s+ # table ref
|
(.+?)\s+ # table ref
|
||||||
(\([^\)]+\)\s+)? # column list, optional
|
(\([^\)]+\)\s+)? # column list, optional
|
||||||
|
@@ -371,7 +371,7 @@ sub parse_insert {
|
|||||||
|
|
||||||
# Parse INTO clause. Literal "INTO" is optional.
|
# Parse INTO clause. Literal "INTO" is optional.
|
||||||
if ( my @into = ($query =~ m/
|
if ( my @into = ($query =~ m/
|
||||||
(?=VALUE|SE(?:T|LECT)) # Avoid a backtracking explosion
|
(?=.*?(?:VALUE|SE(?:T|LECT))) # Avoid a backtracking explosion
|
||||||
(?:INTO\s+)? # INTO, optional
|
(?:INTO\s+)? # INTO, optional
|
||||||
(.+?)\s+ # table ref
|
(.+?)\s+ # table ref
|
||||||
(\([^\)]+\)\s+)? # column list, optional
|
(\([^\)]+\)\s+)? # column list, optional
|
||||||
|
@@ -11,8 +11,6 @@ use warnings FATAL => 'all';
|
|||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use Test::More;
|
use Test::More;
|
||||||
|
|
||||||
use File::Spec;
|
|
||||||
|
|
||||||
use PerconaTest;
|
use PerconaTest;
|
||||||
require "$trunk/bin/pt-query-advisor";
|
require "$trunk/bin/pt-query-advisor";
|
||||||
|
|
||||||
@@ -47,18 +45,20 @@ like(
|
|||||||
my $exit_status;
|
my $exit_status;
|
||||||
$output = output(
|
$output = output(
|
||||||
sub { $exit_status = pt_query_advisor::main(@args,
|
sub { $exit_status = pt_query_advisor::main(@args,
|
||||||
File::Spec->catfile($sample, "bug_823431.log"))
|
"$sample/bug_823431.log")
|
||||||
});
|
},
|
||||||
|
stderr => 1
|
||||||
|
);
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
!$exit_status,
|
!$exit_status,
|
||||||
"Bug 823431: pqa doesn't hang on a big query"
|
"Bug 823431: ptqa doesn't hang on a big query"
|
||||||
);
|
);
|
||||||
|
|
||||||
like(
|
is(
|
||||||
$output,
|
$output,
|
||||||
qr/COL.002/,
|
'',
|
||||||
"Bug 823431: pqa doesn't hang on a big query and finds the correct rule"
|
"Bug 823431: ptqa doesn't hang on a big query and doesn't find an incorrect rule"
|
||||||
);
|
);
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
Reference in New Issue
Block a user