Commit 39739a42 authored by Akhila Maddukuri's avatar Akhila Maddukuri

Description:

```--------
After compiling from source, during make test I got the following error:

test main.loaddata failed with error
CURRENT_TEST: main.loaddata
mysqltest: At line 592: query 'LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1
CHARACTER SET ucs2
(@b) SET a=REVERSE(@b)' failed: 1115: Unknown character set: 'ucs2'

I noticed other tests are skipped because of no ucs2
main.mix2_myisam_ucs2                    [ skipped ]  Test requires:'
have_ucs2'

Should main.loaddata be skipped if there is no ucs2

How To Repeat:
```

----------
Run make test on compiled source that doesn't have ucs2

Suggested fix:
-------------
the failing piece of the test should be moved from mysql-test/t/loaddata.test to
mysql-test/t/ctype_ucs.test.
parent abdb7906
...@@ -191,6 +191,32 @@ t1 CREATE TABLE `t1` ( ...@@ -191,6 +191,32 @@ t1 CREATE TABLE `t1` (
`r` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' `r` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
#
# Bug #51876 : crash/memory underrun when loading data with ucs2
# and reverse() function
#
# Problem # 1 (original report): wrong parsing of ucs2 data
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
# should return 2 zeroes (as the value is truncated)
SELECT * FROM t1;
a
0
1
DROP TABLE t1;
# Problem # 2 : if you write and read ucs2 data to a file they're lost
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
# should return 0 and 1 (10 reversed)
SELECT * FROM t1;
a
0
1
DROP TABLE t1;
create table t2(f1 Char(30)); create table t2(f1 Char(30));
insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000"); insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000");
select lpad(f1, 12, "-o-/") from t2; select lpad(f1, 12, "-o-/") from t2;
......
...@@ -504,35 +504,6 @@ CREATE TABLE t1 (id INT NOT NULL); ...@@ -504,35 +504,6 @@ CREATE TABLE t1 (id INT NOT NULL);
LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1; LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1;
DROP TABLE t1; DROP TABLE t1;
# #
# Bug #51876 : crash/memory underrun when loading data with ucs2
# and reverse() function
#
# Problem # 1 (original report): wrong parsing of ucs2 data
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
Warnings:
Warning 1366 Incorrect integer value: '00' for column 'a' at row 1
Warning 1366 Incorrect integer value: '10' for column 'a' at row 2
# should return 2 zeroes (as the value is truncated)
SELECT * FROM t1;
a
0
0
DROP TABLE t1;
# Problem # 2 : if you write and read ucs2 data to a file they're lost
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
# should return 0 and 1 (10 reversed)
SELECT * FROM t1;
a
0
1
DROP TABLE t1;
#
# Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
# #
CREATE TABLE t1(f1 INT); CREATE TABLE t1(f1 INT);
......
...@@ -68,6 +68,38 @@ RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r; ...@@ -68,6 +68,38 @@ RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
--echo # and reverse() function
--echo #
--echo # Problem # 1 (original report): wrong parsing of ucs2 data
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
--echo # should return 2 zeroes (as the value is truncated)
SELECT * FROM t1;
DROP TABLE t1;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/tmpp.txt;
--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
--echo # should return 0 and 1 (10 reversed)
SELECT * FROM t1;
DROP TABLE t1;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
# #
# BUG3946 # BUG3946
# #
......
...@@ -580,36 +580,40 @@ DROP TABLE t1; ...@@ -580,36 +580,40 @@ DROP TABLE t1;
connection default; connection default;
disconnect con1; disconnect con1;
#############################################################################
# The below protion is moved to ctype_ucs.test #
#############################################################################
#--echo #
#--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
#--echo # and reverse() function
#--echo #
#--echo # Problem # 1 (original report): wrong parsing of ucs2 data
#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
#CREATE TABLE t1(a INT);
#LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
#(@b) SET a=REVERSE(@b);
#--echo # should return 2 zeroes (as the value is truncated)
#SELECT * FROM t1;
#DROP TABLE t1;
#let $MYSQLD_DATADIR= `select @@datadir`;
#remove_file $MYSQLD_DATADIR/test/tmpp.txt;
#--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
#CREATE TABLE t1(a INT);
#LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
#(@b) SET a=REVERSE(@b);
#--echo # should return 0 and 1 (10 reversed)
#SELECT * FROM t1;
#DROP TABLE t1;
#let $MYSQLD_DATADIR= `select @@datadir`;
#remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
######################################################################################
--echo #
--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
--echo # and reverse() function
--echo #
--echo # Problem # 1 (original report): wrong parsing of ucs2 data
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
--echo # should return 2 zeroes (as the value is truncated)
SELECT * FROM t1;
DROP TABLE t1;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/tmpp.txt;
--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
--echo # should return 0 and 1 (10 reversed)
SELECT * FROM t1;
DROP TABLE t1;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
--echo # --echo #
--echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U --echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment