diff -Nru percona-toolkit-2.2.16/debian/changelog percona-toolkit-2.2.16/debian/changelog --- percona-toolkit-2.2.16/debian/changelog 2015-11-10 20:52:17.000000000 +0800 +++ percona-toolkit-2.2.16/debian/changelog 2019-04-15 15:03:53.000000000 +0800 @@ -1,3 +1,10 @@ +percona-toolkit (2.2.16-1ubuntu0.1) xenial; urgency=low + + * d/p/002-sprintf-warnings.patch: Fix various tools (pt-query-digest, + pt-heartbeat) failing due to sprintf warnings (LP: #1824762) + + -- Trent Lloyd Mon, 15 Apr 2019 15:03:53 +0800 + percona-toolkit (2.2.16-1) unstable; urgency=low * New upstream release (2.2.16) diff -Nru percona-toolkit-2.2.16/debian/control percona-toolkit-2.2.16/debian/control --- percona-toolkit-2.2.16/debian/control 2015-11-10 20:44:27.000000000 +0800 +++ percona-toolkit-2.2.16/debian/control 2018-09-05 10:23:47.000000000 +0800 @@ -1,7 +1,8 @@ Source: percona-toolkit Section: utils Priority: optional -Maintainer: Dario Minnucci +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Dario Minnucci Build-Depends: debhelper (>= 9) Build-Depends-Indep: perl Standards-Version: 3.9.6 diff -Nru percona-toolkit-2.2.16/debian/patches/002-sprintf-warnings.patch percona-toolkit-2.2.16/debian/patches/002-sprintf-warnings.patch --- percona-toolkit-2.2.16/debian/patches/002-sprintf-warnings.patch 1970-01-01 08:00:00.000000000 +0800 +++ percona-toolkit-2.2.16/debian/patches/002-sprintf-warnings.patch 2018-09-05 10:59:33.000000000 +0800 @@ -0,0 +1,383 @@ +Description: Various Perl 5.22 fixes including sprintf errors + Perl 5.22 made some changes which result in many of the tools failing since + strict is enabled and warnigns error. Backported fixes from upstream. + - printf/sprintf now emits a warning if receives more values than described in + the format string. Fixed by adding an index to each format symbol (no + warnings are emitted if they have an index). + - The character multiplier function ( e.g print "=" x $count ) now emits + a warning if $count is negative. +Origin: upstream, https://github.com/percona/percona-toolkit/pull/73 +Last-Update: 2018-09-05 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/bin/pt-diskstats ++++ b/bin/pt-diskstats +@@ -1306,8 +1306,8 @@ + } + return sprintf( + $num =~ m/\./ || $n +- ? "%.${p}f%s" +- : '%d', ++ ? '%1$.'.$p.'f%2$s' ++ : '%1$d', + $num, $units[$n]); + } + +--- a/bin/pt-fk-error-logger ++++ b/bin/pt-fk-error-logger +@@ -2328,8 +2328,8 @@ + } + return sprintf( + $num =~ m/\./ || $n +- ? "%.${p}f%s" +- : '%d', ++ ? '%1$.'.$p.'f%2$s' ++ : '%1$d', + $num, $units[$n]); + } + +--- a/bin/pt-heartbeat ++++ b/bin/pt-heartbeat +@@ -3312,8 +3312,8 @@ + } + return sprintf( + $num =~ m/\./ || $n +- ? "%.${p}f%s" +- : '%d', ++ ? '%1$.'.$p.'f%2$s' ++ : '%1$d', + $num, $units[$n]); + } + +@@ -5275,10 +5275,16 @@ + my $limit = max(@$frames); + + # 2.00s [ 0.05s, 0.01s, 0.00s ] +- my $format = ($hires_ts ? '%.2f' : '%4d') . "s " +- . "[ " . join(", ", map { "%5.2fs" } @$frames) . " ]" +- . ($o->get('print-master-server-id') ? " %d" : '') +- . "\n"; ++ my $format = ($hires_ts ? '%1$.2f' : '%1$4d') . "s [ "; ++ my $findex = 2; ++ foreach (@$frames) { ++ $format .= $findex > 2 ? ', ' : ''; ++ $format .= '%'.$findex.'$5.2fs'; ++ $findex++; ++ } ++ $format .= " ]"; ++ $format .= ($o->get('print-master-server-id') ? ' %'.$findex.'$d' : '') ++ . "\n"; + + # ######################################################################## + # Monitor or update the heartbeat table. +@@ -5413,10 +5419,12 @@ + push @sths, [ $dsn, $sth ]; + } + +- my $format_delay = ($args{hires_ts} ? '%.2f' : '%d') +- . ($o->get('print-master-server-id') ? " %d" : "") ++ my $format_delay = ($args{hires_ts} ? '%1$.2f' : '%1$d') ++ . ($o->get('print-master-server-id') ? ' %2$d' : "") ++ . "\n"; ++ my $format_host = '%1$-20s '.($args{hires_ts} ? '%2$.2f' : '%2$d') ++ . ($o->get('print-master-server-id') ? ' %3$d' : "") + . "\n"; +- my $format_host = "%-20s $format_delay"; + + # Before hi-res ts, we could check all slaves at one interval, assuming + # the checks were fast, i.e. able to be done within one interval. But +--- a/bin/pt-index-usage ++++ b/bin/pt-index-usage +@@ -3530,8 +3530,8 @@ + } + return sprintf( + $num =~ m/\./ || $n +- ? "%.${p}f%s" +- : '%d', ++ ? '%1$.'.$p.'f%2$s' ++ : '%1$d', + $num, $units[$n]); + } + +@@ -4918,11 +4918,10 @@ + last_reported => $args{start}, + fraction => 0, # How complete the job is + callback => sub { +- my ($fraction, $elapsed, $remaining, $eta) = @_; ++ my ($fraction, $elapsed, $remaining) = @_; + printf STDERR "$name: %3d%% %s remain\n", + $fraction * 100, +- Transformers::secs_to_time($remaining), +- Transformers::ts($eta); ++ Transformers::secs_to_time($remaining); + }, + %args, + }; +--- a/bin/pt-kill ++++ b/bin/pt-kill +@@ -2589,8 +2589,8 @@ + } + return sprintf( + $num =~ m/\./ || $n +- ? "%.${p}f%s" +- : '%d', ++ ? '%1$.'.$p.'f%2$s' ++ : '%1$d', + $num, $units[$n]); + } + +--- a/bin/pt-online-schema-change ++++ b/bin/pt-online-schema-change +@@ -3591,11 +3591,10 @@ + last_reported => $args{start}, + fraction => 0, # How complete the job is + callback => sub { +- my ($fraction, $elapsed, $remaining, $eta) = @_; ++ my ($fraction, $elapsed, $remaining) = @_; + printf STDERR "$name: %3d%% %s remain\n", + $fraction * 100, +- Transformers::secs_to_time($remaining), +- Transformers::ts($eta); ++ Transformers::secs_to_time($remaining); + }, + %args, + }; +@@ -6130,8 +6129,8 @@ + } + return sprintf( + $num =~ m/\./ || $n +- ? "%.${p}f%s" +- : '%d', ++ ? '%1$.'.$p.'f%2$s' ++ : '%1$d', + $num, $units[$n]); + } + +--- a/bin/pt-query-digest ++++ b/bin/pt-query-digest +@@ -2555,8 +2555,8 @@ + } + return sprintf( + $num =~ m/\./ || $n +- ? "%.${p}f%s" +- : '%d', ++ ? '%1$.'.$p.'f%2$s' ++ : '%1$d', + $num, $units[$n]); + } + +@@ -6674,9 +6674,9 @@ + report_all => $o->get('report-all'), + report_histogram => $o->get('report-histogram'), + }, +- num_format => "# %-${label_width}s %3s %7s %7s %7s %7s %7s %7s %7s", +- bool_format => "# %-${label_width}s %3d%% yes, %3d%% no", +- string_format => "# %-${label_width}s %s", ++ num_format => '# %1$-'.$label_width.'s %2$3s %3$7s %4$7s %5$7s %6$7s %7$7s %8$7s %9$7s', ++ bool_format => '# %1$-'.$label_width.'s %2$3d%% yes, %3$3d%% no', ++ string_format => '# %1$-'.$label_width.'s %2$s', + hidden_attrib => { # Don't sort/print these attribs in the reports. + arg => 1, # They're usually handled specially, or not + fingerprint => 1, # printed at all. +@@ -7139,7 +7139,11 @@ + $val->{checksum}, + $val->{pos_in_log}, + ); +- $line .= ('_' x (LINE_LENGTH - length($line) + $self->label_width() - 12)); ++ my $underscores = LINE_LENGTH - length($line) + $self->label_width() - 12; ++ if ( $underscores < 0 ) { ++ $underscores = 0; ++ } ++ $line .= ('_' x $underscores); + push @result, $line; + + if ( $val->{reason} ) { +@@ -11118,11 +11122,10 @@ + last_reported => $args{start}, + fraction => 0, # How complete the job is + callback => sub { +- my ($fraction, $elapsed, $remaining, $eta) = @_; ++ my ($fraction, $elapsed, $remaining) = @_; + printf STDERR "$name: %3d%% %s remain\n", + $fraction * 100, +- Transformers::secs_to_time($remaining), +- Transformers::ts($eta); ++ Transformers::secs_to_time($remaining); + }, + %args, + }; +--- a/bin/pt-slave-delay ++++ b/bin/pt-slave-delay +@@ -2582,8 +2582,8 @@ + } + return sprintf( + $num =~ m/\./ || $n +- ? "%.${p}f%s" +- : '%d', ++ ? '%1$.'.$p.'f%2$s' ++ : '%1$d', + $num, $units[$n]); + } + +--- a/bin/pt-slave-find ++++ b/bin/pt-slave-find +@@ -3455,8 +3455,8 @@ + } + return sprintf( + $num =~ m/\./ || $n +- ? "%.${p}f%s" +- : '%d', ++ ? '%1$.'.$p.'f%2$s' ++ : '%1$d', + $num, $units[$n]); + } + +--- a/bin/pt-table-checksum ++++ b/bin/pt-table-checksum +@@ -7930,8 +7930,8 @@ + } + return sprintf( + $num =~ m/\./ || $n +- ? "%.${p}f%s" +- : '%d', ++ ? '%1$.'.$p.'f%2$s' ++ : '%1$d', + $num, $units[$n]); + } + +@@ -8179,11 +8179,10 @@ + last_reported => $args{start}, + fraction => 0, # How complete the job is + callback => sub { +- my ($fraction, $elapsed, $remaining, $eta) = @_; ++ my ($fraction, $elapsed, $remaining) = @_; + printf STDERR "$name: %3d%% %s remain\n", + $fraction * 100, +- Transformers::secs_to_time($remaining), +- Transformers::ts($eta); ++ Transformers::secs_to_time($remaining); + }, + %args, + }; +--- a/bin/pt-table-sync ++++ b/bin/pt-table-sync +@@ -8093,8 +8093,8 @@ + } + return sprintf( + $num =~ m/\./ || $n +- ? "%.${p}f%s" +- : '%d', ++ ? '%1$.'.$p.'f%2$s' ++ : '%1$d', + $num, $units[$n]); + } + +--- a/bin/pt-table-usage ++++ b/bin/pt-table-usage +@@ -1787,24 +1787,26 @@ + use Digest::MD5 qw(md5_hex); + use B qw(); + +-require Exporter; +-our @ISA = qw(Exporter); +-our %EXPORT_TAGS = (); +-our @EXPORT = (); +-our @EXPORT_OK = qw( +- micro_t +- percentage_of +- secs_to_time +- time_to_secs +- shorten +- ts +- parse_timestamp +- unix_timestamp +- any_unix_timestamp +- make_checksum +- crc32 +- encode_json +-); ++BEGIN { ++ require Exporter; ++ our @ISA = qw(Exporter); ++ our %EXPORT_TAGS = (); ++ our @EXPORT = (); ++ our @EXPORT_OK = qw( ++ micro_t ++ percentage_of ++ secs_to_time ++ time_to_secs ++ shorten ++ ts ++ parse_timestamp ++ unix_timestamp ++ any_unix_timestamp ++ make_checksum ++ crc32 ++ encode_json ++ ); ++} + + our $mysql_ts = qr/(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)(\.\d+)?/; + our $proper_ts = qr/(\d\d\d\d)-(\d\d)-(\d\d)[T ](\d\d):(\d\d):(\d\d)(\.\d+)?/; +@@ -1906,8 +1908,8 @@ + } + return sprintf( + $num =~ m/\./ || $n +- ? "%.${p}f%s" +- : '%d', ++ ? '%1$.'.$p.'f%2$s' ++ : '%1$d', + $num, $units[$n]); + } + +@@ -1936,6 +1938,9 @@ + . (defined $f ? '%09.6f' : '%02d'), + $y + 2000, $m, $d, $h, $i, (defined $f ? $s + $f : $s); + } ++ elsif ( $val =~ m/^$proper_ts$/ ) { ++ return $val; ++ } + return $val; + } + +@@ -5351,11 +5356,10 @@ + last_reported => $args{start}, + fraction => 0, # How complete the job is + callback => sub { +- my ($fraction, $elapsed, $remaining, $eta) = @_; ++ my ($fraction, $elapsed, $remaining) = @_; + printf STDERR "$name: %3d%% %s remain\n", + $fraction * 100, +- Transformers::secs_to_time($remaining), +- Transformers::ts($eta); ++ Transformers::secs_to_time($remaining); + }, + %args, + }; +--- a/bin/pt-upgrade ++++ b/bin/pt-upgrade +@@ -2799,8 +2799,8 @@ + } + return sprintf( + $num =~ m/\./ || $n +- ? "%.${p}f%s" +- : '%d', ++ ? '%1$.'.$p.'f%2$s' ++ : '%1$d', + $num, $units[$n]); + } + +@@ -9123,11 +9123,10 @@ + last_reported => $args{start}, + fraction => 0, # How complete the job is + callback => sub { +- my ($fraction, $elapsed, $remaining, $eta) = @_; ++ my ($fraction, $elapsed, $remaining) = @_; + printf STDERR "$name: %3d%% %s remain\n", + $fraction * 100, +- Transformers::secs_to_time($remaining), +- Transformers::ts($eta); ++ Transformers::secs_to_time($remaining); + }, + %args, + }; diff -Nru percona-toolkit-2.2.16/debian/patches/series percona-toolkit-2.2.16/debian/patches/series --- percona-toolkit-2.2.16/debian/patches/series 2015-11-10 20:44:27.000000000 +0800 +++ percona-toolkit-2.2.16/debian/patches/series 2019-04-15 15:03:53.000000000 +0800 @@ -1 +1,2 @@ 001-spelling-error-in-manpages.diff +002-sprintf-warnings.patch