Package: mytop
Version: 1.6-6
Severity: important
Tags: patch

anthony@Zia:~$ mytop --help
"my" variable $up_width masks earlier declaration in same scope at 
/usr/bin/mytop line 864.
Can't call method "Parameters" on an undefined value at /usr/bin/mytop line 136.
anthony@Zia:~ [$?=255]$ 

That's:

if (-e $mycnf)
{
        my $cfgini = new Config::IniFiles( -file => $mycnf );
        my @sections = ('client', 'mytop');

        foreach my $section (@sections) {
                foreach my $param ($cfgini->Parameters ($section))  #### HERE 
####
                {
                        $config{$param} = $cfgini->val($section, $param) if 
exists $config{$param};
                }
        }

Config::IniFiles wants key-value pairs. But that's not the syntax MySQL
requires:

anthony@Zia:~$ head -n5 .my.cnf 
[mysql]
show-warnings
sigint-ignore
prompt="(\u@\h) [\d]> "
pager="less -FXS"

(I've omitted the rest as it contains sensitive information).

Note that 'show-warnings' and 'sigint-ignore' are perfectly valid lines,
but aren't key-value pairs.

The right solution is to switch DBD::mysql's mysql_read_default_file and
mysql_read_default_group. That's a job for upstream though. So, instead,
I've included a patch to just ignore the .my.cnf if it fails to parse.


-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing'), (200, 'unstable'), (150, 'stable'), (100, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.6-trunk-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mytop depends on:
ii  libconfig-inifiles-perl  2.75-1
ii  libdbd-mysql-perl        4.021-1+b1
ii  libdbi-perl              1.622-1
ii  libterm-readkey-perl     2.30-4+b2
ii  perl                     5.14.2-15

mytop recommends no packages.

Versions of packages mytop suggests:
ii  perl [libtime-hires-perl]  5.14.2-15

-- no debconf information
Index: mytop-1.6/mytop
===================================================================
--- mytop-1.6.orig/mytop	2012-11-27 11:57:01.440533690 -0500
+++ mytop-1.6/mytop	2012-11-27 12:01:02.483265315 -0500
@@ -124,9 +124,16 @@
 
 my $mycnf = "$ENV{HOME}/.my.cnf";
 
+my $cfgini;
 if (-e $mycnf)
 {
-	my $cfgini = new Config::IniFiles( -file => $mycnf );
+	$cfgini = new Config::IniFiles( -file => $mycnf );
+	defined $cfgini
+		or warn "Could not parse $mycnf (ignoring)";
+}
+
+if (defined $cfgini)
+{
 	my @sections = ('client', 'mytop');
 
 	foreach my $section (@sections) {

Reply via email to