Skip to content

Commit

Permalink
MDEV-30327 Client crashes in print_last_query_cost
Browse files Browse the repository at this point in the history
Fixed by calling init_pager() before tee_fprintf()
  • Loading branch information
montywi committed Feb 10, 2023
1 parent 8d4bccf commit 1a13dbf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions client/mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4217,7 +4217,10 @@ static void print_last_query_cost()

cur= mysql_fetch_row(result);
if (strtod(cur[1], &end) != 0.0)
{
init_pager();
tee_fprintf(PAGER, "%s: %s\n\n", cur[0], cur[1]);
}

end:
mysql_free_result(result);
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/main/mysql.result
Original file line number Diff line number Diff line change
Expand Up @@ -637,3 +637,6 @@ drop table t1;
WARNING: option '--enable-cleartext-plugin' is obsolete.
1
1
#
# MDEV-30327 Client crashes in print_last_query_cost
#
11 changes: 10 additions & 1 deletion mysql-test/main/mysql.test
Original file line number Diff line number Diff line change
Expand Up @@ -709,10 +709,19 @@ drop table t1;
--echo #
--exec $MYSQL -NHe "select 1 as a"


#
# Test obsolete option --enable-cleartext-plugin
# This should proceed with a warning
#
--echo
--exec $MYSQL test --enable-cleartext-plugin -e "select 1"

--echo #
--echo # MDEV-30327 Client crashes in print_last_query_cost
--echo #

--disable_query_log
--disable_result_log
--exec $MYSQL --show-query-costs --port=$MASTER_MYPORT -e "show tables in mysql like 'foo'"
--enable_result_log
--enable_query_log

0 comments on commit 1a13dbf

Please sign in to comment.