Bug #27562 ascii.xml invalid?
Submitted: 31 Mar 2007 13:22 Modified: 25 Aug 2007 16:23
Reporter: Masahiro Tomita Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Charsets Severity:S3 (Non-critical)
Version:5.0.40-BK, 5.0.37 OS:Linux (Linux)
Assigned to: Chad MILLER CPU Architecture:Any
Tags: Contribution

[31 Mar 2007 13:22] Masahiro Tomita
Description:
On ascii charset, 'e' matches '`' and 'y' matches '~'.

How to repeat:
mysql> set names ascii;
Query OK, 0 rows affected (0.01 sec)

mysql> select 'e'='`';
+---------+
| 'e'='`' |
+---------+
|       1 | 
+---------+
1 row in set (0.00 sec)

mysql> select 'y'='~';
+---------+
| 'y'='~' |
+---------+
|       1 | 
+---------+
1 row in set (0.01 sec)

Suggested fix:
$ diff -u sql/share/charsets/ascii.xml.orig sql/share/charsets/ascii.xml
--- sql/share/charsets/ascii.xml.orig   2007-03-31 22:21:15.000000000 +0900
+++ sql/share/charsets/ascii.xml        2007-03-26 00:04:56.000000000 +0900
@@ -117,9 +117,9 @@
  20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
  30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
  40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F
- 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 59 7F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
  80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
  90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
  A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
[31 Mar 2007 18:05] Valeriy Kravchuk
Thank you for a bug report and contributed patch. Verified just as described with latest 5.0.40-BK.
[6 Aug 2007 12:24] Chad MILLER
Hrm.  I'd think this is at least P2.  

I'm talking it since it has a contributed patch.
[6 Aug 2007 14:40] 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/32144

ChangeSet@1.2500, 2007-08-06 10:37:35-04:00, cmiller@zippy.cornsilk.net +3 -0
  Bug#27562: ascii.xml invalid?
  
  Two character mappings were way off (backtick and tilde were "E"
  and "Y"!), and three others were slightly rotated.  The first 
  would cause collisions, and the latter was probably benign.
  
  Now, assign the character mappings exactly to their normal values.
[7 Aug 2007 7:04] Alexander Barkov
Chad, the patch for ascii.xml is ok.

However, you also need to do the following:

cd strings
./conf_to_src ../sql/share/charsets/ >ctype-extra.c

Then make sure that it has changed according to ascii.xml changes:

bk diffs ctype-extra.c

and commit it together with ascii.xml
[7 Aug 2007 7:09] Alexander Barkov
Also, the test looks where huge.

I suggest the following:

# Create a table with an ASCII column
CREATE TABLE t1 (a char(1) character set ascii);

# Populate the table with all values 0x00..0xFF
INSERT INTO t1 VALUES (0x00), (0x01), (0x02),..., (0xFF);

# Join the table to itself to find characters equal to each other:
SELECT t11.a, t12.a
FROM t1 as t11, t2 as t22
WHERE t11.a=t12.a
ORDER BY BINARY t11.a, BINARY t12.a;
[7 Aug 2007 9:37] 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/32186

ChangeSet@1.2500, 2007-08-07 05:35:20-04:00, cmiller@zippy.cornsilk.net +4 -0
  Bug#27562: ascii.xml invalid?
  
  Two character mappings were way off (backtick and tilde were "E"
  and "Y"!), and three others were slightly rotated.  The first 
  would cause collisions, and the latter was probably benign.
  
  Now, assign the character mappings exactly to their normal values.
[7 Aug 2007 10:27] Alexander Barkov
The patch http://lists.mysql.com/commits/32186 is ok to push.
[20 Aug 2007 10:05] Bugs System
Pushed into 5.0.48
[20 Aug 2007 10:20] Bugs System
Pushed into 5.1.22-beta
[25 Aug 2007 16:23] Paul DuBois
Noted in 5.0.48, 5.1.22 changelogs.

Some character mappings in the ascii.xml file were incorrect.
[31 Aug 2007 16:59] Paul DuBois
This was pushed to 5.1.23, not 5.1.22.