Bug #105393 Compiled 8.0.27, msql client coredumps on libedit-20191231-3.1/src/terminal.c:34
Submitted: 31 Oct 2021 22:05 Modified: 1 Nov 2021 13:19
Reporter: Ivo Palli Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:8.0.27 OS:Ubuntu (Ubuntu 18.04.6 LTS)
Assigned to: CPU Architecture:x86

[31 Oct 2021 22:05] Ivo Palli
Description:
Compiled 8.0.27 from source. Initialized the database, started mysqld, tried to connect with the temporary password and it immediately crashes.

gdb says:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000055e0fcf7ffac in terminal_alloc (el=0x55e0ff1b27e0, t=<optimized out>, cap=0x66f30410 <error: Cannot access memory at address 0x66f30410>)
    at /home/keymaster/mysql-8.0.27/extra/libedit/libedit-20191231-3.1/src/terminal.c:346
346             if (cap == NULL || *cap == '\0') {
(gdb) backtrace
#0  0x000055e0fcf7ffac in terminal_alloc (el=0x55e0ff1b27e0, t=<optimized out>, cap=0x66f30410 <error: Cannot access memory at address 0x66f30410>)
    at /home/keymaster/mysql-8.0.27/extra/libedit/libedit-20191231-3.1/src/terminal.c:346
#1  0x000055e0fcf80f17 in terminal_set (el=el@entry=0x55e0ff1b27e0, term=<optimized out>, term@entry=0x0) at /home/keymaster/mysql-8.0.27/extra/libedit/libedit-20191231-3.1/src/terminal.c:896
#2  0x000055e0fcf81070 in terminal_init (el=el@entry=0x55e0ff1b27e0) at /home/keymaster/mysql-8.0.27/extra/libedit/libedit-20191231-3.1/src/terminal.c:293
#3  0x000055e0fcf854f0 in el_init_internal (prog=0x7ffd66f31782 "/opt/mysql/bin/mysql", fin=0x7f5c2c99da00 <_IO_2_1_stdin_>, fout=0x7f5c2c99e760 <_IO_2_1_stdout_>, ferr=0x7f5c2c99e680 <_IO_2_1_stderr_>, fdin=0, fdout=fdout@entry=1,
    fderr=2, flags=128) at /home/keymaster/mysql-8.0.27/extra/libedit/libedit-20191231-3.1/src/el.c:137
#4  0x000055e0fcf7d194 in rl_initialize () at /home/keymaster/mysql-8.0.27/extra/libedit/libedit-20191231-3.1/src/readline.c:303
#5  0x000055e0fcf7da95 in read_history (filename=0x55e0ff1a2af0 "/home/keymaster/.mysql_history") at /home/keymaster/mysql-8.0.27/extra/libedit/libedit-20191231-3.1/src/readline.c:1361
#6  0x000055e0fce5c50d in main () at /home/keymaster/mysql-8.0.27/client/mysql.cc:1410
#7  0x00007f5c2c5d3bf7 in __libc_start_main (main=0x55e0fce5be70 <main>, argc=2, argv=0x7ffd66f31158, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffd66f31148) at ../csu/libc-start.c:310
#8  0x000055e0fce5d07a in _start () at /home/keymaster/mysql-8.0.27/include/my_alloc.h:87

How to repeat:
Just try to connect with the server.

I put an strace on the daemon, and it just shows an accept(), so the problem seems completely client-sides. Maybe something ncurses related or something?

I can give you the build instructions I used, binaries, coredumps, anything you need.

Suggested fix:
Some extra checks in terminal.c or in the calling function?
[1 Nov 2021 13:19] MySQL Verification Team
Hi Mr. Palli,

Thank you for your bug report.

We have just built 8.0.27 from source and attempted to reproduce your problem. However, everything works just fine.

You could have several possible causes with your installation. You either have not built our binaries properly, or you have not initialised database correctly.

However, most probable cause is that your Ubuntu is too old for this version, since we build 8.0.27 for Ubuntu 21.

Hence, upgrade your OS and use our binaries.