Bug #27636 mysqlbinlog-cp932 and ctype_cp932 tests fails if LC_* variables set to *_*.UTF-8
Submitted: 4 Apr 2007 7:16 Modified: 1 Jun 2007 20:29
Reporter: Valeriy Kravchuk Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S7 (Test Cases)
Version:5.0.38 OS:Solaris (Solaris 10 SPARC)
Assigned to: Alexander Barkov CPU Architecture:Any
Tags: bfsm_2007_05_31, regression

[4 Apr 2007 7:16] Valeriy Kravchuk
Description:
Tests mysqlbinlog-cp932 and ctype_cp932 from the test suite tests fail on Solaris 10 SPARC if LC_* environment variables are set to en_us.UTF-8 (likely - to any value with UTF-8 chracter set). When the variables are set to en_us.ISO8859-1, for example, these tests pass.

These tests passed in previous version, 5.0.36.

How to repeat:
-bash-3.00$ cd mysql-enterprise-gpl-5.0.38-solaris10-sparc-64bit
-bash-3.00$ cd mysql-test/
-bash-3.00$ export LC_MONETARY=en_US.UTF-8
-bash-3.00$ export LC_NUMERIC=en_US.UTF-8
-bash-3.00$ export LC_MESSAGES=en_US.UTF-8
-bash-3.00$ export LC_COLLATE=en_US.UTF-8
-bash-3.00$ export LC_CTYPE=en_US.UTF-8
<n.pl --force mysqlbinlog mysqlbinlog-cp932 ctype_cp932
Logging: ./mysql-test-run.pl --force mysqlbinlog mysqlbinlog-cp932 ctype_cp932
MySQL Version 5.0.38
Skipping ndbcluster, mysqld not compiled with ndbcluster
Setting mysqld to support SSL connections
Using MTR_BUILD_THREAD      = 0
Using MASTER_MYPORT         = 9306
Using MASTER_MYPORT1        = 9307
Using SLAVE_MYPORT          = 9308
Using SLAVE_MYPORT1         = 9309
Using SLAVE_MYPORT2         = 9310
Using IM_PORT               = 9312
Using IM_MYSQLD1_PORT       = 9313
Using IM_MYSQLD2_PORT       = 9314
Killing Possible Leftover Processes
Removing Stale Files
Creating Directories
Installing Master Database
Installing Master Database
Saving snapshot of installed databases
=======================================================
Starting Tests in the 'main' suite

TEST                           RESULT         TIME (ms)
-------------------------------------------------------

mysqlbinlog                    [ pass ]           4543
mysqlbinlog-cp932              [ fail ]

Errors are (from /users/vkravchuk/mysql-enterprise-gpl-5.0.38-solaris10-sparc-64
bit/mysql-test/var/log/mysqltest-time) :
mysqltest: Result length mismatch
(the last lines may be the most important ones)
Below are the diffs between actual and expected results:
-------------------------------------------------------
*** r/mysqlbinlog-cp932.result  Tue Mar 20 22:25:52 2007
--- r/mysqlbinlog-cp932.reject  Wed Apr  4 10:07:49 2007
***************
*** 11,19 ****
  E382BD
  select HEX(f) from t04;
  HEX(f)
! 835C
  select HEX(f) from t4;
  HEX(f)
! 835C
  drop table t3, t4, t03, t04;
  End of 5.0 tests
--- 11,19 ----
  E382BD
  select HEX(f) from t04;
  HEX(f)
! C2835C
  select HEX(f) from t4;
  HEX(f)
! C2835C
  drop table t3, t4, t03, t04;
  End of 5.0 tests
-------------------------------------------------------
Please follow the instructions outlined at
http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html
to find the reason to this problem and how to report this.

Result from queries before failure can be found in r/mysqlbinlog-cp932.log

Stopping All Servers
Restoring snapshot of databases
Resuming Tests

ctype_cp932                    [ fail ]

Errors are (from /users/vkravchuk/mysql-enterprise-gpl-5.0.38-solaris10-sparc-64
bit/mysql-test/var/log/mysqltest-time) :
mysqltest: Result length mismatch
(the last lines may be the most important ones)
Below are the diffs between actual and expected results:
-------------------------------------------------------
*** r/ctype_cp932.result        Tue Mar 20 22:25:52 2007
--- r/ctype_cp932.reject        Wed Apr  4 10:07:52 2007
***************
*** 11353,11368 ****
  a
  a
  drop table t1;
! В?\
! В?\
  c_cp932
! В?\
! В?\
! В?\
! г'?
! г'?
! В?\
! В?\
  set names utf8;
  create table t1 (a text) default character set cp932;
  insert into t1 values (_utf8 0xE38182);
--- 11353,11368 ----
  a
  a
  drop table t1;
! В?\
! В?\
  c_cp932
! В?\
! В?\
! В?\
! п?'г'?
! п?'г'?
! В?\
! В?\
  set names utf8;
  create table t1 (a text) default character set cp932;
  insert into t1 values (_utf8 0xE38182);
