diff options
author | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2017-03-03 20:12:48 +0200 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2017-03-03 20:12:48 +0200 |
commit | 606a4a48475c95480751755e811e0b6c76ce1c3e (patch) | |
tree | 0fdd33aed4a00ec7e5825e881f59667373873eca | |
parent | 1acfa942edb72fedcf92dd017ae5fef8694382e5 (diff) | |
download | mariadb-git-606a4a48475c95480751755e811e0b6c76ce1c3e.tar.gz |
Post MDEV-11902 Fix test failures in maria and myisam storage engines
my_readline can fail due to missing file. Make my_readline report this
condition separately so that we can catch it and report an appropriate
error message to the user.
-rw-r--r-- | mysql-test/r/myisam-system.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/federated/federated_bug_35333.result | 4 | ||||
-rw-r--r-- | mysql-test/t/symlink-myisam-11902.test | 2 | ||||
-rw-r--r-- | mysys/my_symlink.c | 10 | ||||
-rw-r--r-- | storage/maria/ma_open.c | 5 | ||||
-rw-r--r-- | storage/myisam/mi_open.c | 5 |
6 files changed, 23 insertions, 5 deletions
diff --git a/mysql-test/r/myisam-system.result b/mysql-test/r/myisam-system.result index 65684a3c07b..af5de8f2749 100644 --- a/mysql-test/r/myisam-system.result +++ b/mysql-test/r/myisam-system.result @@ -5,7 +5,7 @@ Warnings: Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") create table t1 (a int) engine=myisam; select * from t1; -ERROR HY000: Can't find file: './test/t1.MYI' (errno: 20 "Not a directory") +ERROR HY000: Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") drop table t1; Warnings: Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") diff --git a/mysql-test/suite/federated/federated_bug_35333.result b/mysql-test/suite/federated/federated_bug_35333.result index 3660be258db..05e4bab8ec5 100644 --- a/mysql-test/suite/federated/federated_bug_35333.result +++ b/mysql-test/suite/federated/federated_bug_35333.result @@ -24,9 +24,9 @@ CREATE TABLE t1 (c1 int) ENGINE=MYISAM; SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_ROWS DATA_LENGTH TABLE_COMMENT -test t1 BASE TABLE NULL NULL NULL NULL Can't find file: './test/t1.MYI' (errno: 2 "Not a directory") +test t1 BASE TABLE NULL NULL NULL NULL Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") Warnings: -Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "Not a directory") +Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") DROP TABLE t1; Warnings: Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") diff --git a/mysql-test/t/symlink-myisam-11902.test b/mysql-test/t/symlink-myisam-11902.test index 7e35ad117d0..426f8e61edc 100644 --- a/mysql-test/t/symlink-myisam-11902.test +++ b/mysql-test/t/symlink-myisam-11902.test @@ -49,7 +49,7 @@ exec rm -r $MYSQLTEST_VARDIR/tmp/foo; exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo; set debug_sync='now SIGNAL run'; connection default; -replace_regex / '.*\/tmp\// 'MYSQLTEST_VARDIR\/tmp\// /31/20/; +replace_regex / '.*\/test\// '.\/test\// /31/20/; error ER_FILE_NOT_FOUND; reap; flush tables; diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c index ed35fff41e9..72648d4c9a8 100644 --- a/mysys/my_symlink.c +++ b/mysys/my_symlink.c @@ -129,6 +129,11 @@ int my_is_symlink(const char *filename __attribute__((unused))) to is guaranteed to never set to a string longer than FN_REFLEN (including the end \0) + + On error returns -1, unless error is file not found, in which case it + is 1. + + Sets my_errno to specific error number. */ int my_realpath(char *to, const char *filename, myf MyFlags) @@ -154,7 +159,10 @@ int my_realpath(char *to, const char *filename, myf MyFlags) if (MyFlags & MY_WME) my_error(EE_REALPATH, MYF(0), filename, my_errno); my_load_path(to, filename, NullS); - result= -1; + if (my_errno == ENOENT) + result= 1; + else + result= -1; } DBUG_RETURN(result); #elif defined(_WIN32) diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c index b37ebb8ff8b..1db85180fcf 100644 --- a/storage/maria/ma_open.c +++ b/storage/maria/ma_open.c @@ -298,6 +298,11 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) realpath_err= my_realpath(name_buff, fn_format(org_name, name, "", MARIA_NAME_IEXT, MY_UNPACK_FILENAME),MYF(0)); + if (realpath_err > 0) /* File not found, no point in looking further. */ + { + DBUG_RETURN(NULL); + } + if (my_is_symlink(org_name) && (realpath_err || mysys_test_invalid_symlink(name_buff))) { diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 31612b0e902..bdb2fdf8447 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -104,6 +104,11 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) realpath_err= my_realpath(name_buff, fn_format(org_name,name,"",MI_NAME_IEXT,4),MYF(0)); + if (realpath_err > 0) /* File not found, no point in looking further. */ + { + DBUG_RETURN(NULL); + } + if (my_is_symlink(org_name) && (realpath_err || mysys_test_invalid_symlink(name_buff))) { |