Bug #105717 mysqlpump crashes if -p flag is used without a password
Submitted: 26 Nov 2021 5:54 Modified: 26 Nov 2021 6:20
Reporter: Jericho Rivera Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: mysqlpump Command-line Client Severity:S3 (Non-critical)
Version:8.0.27, 5.7.36 OS:Any
Assigned to: CPU Architecture:Any
Tags: regression

[26 Nov 2021 5:54] Jericho Rivera
Crashing mysqlpump if used with -p flag expecting to solicit a password in the tty.

[root@test ~]# mysqlpump -p
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Aborted (core dumped)

This works:
[root@test ~]# mysqlpump -ubkp -phello -hlocalhost > test
mysqlpump: [Warning] Using a password on the command line interface can be insecure.
Dump progress: 1/1 tables, 0/0 rows
Dump completed in 154

How to repeat:
Install mysqlpump utility and run mysqlpump -p from the terminal.
[26 Nov 2021 6:16] Jericho Rivera
Forgot to mention that I was testing this on CentOS 8 but I'm not sure if that really mattered or not.
[26 Nov 2021 6:20] MySQL Verification Team
Hello Jericho,

Thank you for the report and test case.
Verified as described.

[26 Nov 2021 6:21] MySQL Verification Team
- 8.0.27

 bin/mysqlpump --version
mysqlpump  Ver 8.0.27 for Linux on x86_64 (MySQL Community Server - GPL)

 bin/mysqlpump -p
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct null not valid
Aborted (core dumped)

(gdb) bt
#0  0x00007f731eb7f387 in raise () from /lib64/libc.so.6
#1  0x00007f731eb80a78 in abort () from /lib64/libc.so.6
#2  0x00007f731f48fa95 in __gnu_cxx::__verbose_terminate_handler() () from /lib64/libstdc++.so.6
#3  0x00007f731f48da06 in ?? () from /lib64/libstdc++.so.6
#4  0x00007f731f48da33 in std::terminate() () from /lib64/libstdc++.so.6
#5  0x00007f731f48dc53 in __cxa_throw () from /lib64/libstdc++.so.6
#6  0x00007f731f4e2857 in std::__throw_logic_error(char const*) () from /lib64/libstdc++.so.6
#7  0x000000000044e6c8 in Mysql::Tools::Base::Options::Password_option::password_callback(char*) ()
#8  0x000000000044e10b in Mysql::Tools::Base::Options::Abstract_option<Mysql::Tools::Base::Options::Password_option>::call_callbacks(char*) ()
#9  0x0000000000448766 in Mysql::Tools::Base::Abstract_program::callback_option_parsed(int, my_option const*, char*) ()
#10 0x0000000000486a0b in my_handle_options(int*, char***, my_option const*, bool (*)(int, my_option const*, char*), char const**, bool) ()
#11 0x000000000044a406 in Mysql::Tools::Base::Abstract_program::run(int, char**) ()
#12 0x000000000040db54 in main ()
(gdb) quit
[26 Nov 2021 6:23] MySQL Verification Team
Looks like regression

 bin/mysqlpump --version
mysqlpump  Ver 8.0.26 for Linux on x86_64 (MySQL Community Server - GPL)

bin/mysqlpump -p
Enter password:
mysqlpump: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) while connecting to the MySQL server
mysqlpump: [ERROR] (11)
Dump process encountered error and will not continue.
[26 Nov 2021 6:24] MySQL Verification Team
-- 5.7 affected as well

 bin/mysqlpump --version
mysqlpump  Ver 1.0.0 Distrib 5.7.36, for linux-glibc2.12 (x86_64)

(gdb) bt
#0  mysql_send_query (mysql=0x0, query=0x22b0f68 "SET SQL_QUOTE_SHOW_CREATE= 1", length=28) at /var/lib/pb2/sb_1-4394188-1631000495.39/mysql-5.7.36/sql-common/client.c:5052
#1  0x0000000000494f71 in mysql_real_query (mysql=0x0, query=<optimized out>, length=<optimized out>) at /var/lib/pb2/sb_1-4394188-1631000495.39/mysql-5.7.36/sql-common/client.c:5066
#2  0x0000000000459ea3 in Mysql::Tools::Base::Mysql_query_runner::run_query_unguarded (this=0x22b10c0, query=...) at /var/lib/pb2/sb_1-4394188-1631000495.39/mysql-5.7.36/client/base/mysql_query_runner.cc:133
#3  0x000000000045a46f in Mysql::Tools::Base::Mysql_query_runner::run_query (this=0x22b10c0, query=...) at /var/lib/pb2/sb_1-4394188-1631000495.39/mysql-5.7.36/client/base/mysql_query_runner.cc:125
#4  0x000000000043f38b in Mysql::Tools::Dump::Thread_specific_connection_provider::get_runner (this=0x22b1060, message_handler=<optimized out>)
    at /var/lib/pb2/sb_1-4394188-1631000495.39/mysql-5.7.36/client/dump/thread_specific_connection_provider.cc:38
#5  0x000000000041dc2e in Mysql::Tools::Dump::Program::execute (this=0xc35f20 <program>, positional_options=std::vector of length 0, capacity 0) at /var/lib/pb2/sb_1-4394188-1631000495.39/mysql-5.7.36/client/dump/program.cc:168
#6  0x0000000000458077 in Mysql::Tools::Base::Abstract_program::run (this=0xc35f20 <program>, argc=0, argv=0x22b14a8) at /var/lib/pb2/sb_1-4394188-1631000495.39/mysql-5.7.36/client/base/abstract_program.cc:105
#7  0x000000000041c065 in main (argc=<optimized out>, argv=<optimized out>) at /var/lib/pb2/sb_1-4394188-1631000495.39/mysql-5.7.36/client/dump/program.cc:292
[9 Feb 2022 12:16] Georgi Kodinov
Posted by developer:
Duplicate of bug #33688141