-------------------------------------------------------
Please follow the instructions outlined at
http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html
to find the reason to this problem and how to report this.

Result from queries before failure can be found in r/ctype_cp932.log

Stopping All Servers
Restoring snapshot of databases
Resuming Tests

-------------------------------------------------------
Stopping All Servers
Failed 2/3 tests, 33.33% were successful.

The log files in var/log may give you some hint
of what went wrong.
If you want to report this error, please read first the documentation at
http://www.mysql.com/doc/en/MySQL_test_suite.html
The servers where restarted 3 times
Spent 4.543 seconds actually executing testcases

mysql-test-run in default mode: *** Failing the test(s): mysqlbinlog-cp932 ctype
_cp932
mysql-test-run: *** ERROR: there where failing test cases
-bash-3.00$ uname -a
SunOS sol10-sparc-a 5.10 Generic sun4u sparc SUNW,Sun-Fire-V240

Suggested fix:
Test suite should either work in any environment, or set environment needed explicitely, or report that some tests may fail due to different values of environment variables.
[23 May 2007 8:28] Alexander Barkov
The problem can be repeated only with LC_CTYPE variable set.
Other LC_ variables do not seem to be important.

mysqldev@sol10-sparc-a:~/bar/mysql-5.0.41-solaris10-sparc-64bit/mysql-test> LC_CTYPE=en_US.UTF-8 ./mysql-test-run.pl --force mysqlbinlog mysqlbinlog-cp932 ctype_cp932
Logging: ./mysql-test-run.pl --force mysqlbinlog mysqlbinlog-cp932 ctype_cp932
MySQL Version 5.0.41
Using ndbcluster when necessary, mysqld supports it
Setting mysqld to support SSL connections
Using MTR_BUILD_THREAD      = 0
Using MASTER_MYPORT         = 9306
Using MASTER_MYPORT1        = 9307
Using SLAVE_MYPORT          = 9308
Using SLAVE_MYPORT1         = 9309
Using SLAVE_MYPORT2         = 9310
Using NDBCLUSTER_PORT       = 9310
Using IM_PORT               = 9312
Using IM_MYSQLD1_PORT       = 9313
Using IM_MYSQLD2_PORT       = 9314
Killing Possible Leftover Processes
Removing Stale Files
Creating Directories
Installing Master Database
Installing Master Database
Saving snapshot of installed databases
=======================================================
Starting Tests in the 'main' suite

TEST                           RESULT         TIME (ms)
-------------------------------------------------------

mysqlbinlog                    [ pass ]           1622
mysqlbinlog-cp932              [ fail ]

Errors are (from /export/home/mysqldev/bar/mysql-5.0.41-solaris10-sparc-64bit/mysql-test/var/log/mysqltest-time) :
mysqltest: Result length mismatch
(the last lines may be the most important ones)
Below are the diffs between actual and expected results:
-------------------------------------------------------
*** r/mysqlbinlog-cp932.result  Thu Apr 26 21:30:48 2007
--- r/mysqlbinlog-cp932.reject  Wed May 23 11:23:02 2007
***************
*** 11,19 ****
  E382BD
  select HEX(f) from t04;
  HEX(f)
! 835C
  select HEX(f) from t4;
  HEX(f)
! 835C
  drop table t3, t4, t03, t04;
  End of 5.0 tests
--- 11,19 ----
  E382BD
  select HEX(f) from t04;
  HEX(f)
! C2835C
  select HEX(f) from t4;
  HEX(f)
! C2835C
  drop table t3, t4, t03, t04;
  End of 5.0 tests
-------------------------------------------------------
Please follow the instructions outlined at
http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html
to find the reason to this problem and how to report this.

Result from queries before failure can be found in r/mysqlbinlog-cp932.log

Stopping All Servers
Restoring snapshot of databases
Resuming Tests

ctype_cp932                    [ fail ]

Errors are (from /export/home/mysqldev/bar/mysql-5.0.41-solaris10-sparc-64bit/mysql-test/var/log/mysqltest-time) :
mysqltest: Result length mismatch
(the last lines may be the most important ones)
Below are the diffs between actual and expected results:
-------------------------------------------------------
*** r/ctype_cp932.result        Thu Apr 26 21:30:42 2007
--- r/ctype_cp932.reject        Wed May 23 11:23:04 2007
***************
*** 11353,11368 ****
  a
  a
  drop table t1;
! \
! \
  c_cp932
! \
! \
! \
! ソ
! ソ
! \
! \
  set names utf8;
  create table t1 (a text) default character set cp932;
  insert into t1 values (_utf8 0xE38182);
--- 11353,11368 ----
  a
  a
  drop table t1;
! \
! \
  c_cp932
! \
! \
! \
! ツソ
! ツソ
! \
! \
  set names utf8;
  create table t1 (a text) default character set cp932;
  insert into t1 values (_utf8 0xE38182);
