Below is the list of changes that have just been committed into a local
4.1 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2291 05/06/20 15:07:22 msvensson@neptunus.(none) +3 -0
BUG#9358 mysqldump crashes if tablename starts with \
- Check that the expected error code is returned
mysql-test/t/mysqldump.test
1.35 05/06/20 15:07:19 msvensson@neptunus.(none) +14 -14
Change dummy errors to real error codes.
client/mysqltest.c
1.165 05/06/20 15:07:19 msvensson@neptunus.(none) +29 -5
Check that the error returned from executed program matches the expected error.
client/mysqldump.c
1.190 05/06/20 15:07:19 msvensson@neptunus.(none) +3 -2
Add new error code used when table user selected to dump can not be found in db
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: msvensson
# Host: neptunus.(none)
# Root: /home/msvensson/mysql/bug9358
--- 1.189/client/mysqldump.c 2005-06-17 20:06:56 +02:00
+++ 1.190/client/mysqldump.c 2005-06-20 15:07:19 +02:00
@@ -57,6 +57,7 @@
#define EX_CONSCHECK 3
#define EX_EOM 4
#define EX_EOF 5 /* ferror for output file was got */
+#define EX_ILLEGAL_TABLE 6
/* index into 'show fields from table' */
@@ -2235,14 +2236,14 @@
/* Add found table name to dump_tables list */
if (my_hash_insert(&dump_tables,
(byte*)my_strdup(new_table_name, MYF(0))))
- exit(EX_EOM);
+ exit(EX_EOM);
}
else
{
my_printf_error(0,"Couldn't find table: \"%s\"\n", MYF(0),
*table_names);
- safe_exit(EX_USAGE);
+ safe_exit(EX_ILLEGAL_TABLE);
/* We shall countinue here, if --force was given */
}
}
--- 1.164/client/mysqltest.c 2005-06-17 20:06:56 +02:00
+++ 1.165/client/mysqltest.c 2005-06-20 15:07:19 +02:00
@@ -955,13 +955,37 @@
replace_dynstr_append_mem(ds, buf, strlen(buf));
}
error= pclose(res_file);
-
if (error != 0)
{
- if(q->abort_on_error)
- die("command \"%s\" failed", cmd);
- else
- verbose_msg("command \"%s\" failed, continue anyway ", cmd);
+ uint status= WEXITSTATUS(error);
+ if(q->abort_on_error)
+ die("At line %u: command \"%s\" failed", start_lineno, cmd);
+ else
+ {
+ DBUG_PRINT("info",
+ ("error: %d, status: %d", error, status));
+ bool ok= 0;
+ uint i;
+ for (i=0 ; (uint) i < q->expected_errors ; i++)
+ {
+ DBUG_PRINT("info", ("expected error: %d", q->expected_errno[i].code.errnum));
+ if ((q->expected_errno[i].type == ERR_ERRNO) &&
+ (q->expected_errno[i].code.errnum == status))
+ ok= 1;
+ verbose_msg("At line %u: command \"%s\" failed with expected error: %d",
+ start_lineno, cmd, status);
+ }
+ if (!ok)
+ die("At line: %u: command \"%s\" failed with wrong error: %d",
+ start_lineno, cmd, status);
+ }
+ }
+ else if (q->expected_errno[0].type == ERR_ERRNO &&
+ q->expected_errno[0].code.errnum != 0)
+ {
+ /* Error code we wanted was != 0, i.e. not an expected success */
+ die("At line: %u: command \"%s\" succeeded - should have failed with errno %d...",
+ start_lineno, cmd, q->expected_errno[0].code.errnum);
}
if (!disable_result_log)
--- 1.34/mysql-test/t/mysqldump.test 2005-06-17 20:06:56 +02:00
+++ 1.35/mysql-test/t/mysqldump.test 2005-06-20 15:07:19 +02:00
@@ -559,62 +559,62 @@
select '------ Testing with illegal table names ------' as test_sequence ;
--enable_query_log
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
---error 1000
+--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\d-2-1.sql" 2>&1
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
---error 1000
+--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\t1" 2>&1
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
---error 1000
+--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\t1" 2>&1
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
---error 1000
+--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\\\t1" 2>&1
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
---error 1000
+--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t\1" 2>&1
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
---error 1000
+--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t\\1" 2>&1
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
---error 1000
+--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t/1" 2>&1
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
---error 1000
+--error 6
--exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T_1"
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
---error 1000
+--error 6
--exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T%1"
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
---error 1000
+--error 6
--exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T'1"
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
---error 1000
+--error 6
--exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T_1"
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
---error 1000
+--error 6
--exec $MYSQL_DUMP --compact --skip-comments "mysqldump_test_db" "T_"
--disable_query_log
select '------ Testing with illegal database names ------' as test_sequence ;
--enable_query_log
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
---error 1102
+--error 2
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_d 2>&1
--replace_result $MYSQL_DUMP_DIR MYSQL_DUMP_DIR
---error 1000
+--error 2
--exec $MYSQL_DUMP --compact --skip-comments "mysqld\ump_test_db" 2>&1
drop table t1, t2, t3;
| Thread |
|---|
| • bk commit into 4.1 tree (msvensson:1.2291) BUG#9358 | msvensson | 20 Jun |