mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Add support for minimum field width for strings to my_vsnprintf()
This patch adds support for right aligned strings and numbers. Left alignment is left as an exercise for anyone needing it. MDEV-25612 "Assertion `to <= end' failed in process_args" fixed. (Was caused by the original version of this patch)
This commit is contained in:
@ -7,24 +7,24 @@ INSERT INTO t1 SET b=repeat('a',600);
|
||||
ERROR HY000: The table 't1' is full
|
||||
CHECK TABLE t1 EXTENDED;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Datafile is almost full, 65448 of 65534 used
|
||||
test.t1 check warning Datafile is almost full, 65448 of 65534 used
|
||||
test.t1 check status OK
|
||||
UPDATE t1 SET b=repeat('a', 800) where a=10;
|
||||
ERROR HY000: The table 't1' is full
|
||||
CHECK TABLE t1 EXTENDED;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Datafile is almost full, 65448 of 65534 used
|
||||
test.t1 check warning Datafile is almost full, 65448 of 65534 used
|
||||
test.t1 check status OK
|
||||
INSERT INTO t1 SET b=repeat('a',400);
|
||||
CHECK TABLE t1 EXTENDED;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Datafile is almost full, 65448 of 65534 used
|
||||
test.t1 check warning Datafile is almost full, 65448 of 65534 used
|
||||
test.t1 check status OK
|
||||
DELETE FROM t1 WHERE a=2 or a=6;
|
||||
UPDATE t1 SET b=repeat('a', 600) where a=11;
|
||||
CHECK TABLE t1 EXTENDED;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Datafile is almost full, 65448 of 65534 used
|
||||
test.t1 check warning Datafile is almost full, 65448 of 65534 used
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
set global myisam_data_pointer_size=default;
|
||||
|
@ -187,8 +187,8 @@ connection con1;
|
||||
check table mysqltest_db1.t1;
|
||||
Table Op Msg_type Msg_text
|
||||
mysqltest_db1.t1 check warning 1 client is using or hasn't closed the table properly
|
||||
mysqltest_db1.t1 check error Size of indexfile is: 1024 Should be: 2048
|
||||
mysqltest_db1.t1 check warning Size of datafile is: 14 Should be: 7
|
||||
mysqltest_db1.t1 check error Size of indexfile is: 1024 Should be: 2048
|
||||
mysqltest_db1.t1 check warning Size of datafile is: 14 Should be: 7
|
||||
mysqltest_db1.t1 check error Corrupt
|
||||
# The below statement should fail before repairing t1.
|
||||
# Otherwise info about such repair will be missing from its result-set.
|
||||
@ -201,8 +201,8 @@ check table mysqltest_db1.t1;
|
||||
Table Op Msg_type Msg_text
|
||||
mysqltest_db1.t1 check warning Table is marked as crashed
|
||||
mysqltest_db1.t1 check warning 1 client is using or hasn't closed the table properly
|
||||
mysqltest_db1.t1 check error Size of indexfile is: 1024 Should be: 2048
|
||||
mysqltest_db1.t1 check warning Size of datafile is: 14 Should be: 7
|
||||
mysqltest_db1.t1 check error Size of indexfile is: 1024 Should be: 2048
|
||||
mysqltest_db1.t1 check warning Size of datafile is: 14 Should be: 7
|
||||
mysqltest_db1.t1 check error Corrupt
|
||||
repair table mysqltest_db1.t1;
|
||||
Table Op Msg_type Msg_text
|
||||
|
@ -2644,8 +2644,8 @@ FLUSH TABLES;
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning 1 client is using or hasn't closed the table properly
|
||||
test.t1 check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1 check warning Size of datafile is: 14 Should be: 7
|
||||
test.t1 check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1 check warning Size of datafile is: 14 Should be: 7
|
||||
test.t1 check error Corrupt
|
||||
# Alter table should report error and not auto-repair the table.
|
||||
ALTER TABLE t1 ENGINE = MyISAM;
|
||||
@ -2654,8 +2654,8 @@ CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Table is marked as crashed
|
||||
test.t1 check warning 1 client is using or hasn't closed the table properly
|
||||
test.t1 check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1 check warning Size of datafile is: 14 Should be: 7
|
||||
test.t1 check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1 check warning Size of datafile is: 14 Should be: 7
|
||||
test.t1 check error Corrupt
|
||||
DROP TABLE t1;
|
||||
#
|
||||
|
@ -25,6 +25,6 @@ ERROR HY000: Lost connection to server during query
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning 1 client is using or hasn't closed the table properly
|
||||
test.t1 check error Size of indexfile is: 1024 Should be: 3072
|
||||
test.t1 check error Size of indexfile is: 1024 Should be: 3072
|
||||
test.t1 check error Corrupt
|
||||
DROP TABLE t1;
|
||||
|
@ -69,9 +69,9 @@ flush table t1;
|
||||
# check table is needed to mark the table as crashed.
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Size of datafile is: 42 Should be: 21
|
||||
test.t1 check error Record-count is not ok; is 6 Should be: 3
|
||||
test.t1 check warning Found 6 key parts. Should be: 3
|
||||
test.t1 check warning Size of datafile is: 42 Should be: 21
|
||||
test.t1 check error Record-count is not ok; is 6 Should be: 3
|
||||
test.t1 check warning Found 6 key parts. Should be: 3
|
||||
test.t1 check error Corrupt
|
||||
#
|
||||
# At this point we have a merge table t1_mrg pointing to t1,
|
||||
@ -122,9 +122,9 @@ flush table t1;
|
||||
# Check table is needed to mark the table as crashed.
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Size of datafile is: 14 Should be: 7
|
||||
test.t1 check error Record-count is not ok; is 2 Should be: 1
|
||||
test.t1 check warning Found 2 key parts. Should be: 1
|
||||
test.t1 check warning Size of datafile is: 14 Should be: 7
|
||||
test.t1 check error Record-count is not ok; is 2 Should be: 1
|
||||
test.t1 check warning Found 2 key parts. Should be: 1
|
||||
test.t1 check error Corrupt
|
||||
# At this point we have a corrupt t1
|
||||
set autocommit = 0;
|
||||
|
@ -429,7 +429,7 @@ create table mysqltest1.t1 (a int) engine=myisam;
|
||||
create table t2 (a int);
|
||||
check table mysqltest1.t1;
|
||||
Table Op Msg_type Msg_text
|
||||
mysqltest1.t1 check warning Size of datafile is: 4 Should be: 0
|
||||
mysqltest1.t1 check warning Size of datafile is: 4 Should be: 0
|
||||
mysqltest1.t1 check error got error: 0 when reading datafile at record: 0
|
||||
mysqltest1.t1 check error Corrupt
|
||||
mtr.global_suppressions Table is already up to date
|
||||
@ -464,7 +464,7 @@ mysql.time_zone_transition_type Table is already up to date
|
||||
mysql.transaction_registry OK
|
||||
mysqltest1.t1
|
||||
warning : Table is marked as crashed
|
||||
warning : Size of datafile is: 4 Should be: 0
|
||||
warning : Size of datafile is: 4 Should be: 0
|
||||
error : got error: 0 when reading datafile at record: 0
|
||||
error : Corrupt
|
||||
sys.sys_config Table is already up to date
|
||||
|
9
mysql-test/main/strings.result
Normal file
9
mysql-test/main/strings.result
Normal file
@ -0,0 +1,9 @@
|
||||
#
|
||||
# MDEV-25612 Assertion `to <= end' failed in process_args
|
||||
#
|
||||
SET SESSION default_master_connection=REPEAT('a',190),lc_messages=ru_ru;
|
||||
CHANGE MASTER TO master_host='dummy';
|
||||
START SLAVE sql_thread;
|
||||
CHANGE MASTER TO master_user='user',master_password='pwd';
|
||||
ERROR HY000: \042D\0442\0443 \043E\043F\0435\0440\0430\0446\0438\044E \043D\0435\0432\043E\0437\043C\043E\0436\043D\043E \0432\044B\043F\043E\043B\043D\0438\0442\044C \043F\0440\0438 \0440\0430\0431\043E\0442\0430\044E\0449\0435\043C \043F\043E\0442\043E\043A\0435 \043F\043E\0434\0447\0438\043D\0435\043D\043D\043E\0433\043E \0441\0435\0440\0432\0435\0440\0430 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
STOP SLAVE;
|
16
mysql-test/main/strings.test
Normal file
16
mysql-test/main/strings.test
Normal file
@ -0,0 +1,16 @@
|
||||
--source include/not_windows.inc
|
||||
--source include/not_embedded.inc
|
||||
|
||||
#
|
||||
# Test that exposes problems in string functions like my_vsnprintf
|
||||
#
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-25612 Assertion `to <= end' failed in process_args
|
||||
--echo #
|
||||
SET SESSION default_master_connection=REPEAT('a',190),lc_messages=ru_ru;
|
||||
CHANGE MASTER TO master_host='dummy';
|
||||
START SLAVE sql_thread;
|
||||
--error ER_SLAVE_MUST_STOP
|
||||
CHANGE MASTER TO master_user='user',master_password='pwd';
|
||||
STOP SLAVE;
|
@ -100,7 +100,7 @@ ERROR HY000: Lost connection to server during query
|
||||
* recovery happens
|
||||
check table t1 extended;
|
||||
Table Op Msg_type Msg_text
|
||||
mysqltest.t1 check warning Size of indexfile is: <SIZE> Expected: 8192
|
||||
mysqltest.t1 check warning Size of indexfile is: <SIZE> Expected: 8192
|
||||
mysqltest.t1 check status OK
|
||||
* testing that checksum after recovery is as expected
|
||||
Checksum-check
|
||||
|
@ -54,20 +54,20 @@ insert into t1 (v,b) select v,b from t2;
|
||||
ERROR HY000: The table 't1' is full
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Datafile is almost full, 268230656 of 268320768 used
|
||||
test.t1 check warning Datafile is almost full, 268230656 of 268320768 used
|
||||
test.t1 check status OK
|
||||
insert into t1 values(null, repeat("gh",400),repeat("jkl",10000));
|
||||
ERROR HY000: The table 't1' is full
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Datafile is almost full, 268230656 of 268320768 used
|
||||
test.t1 check warning Datafile is almost full, 268230656 of 268320768 used
|
||||
test.t1 check status OK
|
||||
truncate table t1;
|
||||
insert into t1 (v,b) select v,b from t2;
|
||||
ERROR HY000: The table 't1' is full
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Datafile is almost full, 268230656 of 268320768 used
|
||||
test.t1 check warning Datafile is almost full, 268230656 of 268320768 used
|
||||
test.t1 check status OK
|
||||
drop table t1,t2;
|
||||
create table t1 (
|
||||
@ -135,7 +135,7 @@ count(*)
|
||||
3276
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Datafile is almost full, 65520 of 65535 used
|
||||
test.t1 check warning Datafile is almost full, 65520 of 65535 used
|
||||
test.t1 check status OK
|
||||
create or replace table t1 (
|
||||
c1 int unsigned,
|
||||
@ -172,7 +172,7 @@ count(*)
|
||||
6189940
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Datafile is almost full, 268320768 of 268320768 used
|
||||
test.t1 check warning Datafile is almost full, 268320768 of 268320768 used
|
||||
test.t1 check status OK
|
||||
show table status like "t1";
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
|
||||
|
@ -19,8 +19,8 @@ a
|
||||
Warnings:
|
||||
Error 145 Table 't1_will_crash' is marked as crashed and should be repaired
|
||||
Warning 1034 1 client is using or hasn't closed the table properly
|
||||
Error 1034 Size of indexfile is: 1024 Should be: 2048
|
||||
Warning 1034 Size of datafile is: 77 Should be: 7
|
||||
Error 1034 Size of indexfile is: 1024 Should be: 2048
|
||||
Warning 1034 Size of datafile is: 77 Should be: 7
|
||||
Warning 1034 Number of rows changed from 1 to 11
|
||||
DROP TABLE t1_will_crash;
|
||||
CREATE TABLE t1_will_crash (a INT, KEY (a))
|
||||
@ -48,7 +48,7 @@ a
|
||||
Warnings:
|
||||
Error 145 Table 't1_will_crash#P#p1' is marked as crashed and should be repaired
|
||||
Warning 1034 1 client is using or hasn't closed the table properly
|
||||
Error 1034 Size of indexfile is: 1024 Should be: 2048
|
||||
Warning 1034 Size of datafile is: 28 Should be: 7
|
||||
Error 1034 Size of indexfile is: 1024 Should be: 2048
|
||||
Warning 1034 Size of datafile is: 28 Should be: 7
|
||||
Warning 1034 Number of rows changed from 1 to 4
|
||||
DROP TABLE t1_will_crash;
|
||||
|
@ -16,8 +16,8 @@ FLUSH TABLES;
|
||||
CHECK TABLE tp;
|
||||
Table Op Msg_type Msg_text
|
||||
test.tp check warning 1 client is using or hasn't closed the table properly
|
||||
test.tp check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.tp check warning Size of datafile is: 77 Should be: 7
|
||||
test.tp check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.tp check warning Size of datafile is: 77 Should be: 7
|
||||
test.tp check error Partition pCrashed returned error
|
||||
test.tp check error Corrupt
|
||||
ALTER TABLE tp EXCHANGE PARTITION pCrashed WITH TABLE t;
|
||||
@ -40,8 +40,8 @@ FLUSH TABLES;
|
||||
CHECK TABLE t;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t check warning 1 client is using or hasn't closed the table properly
|
||||
test.t check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t check warning Size of datafile is: 77 Should be: 7
|
||||
test.t check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t check warning Size of datafile is: 77 Should be: 7
|
||||
test.t check error Corrupt
|
||||
ALTER TABLE tp EXCHANGE PARTITION pCrashed WITH TABLE t;
|
||||
ERROR HY000: Table './test/t' is marked as crashed and should be repaired
|
||||
@ -69,8 +69,8 @@ FLUSH TABLES;
|
||||
CHECK TABLE t1_will_crash;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1_will_crash check warning 1 client is using or hasn't closed the table properly
|
||||
test.t1_will_crash check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1_will_crash check warning Size of datafile is: 77 Should be: 7
|
||||
test.t1_will_crash check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1_will_crash check warning Size of datafile is: 77 Should be: 7
|
||||
test.t1_will_crash check error Corrupt
|
||||
REPAIR TABLE t1_will_crash;
|
||||
Table Op Msg_type Msg_text
|
||||
@ -104,8 +104,8 @@ FLUSH TABLES;
|
||||
CHECK TABLE t1_will_crash;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1_will_crash check warning 1 client is using or hasn't closed the table properly
|
||||
test.t1_will_crash check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1_will_crash check warning Size of datafile is: 28 Should be: 7
|
||||
test.t1_will_crash check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1_will_crash check warning Size of datafile is: 28 Should be: 7
|
||||
test.t1_will_crash check error Partition p1 returned error
|
||||
test.t1_will_crash check error Corrupt
|
||||
REPAIR TABLE t1_will_crash;
|
||||
@ -134,16 +134,16 @@ test.t1_will_crash check status OK
|
||||
ALTER TABLE t1_will_crash CHECK PARTITION p0, p1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1_will_crash check warning 1 client is using or hasn't closed the table properly
|
||||
test.t1_will_crash check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1_will_crash check warning Size of datafile is: 28 Should be: 7
|
||||
test.t1_will_crash check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1_will_crash check warning Size of datafile is: 28 Should be: 7
|
||||
test.t1_will_crash check error Partition p1 returned error
|
||||
test.t1_will_crash check error Corrupt
|
||||
ALTER TABLE t1_will_crash CHECK PARTITION p1, p2;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1_will_crash check warning Table is marked as crashed
|
||||
test.t1_will_crash check warning 1 client is using or hasn't closed the table properly
|
||||
test.t1_will_crash check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1_will_crash check warning Size of datafile is: 28 Should be: 7
|
||||
test.t1_will_crash check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1_will_crash check warning Size of datafile is: 28 Should be: 7
|
||||
test.t1_will_crash check error Partition p1 returned error
|
||||
test.t1_will_crash check error Corrupt
|
||||
ALTER TABLE t1_will_crash REPAIR PARTITION p0, p2;
|
||||
@ -195,8 +195,8 @@ FLUSH TABLES;
|
||||
CHECK TABLE t1_will_crash;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1_will_crash check warning 1 client is using or hasn't closed the table properly
|
||||
test.t1_will_crash check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1_will_crash check warning Size of datafile is: 14 Should be: 7
|
||||
test.t1_will_crash check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1_will_crash check warning Size of datafile is: 14 Should be: 7
|
||||
test.t1_will_crash check error Subpartition p1sp0 returned error
|
||||
test.t1_will_crash check error Corrupt
|
||||
REPAIR TABLE t1_will_crash;
|
||||
@ -225,16 +225,16 @@ test.t1_will_crash check status OK
|
||||
ALTER TABLE t1_will_crash CHECK PARTITION all;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1_will_crash check warning 1 client is using or hasn't closed the table properly
|
||||
test.t1_will_crash check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1_will_crash check warning Size of datafile is: 14 Should be: 7
|
||||
test.t1_will_crash check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1_will_crash check warning Size of datafile is: 14 Should be: 7
|
||||
test.t1_will_crash check error Subpartition p1sp0 returned error
|
||||
test.t1_will_crash check error Corrupt
|
||||
ALTER TABLE t1_will_crash CHECK PARTITION p1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1_will_crash check warning Table is marked as crashed
|
||||
test.t1_will_crash check warning 1 client is using or hasn't closed the table properly
|
||||
test.t1_will_crash check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1_will_crash check warning Size of datafile is: 14 Should be: 7
|
||||
test.t1_will_crash check error Size of indexfile is: 1024 Should be: 2048
|
||||
test.t1_will_crash check warning Size of datafile is: 14 Should be: 7
|
||||
test.t1_will_crash check error Subpartition p1sp0 returned error
|
||||
test.t1_will_crash check error Corrupt
|
||||
ALTER TABLE t1_will_crash REPAIR PARTITION p0;
|
||||
@ -331,7 +331,7 @@ test.t1_will_crash optimize warning Number of rows changed from 8 to 7
|
||||
test.t1_will_crash optimize status OK
|
||||
CHECK TABLE t1_will_crash;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1_will_crash check error Size of datafile is: 0 Should be: 164
|
||||
test.t1_will_crash check error Size of datafile is: 0 Should be: 164
|
||||
test.t1_will_crash check error Partition p0 returned error
|
||||
test.t1_will_crash check error Corrupt
|
||||
REPAIR TABLE t1_will_crash;
|
||||
@ -406,7 +406,7 @@ ALTER TABLE t1_will_crash CHECK PARTITION p4;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1_will_crash check warning Table is marked as crashed and last repair failed
|
||||
test.t1_will_crash check warning 1 client is using or hasn't closed the table properly
|
||||
test.t1_will_crash check warning Size of datafile is: 368 Should be: 252
|
||||
test.t1_will_crash check warning Size of datafile is: 368 Should be: 252
|
||||
test.t1_will_crash check error Found 4 keys of 3
|
||||
test.t1_will_crash check error Partition p4 returned error
|
||||
test.t1_will_crash check error Corrupt
|
||||
@ -419,7 +419,7 @@ FLUSH TABLES;
|
||||
# replacing p6 with a crashed MYD file (2) (splitted dynamic record)
|
||||
ALTER TABLE t1_will_crash CHECK PARTITION p6;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1_will_crash check warning Size of datafile is: 868 Should be: 604
|
||||
test.t1_will_crash check warning Size of datafile is: 868 Should be: 604
|
||||
test.t1_will_crash check error Unexpected byte: 0 at link: 340
|
||||
test.t1_will_crash check error Partition p6 returned error
|
||||
test.t1_will_crash check error Corrupt
|
||||
@ -472,9 +472,9 @@ partition b a
|
||||
SET @@optimizer_switch=@save_optimizer_switch;
|
||||
ALTER TABLE t1_will_crash CHECK PARTITION p6;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1_will_crash check warning Size of datafile is: 868 Should be: 604
|
||||
test.t1_will_crash check error Record-count is not ok; is 8 Should be: 7
|
||||
test.t1_will_crash check warning Found 10 key parts. Should be: 7
|
||||
test.t1_will_crash check warning Size of datafile is: 868 Should be: 604
|
||||
test.t1_will_crash check error Record-count is not ok; is 8 Should be: 7
|
||||
test.t1_will_crash check warning Found 10 key parts. Should be: 7
|
||||
test.t1_will_crash check error Partition p6 returned error
|
||||
test.t1_will_crash check error Corrupt
|
||||
ALTER TABLE t1_will_crash REPAIR PARTITION p6;
|
||||
|
@ -224,12 +224,27 @@ err:
|
||||
*/
|
||||
|
||||
static char *process_str_arg(CHARSET_INFO *cs, char *to, const char *end,
|
||||
size_t width, char *par, uint print_type,
|
||||
my_bool nice_cut)
|
||||
longlong length_arg, size_t width, char *par,
|
||||
uint print_type, my_bool nice_cut)
|
||||
{
|
||||
int well_formed_error;
|
||||
uint dots= 0;
|
||||
size_t plen, left_len= (size_t) (end - to) + 1, slen=0;
|
||||
my_bool left_fill= 1;
|
||||
size_t length;
|
||||
|
||||
/*
|
||||
The sign of the length argument specific the string should be right
|
||||
or left adjusted
|
||||
*/
|
||||
if (length_arg < 0)
|
||||
{
|
||||
length= (size_t) -length_arg;
|
||||
left_fill= 0;
|
||||
}
|
||||
else
|
||||
length= (size_t) length_arg;
|
||||
|
||||
if (!par)
|
||||
par = (char*) "(null)";
|
||||
|
||||
@ -239,7 +254,10 @@ static char *process_str_arg(CHARSET_INFO *cs, char *to, const char *end,
|
||||
if (plen > width)
|
||||
plen= width;
|
||||
if (left_len <= plen)
|
||||
{
|
||||
plen = left_len - 1;
|
||||
length= plen;
|
||||
}
|
||||
if ((slen > plen))
|
||||
{
|
||||
if (plen < 3)
|
||||
@ -259,24 +277,34 @@ static char *process_str_arg(CHARSET_INFO *cs, char *to, const char *end,
|
||||
plen= slen= strnlen(par, width);
|
||||
dots= 0;
|
||||
if (left_len <= plen)
|
||||
{
|
||||
plen = left_len - 1;
|
||||
length= plen;
|
||||
}
|
||||
}
|
||||
|
||||
plen= my_well_formed_length(cs, par, par + plen, width, &well_formed_error);
|
||||
if (print_type & ESCAPED_ARG)
|
||||
{
|
||||
const char *org_to= to;
|
||||
to= backtick_string(cs, to, end, par, plen + dots, '`', MY_TEST(dots));
|
||||
plen= (size_t) (to - org_to);
|
||||
dots= 0;
|
||||
}
|
||||
else
|
||||
to= strnmov(to,par,plen);
|
||||
|
||||
if (dots)
|
||||
{
|
||||
for (; dots; dots--)
|
||||
*(to++)= '.';
|
||||
*(to)= 0;
|
||||
if (left_fill)
|
||||
{
|
||||
if (plen + dots < length)
|
||||
to= strfill(to, length - plen - dots, ' ');
|
||||
}
|
||||
to= strnmov(to,par,plen);
|
||||
if (dots)
|
||||
to= strfill(to, dots, '.');
|
||||
}
|
||||
|
||||
if (!left_fill && plen + dots < length)
|
||||
to= strfill(to, length - plen - dots, ' ');
|
||||
return to;
|
||||
}
|
||||
|
||||
@ -494,11 +522,16 @@ start:
|
||||
case 's':
|
||||
case 'T':
|
||||
{
|
||||
longlong min_field_width;
|
||||
char *par= args_arr[print_arr[i].arg_idx].str_arg;
|
||||
width= (print_arr[i].flags & WIDTH_ARG)
|
||||
? (size_t)args_arr[print_arr[i].width].longlong_arg
|
||||
: print_arr[i].width;
|
||||
to= process_str_arg(cs, to, end, width, par, print_arr[i].flags,
|
||||
min_field_width= (print_arr[i].flags & LENGTH_ARG)
|
||||
? args_arr[print_arr[i].length].longlong_arg
|
||||
: (longlong) print_arr[i].length;
|
||||
to= process_str_arg(cs, to, end, min_field_width, width, par,
|
||||
print_arr[i].flags,
|
||||
(print_arr[i].arg_type == 'T'));
|
||||
break;
|
||||
}
|
||||
@ -565,7 +598,7 @@ start:
|
||||
*to++= ' ';
|
||||
*to++= '"';
|
||||
my_strerror(errmsg_buff, sizeof(errmsg_buff), (int) larg);
|
||||
to= process_str_arg(cs, to, real_end, width, errmsg_buff,
|
||||
to= process_str_arg(cs, to, real_end, 0, width, errmsg_buff,
|
||||
print_arr[i].flags, 1);
|
||||
if (real_end > to) *to++= '"';
|
||||
}
|
||||
@ -693,7 +726,8 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
|
||||
if (*fmt == 's' || *fmt == 'T') /* String parameter */
|
||||
{
|
||||
reg2 char *par= va_arg(ap, char *);
|
||||
to= process_str_arg(cs, to, end, width, par, print_type, (*fmt == 'T'));
|
||||
to= process_str_arg(cs, to, end, (longlong) length, width, par,
|
||||
print_type, (*fmt == 'T'));
|
||||
continue;
|
||||
}
|
||||
else if (*fmt == 'b') /* Buffer parameter */
|
||||
@ -751,7 +785,7 @@ size_t my_vsnprintf_ex(CHARSET_INFO *cs, char *to, size_t n,
|
||||
*to++= ' ';
|
||||
*to++= '"';
|
||||
my_strerror(errmsg_buff, sizeof(errmsg_buff), (int) larg);
|
||||
to= process_str_arg(cs, to, real_end, width, errmsg_buff,
|
||||
to= process_str_arg(cs, to, real_end, 0, width, errmsg_buff,
|
||||
print_type, 1);
|
||||
if (real_end > to) *to++= '"';
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ static void test_many(const char **res, const char *fmt, ...)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
plan(47);
|
||||
plan(48);
|
||||
|
||||
test1("Constant string",
|
||||
"Constant string");
|
||||
@ -96,8 +96,11 @@ int main(void)
|
||||
test1("Flag '0' works <0006>",
|
||||
"Flag '0' works <%04d>", 6);
|
||||
|
||||
test1("Width is ignored for strings <x> <y>",
|
||||
"Width is ignored for strings <%04s> <%5s>", "x", "y");
|
||||
test1("Width for strings < x> < y>",
|
||||
"Width for strings <%04s> <%5s>", "x", "y");
|
||||
|
||||
test1("Negative width is ignored for strings < x> < y>",
|
||||
"Negative width is ignored for strings <%-4s> <%-5s>", "x", "y");
|
||||
|
||||
test1("Precision works for strings <abcde>",
|
||||
"Precision works for strings <%.5s>", "abcdef!");
|
||||
|
Reference in New Issue
Block a user