Skip to content

Commit c4f97d3

Browse files
committed
Merge branch '5.5' into 10.0
2 parents 8c2f3e0 + eff71f3 commit c4f97d3

File tree

11 files changed

+94
-15
lines changed

11 files changed

+94
-15
lines changed

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,15 @@ IF(HAVE_GGDB3)
264264
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb3")
265265
ENDIF(HAVE_GGDB3)
266266

267-
OPTION(ENABLED_LOCAL_INFILE
268-
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
267+
SET(ENABLED_LOCAL_INFILE "AUTO" CACHE STRING "If we should should enable LOAD DATA LOCAL by default (OFF/ON/AUTO)")
269268
MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE)
269+
IF (ENABLED_LOCAL_INFILE MATCHES "^(0|FALSE)$")
270+
SET(ENABLED_LOCAL_INFILE OFF)
271+
ELSEIF(ENABLED_LOCAL_INFILE MATCHES "^(1|TRUE)$")
272+
SET(ENABLED_LOCAL_INFILE ON)
273+
ELSEIF (NOT ENABLED_LOCAL_INFILE MATCHES "^(ON|OFF|AUTO)$")
274+
MESSAGE(FATAL_ERROR "ENABLED_LOCAL_INFILE must be one of OFF, ON, AUTO")
275+
ENDIF()
270276

271277
OPTION(WITH_FAST_MUTEXES "Compile with fast mutexes" OFF)
272278
MARK_AS_ADVANCED(WITH_FAST_MUTEXES)

client/mysqltest.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6105,7 +6105,6 @@ void do_connect(struct st_command *command)
61056105
#endif
61066106
if (opt_compress || con_compress)
61076107
mysql_options(con_slot->mysql, MYSQL_OPT_COMPRESS, NullS);
6108-
mysql_options(con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
61096108
mysql_options(con_slot->mysql, MYSQL_SET_CHARSET_NAME,
61106109
charset_info->csname);
61116110
if (opt_charsets_dir)
@@ -9211,7 +9210,6 @@ int main(int argc, char **argv)
92119210
(void *) &opt_connect_timeout);
92129211
if (opt_compress)
92139212
mysql_options(con->mysql,MYSQL_OPT_COMPRESS,NullS);
9214-
mysql_options(con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
92159213
mysql_options(con->mysql, MYSQL_SET_CHARSET_NAME,
92169214
charset_info->csname);
92179215
if (opt_charsets_dir)

cmake/build_configurations/mysql_release.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ IF(FEATURE_SET)
9696
ENDFOREACH()
9797
ENDIF()
9898

99-
OPTION(ENABLED_LOCAL_INFILE "" ON)
10099
IF(RPM)
101100
SET(WITH_SSL system CACHE STRING "")
102101
SET(WITH_ZLIB system CACHE STRING "")

config.h.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,11 @@
536536
/*
537537
MySQL features
538538
*/
539-
#cmakedefine ENABLED_LOCAL_INFILE 1
539+
#define LOCAL_INFILE_MODE_OFF 0
540+
#define LOCAL_INFILE_MODE_ON 1
541+
#define LOCAL_INFILE_MODE_AUTO 2
542+
#define ENABLED_LOCAL_INFILE LOCAL_INFILE_MODE_@ENABLED_LOCAL_INFILE@
543+
540544
#cmakedefine ENABLED_PROFILING 1
541545
#cmakedefine EXTRA_DEBUG 1
542546
#cmakedefine BACKUP_TEST 1

include/mysql.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ typedef struct st_mysql
283283

284284
/* session-wide random string */
285285
char scramble[SCRAMBLE_LENGTH+1];
286-
my_bool unused1;
286+
my_bool auto_local_infile;
287287
void *unused2, *unused3, *unused4, *unused5;
288288

289289
LIST *stmts; /* list of all statements */

include/mysql.h.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@
354354
my_bool free_me;
355355
my_bool reconnect;
356356
char scramble[20 +1];
357-
my_bool unused1;
357+
my_bool auto_local_infile;
358358
void *unused2, *unused3, *unused4, *unused5;
359359
LIST *stmts;
360360
const struct st_mysql_methods *methods;

mysql-test/disabled.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ ssl_crl : broken upstream
1919
ssl_crl_clrpath : broken upstream
2020
file_contents : MDEV-6526 these files are not installed anymore
2121
lowercase_fs_on : lower_case_table_names=0 is not an error until 10.1
22+
partition_open_files_limit : open_files_limit check broken by MDEV-18360

mysql-test/r/mysql.result

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,3 +587,29 @@ a
587587
2
588588
drop table "a1\""b1";
589589
set sql_mode=default;
590+
create table t1 (a text);
591+
select count(*) from t1;
592+
count(*)
593+
41
594+
truncate table t1;
595+
select count(*) from t1;
596+
count(*)
597+
41
598+
truncate table t1;
599+
select count(*) from t1;
600+
count(*)
601+
0
602+
truncate table t1;
603+
select count(*) from t1;
604+
count(*)
605+
0
606+
truncate table t1;
607+
select count(*) from t1;
608+
count(*)
609+
41
610+
truncate table t1;
611+
select count(*) from t1;
612+
count(*)
613+
0
614+
truncate table t1;
615+
drop table t1;

mysql-test/t/mysql.test

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,3 +656,25 @@ show create table "a1\""b1";
656656
select * from "a1\""b1";
657657
drop table "a1\""b1";
658658
set sql_mode=default;
659+
660+
#
661+
# mysql --local-infile
662+
#
663+
--let $ldli = load data local infile '$MYSQLTEST_VARDIR/tmp/bug.sql' into table test.t1;
664+
create table t1 (a text);
665+
--exec $MYSQL -e "$ldli"
666+
select count(*) from t1; truncate table t1;
667+
--exec $MYSQL --enable-local-infile -e "$ldli"
668+
select count(*) from t1; truncate table t1;
669+
--error 1
670+
--exec $MYSQL --disable-local-infile -e "$ldli"
671+
select count(*) from t1; truncate table t1;
672+
--error 1
673+
--exec $MYSQL -e "/*q*/$ldli"
674+
select count(*) from t1; truncate table t1;
675+
--exec $MYSQL --enable-local-infile -e "/*q*/$ldli"
676+
select count(*) from t1; truncate table t1;
677+
--error 1
678+
--exec $MYSQL --disable-local-infile -e "/*q*/$ldli"
679+
select count(*) from t1; truncate table t1;
680+
drop table t1;

mysys/my_file.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ static uint set_max_open_files(uint max_file_limit)
5252
DBUG_PRINT("info", ("rlim_cur: %u rlim_max: %u",
5353
(uint) rlimit.rlim_cur,
5454
(uint) rlimit.rlim_max));
55-
if ((ulonglong) rlimit.rlim_cur == (ulonglong) RLIM_INFINITY)
56-
rlimit.rlim_cur = max_file_limit;
57-
if (rlimit.rlim_cur >= max_file_limit)
58-
DBUG_RETURN(rlimit.rlim_cur); /* purecov: inspected */
55+
if ((ulonglong) rlimit.rlim_cur == (ulonglong) RLIM_INFINITY ||
56+
rlimit.rlim_cur >= max_file_limit)
57+
DBUG_RETURN(max_file_limit);
5958
rlimit.rlim_cur= rlimit.rlim_max= max_file_limit;
6059
if (setrlimit(RLIMIT_NOFILE, &rlimit))
6160
max_file_limit= old_cur; /* Use original value */

0 commit comments

Comments
 (0)