lp:~percona-toolkit-dev/percona-toolkit/fix-917770-pt-config-diff-uninit-value-crash
- Get this branch:
- bzr branch lp:~percona-toolkit-dev/percona-toolkit/fix-917770-pt-config-diff-uninit-value-crash
Branch merges
- Brian Fraser (community): Approve
- Daniel Nichter: Approve
-
Diff: 521 lines (+240/-152)4 files modifiedbin/pt-config-diff (+78/-66)
lib/MySQLConfig.pm (+105/-85)
t/lib/MySQLConfig.t (+26/-1)
t/pt-config-diff/samples/bug_917770.cnf (+31/-0)
Related bugs
Related blueprints
Branch information
- Owner:
- Percona Toolkit developers
- Status:
- Merged
Recent revisions
- 469. By Brian Fraser
-
Refactor _parse_varvals.
Now it takes two arguments: A regexp and a string to match against.
_parse_varvals itself was split in three: _preprocess_varvals,
_parse_varvals, and _process_val.This also modifies the three places that call _parse_varvals; For
two, no real changes were needed, but parse_mysqld() required a fix
to deal with the two final lines of mysqld --help --verbose:To see what values a running MySQL server is using, type
'mysqladmin variables' instead of 'mysqld --verbose --help'. - 468. By Brian Fraser
-
Fix for 917770: Use of uninitialized value in substitution (s///) at pt-config-diff line 1996
This turned out to be two bugs mangled into one.
First, _parse_varvals can deal with (var, undef), but not with (undef).
This is a problem because two of the trhee spots that call
_parse_varvals can return undef because of this:map { $_ =~ m/^([^=
]+)(?:= (.*))?$ / }
grep { $_ !~ m/^\s*#/ } # no # comment lines
split("\n", $mysqld_section)The problem is twofold. First, we are not skipping empty or
whitespace-only lines. That means that the map will fail,
and pass an undef to _parse_varvals. So this ended up in
a triple fix: Make _parse_varvals deal with a sole undef,
skip empty/whitespace lines, and change that map tomap { $_ =~ m/^([^=
]+)(?:= (.*))?$ / ? ($1, $2) : () } so even if the regex fails in the future, no sole undef
will be passed down the chain. - 466. By Brian Fraser
-
Remove the @INC shifts from the test files. This is no longer needed since the tools do their %INC mangling
- 463. By Daniel Nichter
-
Make start-sandbox sed -e MYSQLD in the start script in case mysqld isn't in basedir/bin.
Branch metadata
- Branch format:
- Branch format 7
- Repository format:
- Bazaar repository format 2a (needs bzr 1.16 or later)
- Stacked on:
- lp:percona-toolkit/2.1