Bug #94239 mysqlbinlog does not show --login-path support in --help

Submitted: 7 Feb 2019 11:16 Modified: 15 Feb 2019 9:43
Reporter: Ceri Williams Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:8.0 5.7 5.6, 5.6.43, 5.7.25, 8.0.15 OS:Any
Assigned to: CPU Architecture:Any
Tags: mysqlbinlog login-path authentication

[7 Feb 2019 11:16] Ceri Williams
Description:
The mysqlbinlog client has been left behind in time and is the only (relevant) CLI client that does not support --login-path, yet requires authentication in order to use it.

How to repeat:
=> docker run -d --name mysql-8.0 -p 3310 -e MYSQL_ROOT_PASSWORD=my-secret-pw mysql:8.0
c51bada23eace899beedaa314af1d12e37b96e68a90d7dc3157a4472f576aa97

=> docker ps --filter name=mysql                                                    
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                          NAMES
c51bada23eac        mysql:8.0           "docker-entrypoint.s…"   4 seconds ago       Up 1 second         3306/tcp, 33060/tcp, 0.0.0.0:32768->3310/tcp   mysql-8.0

=> docker exec -it mysql-8.0 /bin/bash

root@c51bada23eac:/# mysql_config_editor set --login-path=root --host=localhost --user=root --password
Enter password:

root@c51bada23eac:/# mysql --login-path=root -Bse "show master status"
binlog.000002   155

root@c51bada23eac:/# mysqlbinlog --read-from-remote-server --stop-never --host=localhost --login-path=root binlog.000002
mysqlbinlog: [ERROR] unknown variable 'login-path=root'.

Suggested fix:
Add support for --login-path
[7 Feb 2019 11:43] Georgi Kodinov
Changing the category to replication to reflect better the ownership of mysqlbinlog.
[8 Feb 2019 0:31] Luis Soares
Hi Ceri,

when I try mysqlbinlog, with --login-path specified *before* the other
options, I get no error:

$ ./mysqlbinlog --login-path=root -h 127.0.0.1 -P 13000 --stop-never --read-from-remote-server -u root master-bin.000001
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
(...)

Conversely, when I call the mysql client, with the --login-path specified
*after* the other options, I do get the same error you were observing for
mysqlbinlog:

$ ./mysql -u root -h 127.0.0.1 -P 13000 --login-path=root
mysql: [ERROR] unknown variable 'login-path=root'.

But not if I specified it before the options:

$ ./mysql --login-path=root  -u root -h 127.0.0.1 -P 13000
Welcome to the MySQL monitor.  Commands end with ; or \g.
(...)

Also, when I read the manual, it says:

"4.2.8 Command-Line Options that Affect Option-File Handling

Most MySQL programs that support option files handle the following options.
Because these options affect option-file handling, they must be given on
the command line and not in an option file. To work properly, each of
these options must be given before other options, with these exceptions:",

https://dev.mysql.com/doc/refman/8.0/en/option-file-options.html#option_general_login-path 

Seems that you may be setting the login-path=root argument after some
options when you are calling mysqlbinlog. Can you try set that argument
before any of the other options (like you did for the mysql client) and
check if it works for you?

Thank you!
[8 Feb 2019 0:39] Luis Soares
The correct reference in my previous comment is:

https://dev.mysql.com/doc/refman/8.0/en/option-file-options.html
[8 Feb 2019 11:30] Ceri Williams
Hi Luis

First of all, thanks for the quick response. OK, yes I should have spotted that the placement was off in the test!
However, this was just a quick test intended to show an issue that I had found (and which made me think less):

root@284b4c964bf0:/# ls -1 /usr/bin/mysql* | while read prog; do printf "%d\t%s\n" "$("${prog}" --help 2>/dev/null | fgrep -q login-path && echo 1 || echo 0)" "${prog}"; done
1       /usr/bin/mysql
0       /usr/bin/mysql_config_editor
1       /usr/bin/mysql_secure_installation
0       /usr/bin/mysql_ssl_rsa_setup
0       /usr/bin/mysql_tzinfo_to_sql
1       /usr/bin/mysql_upgrade
1       /usr/bin/mysqladmin
0       /usr/bin/mysqlbinlog
1       /usr/bin/mysqlcheck
0       /usr/bin/mysqld_multi
0       /usr/bin/mysqld_safe
1       /usr/bin/mysqldump
0       /usr/bin/mysqldumpslow
1       /usr/bin/mysqlimport
1       /usr/bin/mysqlpump
1       /usr/bin/mysqlshow
1       /usr/bin/mysqlslap

From this list, the only one that would have been expected to support login-path and didn't appear to based upon --help was mysqlbinlog. I didn't delve through the code, but instead went from past experience of the shared options and so not seeing it in help made me think that it was not present and avoid thinking about its position.

The good news on all accounts is that it does indeed support the option, so I have changed this to an S3 and view it now as a bug in the client help information (or inconsistency with other clients) and updated the synopsis to reflect that.

Thanks!
[8 Feb 2019 13:07] MySQL Verification Team
Thank you for the feedback, verifying to show --login-path support info in --help output.

regards,
Umesh
[15 Feb 2019 9:43] Margaret Fisher
Posted by developer:
 
Help text updates, closing with no changelog entry.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.059 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.