Skip to content

Commit 606a4a4

Browse files
committed
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.
1 parent 1acfa94 commit 606a4a4

File tree

6 files changed

+23
-5
lines changed

6 files changed

+23
-5
lines changed

mysql-test/r/myisam-system.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Warnings:
55
Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
66
create table t1 (a int) engine=myisam;
77
select * from t1;
8-
ERROR HY000: Can't find file: './test/t1.MYI' (errno: 20 "Not a directory")
8+
ERROR HY000: Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
99
drop table t1;
1010
Warnings:
1111
Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")

mysql-test/suite/federated/federated_bug_35333.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ CREATE TABLE t1 (c1 int) ENGINE=MYISAM;
2424
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
2525
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
2626
TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_ROWS DATA_LENGTH TABLE_COMMENT
27-
test t1 BASE TABLE NULL NULL NULL NULL Can't find file: './test/t1.MYI' (errno: 2 "Not a directory")
27+
test t1 BASE TABLE NULL NULL NULL NULL Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
2828
Warnings:
29-
Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "Not a directory")
29+
Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
3030
DROP TABLE t1;
3131
Warnings:
3232
Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")

mysql-test/t/symlink-myisam-11902.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
4949
exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo;
5050
set debug_sync='now SIGNAL run';
5151
connection default;
52-
replace_regex / '.*\/tmp\// 'MYSQLTEST_VARDIR\/tmp\// /31/20/;
52+
replace_regex / '.*\/test\// '.\/test\// /31/20/;
5353
error ER_FILE_NOT_FOUND;
5454
reap;
5555
flush tables;

mysys/my_symlink.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ int my_is_symlink(const char *filename __attribute__((unused)))
129129
130130
to is guaranteed to never set to a string longer than FN_REFLEN
131131
(including the end \0)
132+
133+
On error returns -1, unless error is file not found, in which case it
134+
is 1.
135+
136+
Sets my_errno to specific error number.
132137
*/
133138

134139
int my_realpath(char *to, const char *filename, myf MyFlags)
@@ -154,7 +159,10 @@ int my_realpath(char *to, const char *filename, myf MyFlags)
154159
if (MyFlags & MY_WME)
155160
my_error(EE_REALPATH, MYF(0), filename, my_errno);
156161
my_load_path(to, filename, NullS);
157-
result= -1;
162+
if (my_errno == ENOENT)
163+
result= 1;
164+
else
165+
result= -1;
158166
}
159167
DBUG_RETURN(result);
160168
#elif defined(_WIN32)

storage/maria/ma_open.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,11 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
298298
realpath_err= my_realpath(name_buff, fn_format(org_name, name, "",
299299
MARIA_NAME_IEXT,
300300
MY_UNPACK_FILENAME),MYF(0));
301+
if (realpath_err > 0) /* File not found, no point in looking further. */
302+
{
303+
DBUG_RETURN(NULL);
304+
}
305+
301306
if (my_is_symlink(org_name) &&
302307
(realpath_err || mysys_test_invalid_symlink(name_buff)))
303308
{

storage/myisam/mi_open.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
104104

105105
realpath_err= my_realpath(name_buff,
106106
fn_format(org_name,name,"",MI_NAME_IEXT,4),MYF(0));
107+
if (realpath_err > 0) /* File not found, no point in looking further. */
108+
{
109+
DBUG_RETURN(NULL);
110+
}
111+
107112
if (my_is_symlink(org_name) &&
108113
(realpath_err || mysys_test_invalid_symlink(name_buff)))
109114
{

0 commit comments

Comments
 (0)