[MDEV-18688] mytop does not honor settings from ~/.mytop if there is ~/.my.cnf Created: 2019-02-21  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.2.22, 10.3.12
Fix Version/s: 10.4

Type: Bug Priority: Minor
Reporter: Miroslav Lachman Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: regression
Environment:

FreeBSD 11.2-RELEASE-p7 amd64 GENERIC

mariadb103-client-10.3.12
Name : mariadb103-client
Version : 10.3.12
Installed on : Thu Feb 21 16:47:14 2019 CET
Origin : databases/mariadb103-client
Architecture : FreeBSD:11:amd64


Attachments: File patch-scripts_mytop.sh    

 Description   

FreeBSD packages didn't install mytop in versions before 10.3 and I was using mytop as a standalone package for the last 10+ years without any issues. Right after the upgrade from MariaDB 10.1 to 10.3 (and to bundled mytop) it doesn't work anymore. The problem is I have dedicated user account "mytop" specified in ~/.mytop and some other settings in ~/.my.cnf where password for another user account is stored too. MariaDB's version of mytop reads settings from ~/.my.cnf and uses them (different password) for mytop instead of settings from ~/.mytop so mytop cannot connect to database and settings cannot be overridden on commandline too.

I found that MariaDB's version implemented reading of ~/.my.cnf few years ago but it does not work as it should.

from manpage:
mytop will first read the [client] and [mytop] sections from your my.cnf
files. After that it will read the ("~/.mytop") file from your home
directory (if present). These are read before any of your command-line
arguments are processed, so your command-line arguments will override
directives in the config file.

I am not a Perl programmer but I tried to fix it and it works for me now (see attached patch).
I moved around the code for reading ~/.my.cnf and the way ~/.mytop is processed. Now all 3 kinds of configuration parameters are in ARGV and processed in correct order:
1) ~/.my.cnf (actually "my_print_defaults client mytop")
2) ~/.mytop
3) command line options

The later overrides value of earlier options.
Now everything works for me as before the upgrade.


Generated at Thu Feb 08 08:45:59 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.