-------------------------------------------------------
Please follow the instructions outlined at
http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html
to find the reason to this problem and how to report this.

Result from queries before failure can be found in r/ctype_cp932.log

Stopping All Servers
Restoring snapshot of databases
Resuming Tests

-------------------------------------------------------
Stopping All Servers
Failed 2/3 tests, 33.33% were successful.

The log files in var/log may give you some hint
of what went wrong.
If you want to report this error, please read first the documentation at
http://www.mysql.com/doc/en/MySQL_test_suite.html
The servers where restarted 3 times
Spent 1.622 seconds actually executing testcases

mysql-test-run in default mode: *** Failing the test(s): mysqlbinlog-cp932 ctype_cp932
mysql-test-run: *** ERROR: there where failing test cases
mysqldev@sol10-sparc-a:~/bar/mysql-5.0.41-solaris10-sparc-64bit/mysql-test>
[23 May 2007 10:30] Alexander Barkov
test file

Attachment: char83.test (application/octet-stream, text), 15 bytes.

[23 May 2007 10:30] Alexander Barkov
result file with LC_CTYPE set to en_US.ISO8859-1

Attachment: char83.result.iso88591 (application/octet-stream, text), 2 bytes.

[23 May 2007 10:31] Alexander Barkov
result file with LC_CTYPE set to en_US.UTF-8

Attachment: char83.result.utf8 (application/octet-stream, text), 3 bytes.

[23 May 2007 10:38] Alexander Barkov
This bug has nothing common with character set implementation in MySQL.
This is a problem in mysql-test-run. The attached files demonstrate this
problem.

How to repeat:

1. put char83.test into mysql-test/t/char83.test
2. put char83.result.iso88591 into mysql-test/t/char83.result
3. run "./mysql-test-run char83" - it will succeed.
4. run "LC_CTYPE=en_US.UTF-8 ./mysql-test-run char83 - it will fail.

5. now put char83.result.utf8 into mysql-test/t/char83.result
6. run "LC_CTYPE=en_US.UTF-8 ./mysql-test-run char83 - it will succeed.
7. run "./mysql-test-run char83" - it will fail.

I.e. the file char83.test (with byte 0x83 inside) makes "mysql-test-run"
output different results, which depend on locale settings.

Note, this problem does not show up on Fedore Core 6.
So, this is probably a problem specific to Sun.
[23 May 2007 10:44] Alexander Barkov
As MySQL character set tests can print results in many character sets
(latin1, utf8-8, sjis, cp932 and others) - its output can be incompatible
with the current locale settings, which obviously makes PERL confuse.

The best solution would be to ignore the current locale settings
and reset locale to "C". That should be done inside "mysql-test-run.pl".
[23 May 2007 11:29] 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/27206

ChangeSet@1.2439, 2007-05-23 16:23:28+05:00, bar@mysql.com +1 -0
  Bug#27636 mysqlbinlog-cp932 and ctype_cp932 tests fails if LC_* variables set to *_*.UTF-8
  
  As MySQL character set tests can print results in many character sets
  (latin1, utf8-8, sjis, cp932 and others) - its output can be incompatible
  with the current locale settings, which makes PERL confuse.
  
  Fix: reset LC_ALL and LC_CTYPE to "C", which is compatible with
  any character set.
[23 May 2007 12:38] 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/27213

ChangeSet@1.2439, 2007-05-23 17:32:40+05:00, bar@mysql.com +1 -0
  Bug#27636 mysqlbinlog-cp932 and ctype_cp932 tests fails if LC_* variables set to *_*.UTF-8
  
  As MySQL character set tests can print results in many character sets
  (latin1, utf8-8, sjis, cp932 and others) - its output can be incompatible
  with the current locale settings, which makes PERL confuse.
  
  Fix: reset LC_ALL and LC_CTYPE to "C", which is compatible with
  any character set.
[23 May 2007 13:20] 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/27216

ChangeSet@1.2439, 2007-05-23 17:27:30+05:00, bar@mysql.com +1 -0
  Bug#27636 mysqlbinlog-cp932 and ctype_cp932 tests fails if LC_* variables set to *_*.UTF-8
  
  As MySQL character set tests can print results in many character sets
  (latin1, utf8-8, sjis, cp932 and others) - its output can be incompatible
  with the current locale settings, which makes PERL confuse.
  
  Fix: reset LC_ALL and LC_CTYPE to "C", which is compatible with
  any character set.
[23 May 2007 19:31] Sergey Vojtovich
ok to push.
[24 May 2007 3:34] Alexander Barkov
Pushed into 5.0.42-rpl.
TODO: push into 5.1.x.
[24 May 2007 7:38] Alexander Barkov
Pushed into 5.1.18-rpl
[1 Jun 2007 19:20] Bugs System
Pushed into 5.0.44
[1 Jun 2007 19:23] Bugs System
Pushed into 5.1.20-beta
[1 Jun 2007 20:29] Paul DuBois
Test suite change. No changelog entry needed.