Bug #46310 mysql not handling <BACKSPACE> properly with multi-byte chars
Submitted: 20 Jul 2009 15:24 Modified: 25 Nov 2009 14:51
Reporter: Matthew Lord Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1.37, 5.0.84 OS:Any
Assigned to: Jim Winstead CPU Architecture:Any
Tags: backspace, mult-byte char, MySQL

[20 Jul 2009 15:24] Matthew Lord
Description:
Using a UTF8 enabled terminal:

mysql test

mysql> set names utf8;

mysql> show tab°<BACKSPACE>les;

mysql> <UP ARROW>

How to repeat:
Using a UTF8 enabled terminal:

mysql test

mysql> set names utf8;

mysql> show tab°<BACKSPACE>les;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tab�les' at line 1

mysql> show tab�les;

Suggested fix:
It looks like <BACKSPACE> is not multi-byte character aware.  Can we change this?  It appears to work fine with readline so we should be able to do it
as well.
[1 Aug 2009 0:49] Jim Winstead
There are two problems here: libedit doesn't support multi-byte character sets, so it will be broken as long as it is not supported there. For readline, we aren't testing for all the necessary functions for multi-byte support, so it doesn't even try to deal with them. We can fix it for readline, but not libedit.
[1 Aug 2009 0:49] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/79837

3054 Jim Winstead	2009-07-31
      Not all of the necessary tests for multi-byte support in readline
      were included in the configure tests. (Bug #46310)
[5 Aug 2009 20:33] Jim Winstead
Queued to 5.1-bugteam, will be merged up to mysql-pe.
[9 Sep 2009 19:42] Sveta Smirnova
See similar bug #47201
[14 Sep 2009 16:04] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090914155317-m1g9wodmndzdj4l1) (version source revid:alik@sun.com-20090914155317-m1g9wodmndzdj4l1) (merge vers: 5.4.4-alpha) (pib:11)
[14 Sep 2009 19:48] Jim Winstead
The configure tests were updated to properly detect multi-byte support on the operating system, which will allow  backspace to function properly in multi-byte environments.
[14 Sep 2009 19:50] Jim Winstead
This only fixes the behavior with readline -- libedit simply doesn't support multi-byte character sets properly.
[23 Sep 2009 20:36] Paul DuBois
Noted in 5.4.4 changelog.

mysql did not handle backspace properly for multi-byte characters.
This has been fixed now if mysql is linked with the readline library.
It is not fixed if mysql is linked with libedit, which does not
contain the necessary support for multi-byte character sets.

Setting report to NDI pending push into 5.1.x.
[1 Oct 2009 5:59] Bugs System
Pushed into 5.1.39-ndb-6.3.28 (revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (version source revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (merge vers: 5.1.39-ndb-6.3.28) (pib:11)
[1 Oct 2009 7:25] Bugs System
Pushed into 5.1.39-ndb-7.0.9 (revid:jonas@mysql.com-20091001072547-kv17uu06hfjhgjay) (version source revid:jonas@mysql.com-20091001071652-irejtnumzbpsbgk2) (merge vers: 5.1.39-ndb-7.0.9) (pib:11)
[1 Oct 2009 13:25] Bugs System
Pushed into 5.1.39-ndb-7.1.0 (revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (version source revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (merge vers: 5.1.39-ndb-7.1.0) (pib:11)
[5 Oct 2009 10:50] Bugs System
Pushed into 5.1.39-ndb-6.2.19 (revid:jonas@mysql.com-20091005103850-dwij2dojwpvf5hi6) (version source revid:jonas@mysql.com-20090930185117-bhud4ek1y0hsj1nv) (merge vers: 5.1.39-ndb-6.2.19) (pib:11)
[6 Oct 2009 23:14] Paul DuBois
Setting report to NDI pending push into 5.1.x.
[7 Oct 2009 14:51] Paul DuBois
The 5.4 fix has been pushed to 5.4.2.
[25 Nov 2009 2:48] Jim Winstead
This patch did make it into the 5.1 tree in either the 5.1.38 or 5.1.39 timeframe. An inspection of config/ac-macros/readline.m4 should make it obvious, look for "AC_CHECK_FUNC(wctype".
[25 Nov 2009 14:51] Paul DuBois
Thanks for the hint. It appeared in 5.1.38.

Noted in 5.1.38 changelog.