Bug #76324 Missing readline features when building with external libedit library
Submitted: 14 Mar 2015 19:38 Modified: 3 Feb 2021 14:46
Reporter: Honza Horak (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.6.23 OS:Linux (Fedora)
Assigned to: CPU Architecture:Any

[14 Mar 2015 19:38] Honza Horak
Description:
There are two issues related to external libedit reported for Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1187469 that non-ASCII characters don't work in interactive mode and https://bugzilla.redhat.com/show_bug.cgi?id=1180403 that backward search doesn't work.

The problem is that mysql binary uses just readline() function from libedit library and this function only offers basic functionality. So generally, the possible fix is either to use el_wgets() function from libedit and configure the backward search feature in mysql binary or fix libedit's readline function to offer this by default (of as another function).

Cross-reporting:
https://mariadb.atlassian.net/browse/MDEV-7777

How to repeat:
1. run mysql client that uses external libedit
2. copy & paste the following clauses in mysql client:
   SELECT 'Chinese characters <汉字> are stripped';
3. '汉字' are stripped out in mysql client
4. press ctrl+R to activate background search in history

Actual results:

MariaDB [(none)]> SELECT 'Chinese characters <> are stripped';
+------------------------------------+
| Chinese characters <> are stripped |
+------------------------------------+
| Chinese characters <> are stripped |
+------------------------------------+

background search in history doesn't work

Expected results:

MariaDB [(none)]> SELECT 'Chinese characters <汉字> are stripped';
+------------------------------------------+
| Chinese characters <汉字> are stripped   |
+------------------------------------------+
| Chinese characters <汉字> are stripped   |
+------------------------------------------+

background search in history works

Reproducible for example with mariadb-10.0.17-1.fc21.
[15 Mar 2015 9:57] Honza Horak
The more I'm thinking about this, the more I believe this should be fixed in system libedit in the first place, some more info at https://bugzilla.redhat.com/show_bug.cgi?id=1202022#c2

However, if mysql wants to support bundled and system libedit in the same way and still be flexible about readline() features, it needs to re-implement this function itself, not just call it from libedit. That's actually my suggestion how it could be fixed in the best case.
[25 Mar 2015 13:43] MySQL Verification Team
Hello Honza Horak,

Thank you for the report and test case.
Observed similar behavior with 5.6.23 source build.

Thanks,
Umesh
[25 Mar 2015 13:44] MySQL Verification Team
test results

Attachment: 76324_results.txt (text/plain), 1.21 MiB.

[27 May 2015 16:46] Alain Brossard
Hi,
   Reproduced 100% of the time using latin-1 chars not in ASCII. Using:
mysql  Ver 14.14 Distrib 5.6.24, for debian-linux-gnu (i686) using  EditLine wrapper

   Using the readline library would fix the issue, this is no longer supported! Which would seem to be the wrong decision in this context.

WITH_READLINE	Use bundled readline library	OFF   removed starting at 5.6.5

Alain
[30 Aug 2015 18:07] Daniël van Eeden
Related:
Bug #33006 	mysql client: editing non-ascii characters fails
Bug #68925 	Compatibility issue with mysql history ("\040" instead of space)
Bug #69991 	MySQL client is broken without readline
[3 Feb 2021 14:46] Paul DuBois
Posted by developer:
 
Fixed in 5.7.30, 8.0.20 by this change:

The bundled libedit library was upgraded to version 3.1.