PT-2015 Fix pt-config-diff not sorting flags

Previously, flags would be compared in the exact order they are output
by MySQL, which can result in false negatives if the input ordering does
not match.

Example from the ticket:

```
[root@avvr-dbm51 ~]# pt-config-diff /etc/my.cnf h=localhost,P=3047
1 config difference
Variable                  /etc/my.cnf  avvr-dbm51
========================= ============ ============
myisam_recover_options    FORCE,BACKUP BACKUP,FORCE
```

This commit fixes the issue by sorting the flags before comparison to
ensure that any ordering differences will not report a diff.

Co-authored-by: Jonathan Gnagy <jonathan@therubyist.org>
This commit is contained in:
Hartley McGuire
2025-08-27 16:06:49 +00:00
parent bca6c5bee8
commit 47f7638d60
3 changed files with 32 additions and 0 deletions

View File

@@ -295,6 +295,10 @@ sub _normalize_value {
$val = defined $val ? $val : '';
$val = $alt_val_for{$val} if exists $alt_val_for{$val};
if ( $val =~ m/,/ && !$is_dir && !$base_path) {
$val = join(',', sort(split(',', $val)));
}
if ( $val ) {
if ( $is_dir ) {
$val .= '/' unless $val =~ m/\/$/;