From e5147c8140450f28505a227159d2feba37dd1c39 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 30 Jan 2024 16:39:28 +0100 Subject: [PATCH] regression introduced by MDEV-14448 --- client/mysql.cc | 3 --- mysql-test/main/mysql-interactive.result | 24 ++++++++++++++++++++ mysql-test/main/mysql-interactive.test | 29 ++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 mysql-test/main/mysql-interactive.result create mode 100644 mysql-test/main/mysql-interactive.test diff --git a/client/mysql.cc b/client/mysql.cc index fe086f29dac..c917501fdc3 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2136,10 +2136,7 @@ static int read_and_execute(bool interactive) the readline/libedit library. */ if (line) - { free(line); - glob_buffer.length(0); - } line= readline(prompt); #ifdef USE_LIBEDIT_INTERFACE /* diff --git a/mysql-test/main/mysql-interactive.result b/mysql-test/main/mysql-interactive.result new file mode 100644 index 00000000000..a18c018b932 --- /dev/null +++ b/mysql-test/main/mysql-interactive.result @@ -0,0 +1,24 @@ +# +# regression introduced by MDEV-14448 +# +delimiter $ +select 1; +$ +Welcome to the MariaDB monitor. Commands end with ; or \g. +Your MariaDB connection id is X +Server version: Y +Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. + +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + +MariaDB [(none)]> delimiter $ +MariaDB [(none)]> select 1; + -> $ ++---+ +| 1 | ++---+ +| 1 | ++---+ +1 row in set + +MariaDB [(none)]> \ No newline at end of file diff --git a/mysql-test/main/mysql-interactive.test b/mysql-test/main/mysql-interactive.test new file mode 100644 index 00000000000..2015e9d667d --- /dev/null +++ b/mysql-test/main/mysql-interactive.test @@ -0,0 +1,29 @@ +--echo # +--echo # regression introduced by MDEV-14448 +--echo # +source include/not_embedded.inc; +source include/not_windows.inc; + +error 0,1; +exec $MYSQL -V|grep -q readline; +if ($sys_errno == 1) +{ + # strangely enough + skip does not work with libedit; +} + +write_file $MYSQL_TMP_DIR/mysql_in; +delimiter $ +select 1; +$ +EOF +let TERM=dumb; +replace_regex /id is \d+/id is X/ /Server version: .*/Server version: Y/ / \(\d+\.\d+ sec\)//; +error 0,127; +exec socat EXEC:"$MYSQL",pty STDIO < $MYSQL_TMP_DIR/mysql_in; +if ($sys_errno == 127) +{ + remove_file $MYSQL_TMP_DIR/mysql_in; + skip no socat; +} +remove_file $MYSQL_TMP_DIR/mysql_in;