Skip to content

Commit 70af9cf

Browse files
committed
Merge branch '10.2' of github.com:MariaDB/server into bb-10.2-mariarocks-merge
2 parents 262d7e4 + a659291 commit 70af9cf

File tree

558 files changed

+9432
-8284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

558 files changed

+9432
-8284
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,12 @@ ENDIF()
465465

466466
INCLUDE(CPack)
467467

468+
IF(WIN32 AND SIGNCODE)
469+
# Configure post-install script for authenticode signing
470+
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/sign.cmake.in sign.cmake @ONLY)
471+
INSTALL(SCRIPT ${PROJECT_BINARY_DIR}/sign.cmake)
472+
ENDIF()
473+
468474
IF(NON_DISTRIBUTABLE_WARNING)
469475
MESSAGE(WARNING "
470476
You have linked MariaDB with GPLv3 libraries! You may not distribute the resulting binary. If you do, you will put yourself into a legal problem with Free Software Foundation.")

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ see the Credits appendix. You can also run 'SHOW authors' to get a
1717
list of active contributors.
1818

1919
A description of the MariaDB project and a manual can be found at:
20-
http://mariadb.org/
20+
https://mariadb.org/
2121
https://mariadb.com/kb/en/
2222
https://mariadb.com/kb/en/mariadb-vs-mysql-features/
2323
https://mariadb.com/kb/en/mariadb-versus-mysql-features/
@@ -55,9 +55,9 @@ Bug Reports:
5555
------------
5656

5757
Bug and/or error reports regarding MariaDB should be submitted at
58-
http://mariadb.org/jira
58+
https://mariadb.org/jira
5959

60-
Bugs in the MySQL code can also be submitted at http://bugs.mysql.com
60+
Bugs in the MySQL code can also be submitted at https://bugs.mysql.com
6161

6262
The code for MariaDB, including all revision history, can be found at:
6363
https://github.com/MariaDB/server

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
MYSQL_VERSION_MAJOR=10
22
MYSQL_VERSION_MINOR=2
3-
MYSQL_VERSION_PATCH=9
3+
MYSQL_VERSION_PATCH=10

client/mysql.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,6 +1895,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
18951895
usage(1);
18961896
status.exit_status= 0;
18971897
mysql_end(-1);
1898+
break;
18981899
case 'I':
18991900
case '?':
19001901
usage(0);

client/mysql_upgrade.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ static void find_tool(char *tool_executable_name, const char *tool_name,
501501
last_fn_libchar -= 6;
502502
}
503503

504-
len= last_fn_libchar - self_name;
504+
len= (int)(last_fn_libchar - self_name);
505505

506506
my_snprintf(tool_executable_name, FN_REFLEN, "%.*s%c%s",
507507
len, self_name, FN_LIBCHAR, tool_name);

client/mysqlbinlog.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
604604
Exit_status Load_log_processor::process(Create_file_log_event *ce)
605605
{
606606
const char *bname= ce->fname + dirname_length(ce->fname);
607-
uint blen= ce->fname_len - (bname-ce->fname);
607+
size_t blen= ce->fname_len - (bname-ce->fname);
608608

609609
return process_first_event(bname, blen, ce->block, ce->block_len,
610610
ce->file_id, ce);

client/mysqldump.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ static struct my_option my_long_options[] =
247247
&opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG,
248248
0, 0, 0, 0, 0, 0},
249249
{"character-sets-dir", OPT_CHARSETS_DIR,
250-
"Directory for character set files.", &charsets_dir,
251-
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
250+
"Directory for character set files.", (char **)&charsets_dir,
251+
(char **)&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
252252
{"comments", 'i', "Write additional information.",
253253
&opt_comments, &opt_comments, 0, GET_BOOL, NO_ARG,
254254
1, 0, 0, 0, 0, 0},
@@ -285,8 +285,8 @@ static struct my_option my_long_options[] =
285285
{"debug", '#', "This is a non-debug version. Catch this and exit.",
286286
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
287287
#else
288-
{"debug", '#', "Output debug log.", &default_dbug_option,
289-
&default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
288+
{"debug", '#', "Output debug log.", (char *)&default_dbug_option,
289+
(char *)&default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
290290
#endif
291291
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
292292
&debug_check_flag, &debug_check_flag, 0,
@@ -5733,7 +5733,7 @@ static int replace(DYNAMIC_STRING *ds_str,
57335733
return 1;
57345734
init_dynamic_string_checked(&ds_tmp, "",
57355735
ds_str->length + replace_len, 256);
5736-
dynstr_append_mem_checked(&ds_tmp, ds_str->str, start - ds_str->str);
5736+
dynstr_append_mem_checked(&ds_tmp, ds_str->str, (uint)(start - ds_str->str));
57375737
dynstr_append_mem_checked(&ds_tmp, replace_str, replace_len);
57385738
dynstr_append_checked(&ds_tmp, start + search_len);
57395739
dynstr_set_checked(ds_str, ds_tmp.str);

client/mysqlslap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,8 @@ static struct my_option my_long_options[] =
587587
&auto_generate_sql_number, &auto_generate_sql_number,
588588
0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0},
589589
{"character-sets-dir", OPT_CHARSETS_DIR,
590-
"Directory for character set files.", &charsets_dir,
591-
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
590+
"Directory for character set files.", (char **)&charsets_dir,
591+
(char **)&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
592592
{"commit", OPT_SLAP_COMMIT, "Commit records every X number of statements.",
593593
&commit_rate, &commit_rate, 0, GET_UINT, REQUIRED_ARG,
594594
0, 0, 0, 0, 0, 0},
@@ -817,7 +817,7 @@ get_random_string(char *buf)
817817
DBUG_ENTER("get_random_string");
818818
for (x= RAND_STRING_SIZE; x > 0; x--)
819819
*buf_ptr++= ALPHANUMERICS[random() % ALPHANUMERICS_SIZE];
820-
DBUG_RETURN(buf_ptr - buf);
820+
DBUG_RETURN((uint)(buf_ptr - buf));
821821
}
822822

823823

client/mysqltest.cc

Lines changed: 71 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ class LogFile {
767767
if (show_from != buf)
768768
{
769769
// The last new line was found in this buf, adjust offset
770-
show_offset+= (show_from - buf) + 1;
770+
show_offset+= (int)(show_from - buf) + 1;
771771
DBUG_PRINT("info", ("adjusted offset to %d", show_offset));
772772
}
773773
DBUG_PRINT("info", ("show_offset: %d", show_offset));
@@ -836,6 +836,47 @@ void revert_properties();
836836
static void handle_no_active_connection(struct st_command* command,
837837
struct st_connection *cn, DYNAMIC_STRING *ds);
838838

839+
840+
/* Wrapper for fgets.Strips \r off newlines on Windows.
841+
Should be used with together with my_popen().
842+
*/
843+
static char *my_fgets(char * s, int n, FILE * stream, int *len)
844+
{
845+
char *buf = fgets(s, n, stream);
846+
if (!buf)
847+
{
848+
*len= 0;
849+
return buf;
850+
}
851+
852+
*len = (int)strlen(buf);
853+
#ifdef _WIN32
854+
/* Strip '\r' off newlines. */
855+
if (*len > 1 && buf[*len - 2] == '\r' && buf[*len - 1] == '\n')
856+
{
857+
buf[*len - 2]= '\n';
858+
buf[*len - 1]= 0;
859+
(*len)--;
860+
}
861+
#endif
862+
return buf;
863+
}
864+
865+
/*
866+
Wrapper for popen().
867+
On Windows, uses binary mode to workaround
868+
C runtime bug mentioned in MDEV-9409
869+
*/
870+
static FILE* my_popen(const char *cmd, const char *mode)
871+
{
872+
FILE *f= popen(cmd, mode);
873+
#ifdef _WIN32
874+
if (f)
875+
_setmode(fileno(f), O_BINARY);
876+
#endif
877+
return f;
878+
}
879+
839880
#ifdef EMBEDDED_LIBRARY
840881

841882
#define EMB_SEND_QUERY 1
@@ -1785,19 +1826,20 @@ static int run_command(char* cmd,
17851826
DBUG_ENTER("run_command");
17861827
DBUG_PRINT("enter", ("cmd: %s", cmd));
17871828

1788-
if (!(res_file= popen(cmd, "r")))
1829+
if (!(res_file= my_popen(cmd, "r")))
17891830
{
17901831
report_or_die("popen(\"%s\", \"r\") failed", cmd);
17911832
DBUG_RETURN(-1);
17921833
}
17931834

1794-
while (fgets(buf, sizeof(buf), res_file))
1835+
int len;
1836+
while (my_fgets(buf, sizeof(buf), res_file, &len))
17951837
{
17961838
DBUG_PRINT("info", ("buf: %s", buf));
17971839
if(ds_res)
17981840
{
17991841
/* Save the output of this command in the supplied string */
1800-
dynstr_append(ds_res, buf);
1842+
dynstr_append_mem(ds_res, buf,len);
18011843
}
18021844
else
18031845
{
@@ -1886,14 +1928,15 @@ static int diff_check(const char *diff_name)
18861928

18871929
my_snprintf(buf, sizeof(buf), "%s -v", diff_name);
18881930

1889-
if (!(res_file= popen(buf, "r")))
1931+
if (!(res_file= my_popen(buf, "r")))
18901932
die("popen(\"%s\", \"r\") failed", buf);
18911933

18921934
/*
18931935
if diff is not present, nothing will be in stdout to increment
18941936
have_diff
18951937
*/
1896-
if (fgets(buf, sizeof(buf), res_file))
1938+
int len;
1939+
if (my_fgets(buf, sizeof(buf), res_file, &len))
18971940
have_diff= 1;
18981941

18991942
pclose(res_file);
@@ -2657,7 +2700,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
26572700
DBUG_ASSERT(query_end);
26582701
memset(&command, 0, sizeof(command));
26592702
command.query= (char*)query;
2660-
command.first_word_len= (*query_end - query);
2703+
command.first_word_len= (int)(*query_end - query);
26612704
command.first_argument= command.query + command.first_word_len;
26622705
command.end= (char*)*query_end;
26632706
command.abort_on_error= 1; /* avoid uninitialized variables */
@@ -3246,18 +3289,6 @@ void free_tmp_sh_file()
32463289
#endif
32473290

32483291

3249-
FILE* my_popen(DYNAMIC_STRING *ds_cmd, const char *mode)
3250-
{
3251-
#if defined _WIN32 && defined USE_CYGWIN
3252-
/* Dump the command into a sh script file and execute with popen */
3253-
str_to_file(tmp_sh_name, ds_cmd->str, ds_cmd->length);
3254-
return popen(tmp_sh_cmd, mode);
3255-
#else
3256-
return popen(ds_cmd->str, mode);
3257-
#endif
3258-
}
3259-
3260-
32613292
static void init_builtin_echo(void)
32623293
{
32633294
#ifdef _WIN32
@@ -3392,7 +3423,7 @@ void do_exec(struct st_command *command)
33923423
DBUG_PRINT("info", ("Executing '%s' as '%s'",
33933424
command->first_argument, ds_cmd.str));
33943425

3395-
if (!(res_file= my_popen(&ds_cmd, "r")))
3426+
if (!(res_file= my_popen(ds_cmd.str, "r")))
33963427
{
33973428
dynstr_free(&ds_cmd);
33983429
if (command->abort_on_error)
@@ -3406,24 +3437,9 @@ void do_exec(struct st_command *command)
34063437
init_dynamic_string(&ds_sorted, "", 1024, 1024);
34073438
ds_result= &ds_sorted;
34083439
}
3409-
3410-
#ifdef _WIN32
3411-
/* Workaround for CRT bug, MDEV-9409 */
3412-
_setmode(fileno(res_file), O_BINARY);
3413-
#endif
3414-
3415-
while (fgets(buf, sizeof(buf), res_file))
3440+
int len;
3441+
while (my_fgets(buf, sizeof(buf), res_file,&len))
34163442
{
3417-
int len = (int)strlen(buf);
3418-
#ifdef _WIN32
3419-
/* Strip '\r' off newlines. */
3420-
if (len > 1 && buf[len-2] == '\r' && buf[len-1] == '\n')
3421-
{
3422-
buf[len-2] = '\n';
3423-
buf[len-1] = 0;
3424-
len--;
3425-
}
3426-
#endif
34273443
replace_dynstr_append_mem(ds_result, buf, len);
34283444
}
34293445
error= pclose(res_file);
@@ -4685,24 +4701,25 @@ void do_perl(struct st_command *command)
46854701
/* Format the "perl <filename>" command */
46864702
my_snprintf(buf, sizeof(buf), "perl %s", temp_file_path);
46874703

4688-
if (!(res_file= popen(buf, "r")))
4704+
if (!(res_file= my_popen(buf, "r")))
46894705
{
46904706
if (command->abort_on_error)
46914707
die("popen(\"%s\", \"r\") failed", buf);
46924708
dynstr_free(&ds_delimiter);
46934709
DBUG_VOID_RETURN;
46944710
}
46954711

4696-
while (fgets(buf, sizeof(buf), res_file))
4712+
int len;
4713+
while (my_fgets(buf, sizeof(buf), res_file,&len))
46974714
{
46984715
if (disable_result_log)
46994716
{
4700-
buf[strlen(buf)-1]=0;
4701-
DBUG_PRINT("exec_result",("%s", buf));
4717+
buf[len - 1] = 0;
4718+
DBUG_PRINT("exec_result", ("%s", buf));
47024719
}
47034720
else
47044721
{
4705-
replace_dynstr_append(&ds_res, buf);
4722+
replace_dynstr_append_mem(&ds_res, buf, len);
47064723
}
47074724
}
47084725
error= pclose(res_file);
@@ -6484,7 +6501,7 @@ void do_delimiter(struct st_command* command)
64846501
if (!(*p))
64856502
die("Can't set empty delimiter");
64866503

6487-
delimiter_length= strmake_buf(delimiter, p) - delimiter;
6504+
delimiter_length= (uint)(strmake_buf(delimiter, p) - delimiter);
64886505

64896506
DBUG_PRINT("exit", ("delimiter: %s", delimiter));
64906507
command->last_argument= p + delimiter_length;
@@ -6970,7 +6987,7 @@ int read_command(struct st_command** command_ptr)
69706987
command->first_argument= p;
69716988

69726989
command->end= strend(command->query);
6973-
command->query_len= (command->end - command->query);
6990+
command->query_len= (int)(command->end - command->query);
69746991
parser.read_lines++;
69756992
DBUG_RETURN(0);
69766993
}
@@ -7515,7 +7532,7 @@ void fix_win_paths(char *val, size_t len)
75157532
DBUG_PRINT("info", ("Converted \\ to /, p: %s", p));
75167533
}
75177534
}
7518-
DBUG_PRINT("exit", (" val: %s, len: %d", val, len));
7535+
DBUG_PRINT("exit", (" val: %s, len: %zu", val, len));
75197536
DBUG_VOID_RETURN;
75207537
#endif
75217538
}
@@ -7527,7 +7544,7 @@ void fix_win_paths(char *val, size_t len)
75277544
*/
75287545

75297546
void append_field(DYNAMIC_STRING *ds, uint col_idx, MYSQL_FIELD* field,
7530-
char* val, ulonglong len, my_bool is_null)
7547+
char* val, size_t len, my_bool is_null)
75317548
{
75327549
char null[]= "NULL";
75337550

@@ -8523,7 +8540,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
85238540
if (flags & QUERY_PRINT_ORIGINAL_FLAG)
85248541
{
85258542
print_query= command->query;
8526-
print_len= command->end - command->query;
8543+
print_len= (int)(command->end - command->query);
85278544
}
85288545
replace_dynstr_append_mem(ds, print_query, print_len);
85298546
dynstr_append_mem(ds, delimiter, delimiter_length);
@@ -10220,7 +10237,7 @@ void free_replace_regex()
1022010237
*/
1022110238
#define SECURE_REG_BUF if (buf_len < need_buf_len) \
1022210239
{ \
10223-
int off= res_p - buf; \
10240+
ssize_t off= res_p - buf; \
1022410241
buf= (char*)my_realloc(buf,need_buf_len,MYF(MY_WME+MY_FAE)); \
1022510242
res_p= buf + off; \
1022610243
buf_len= need_buf_len; \
@@ -10245,13 +10262,15 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
1024510262
regmatch_t *subs;
1024610263
char *replace_end;
1024710264
char *buf= *buf_p;
10248-
int len;
10249-
int buf_len, need_buf_len;
10265+
size_t len;
10266+
size_t buf_len, need_buf_len;
1025010267
int cflags= REG_EXTENDED | REG_DOTALL;
1025110268
int err_code;
1025210269
char *res_p,*str_p,*str_end;
1025310270

10254-
buf_len= *buf_len_p;
10271+
DBUG_ASSERT(*buf_len_p > 0);
10272+
10273+
buf_len= (size_t)*buf_len_p;
1025510274
len= strlen(string);
1025610275
str_end= string + len;
1025710276

@@ -10394,7 +10413,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
1039410413
}
1039510414
else /* no match this time, just copy the string as is */
1039610415
{
10397-
int left_in_str= str_end-str_p;
10416+
size_t left_in_str= str_end-str_p;
1039810417
need_buf_len= (res_p-buf) + left_in_str;
1039910418
SECURE_REG_BUF
1040010419
memcpy(res_p,str_p,left_in_str);

0 commit comments

Comments
 (0)