Skip to content

Commit 5186865

Browse files
committed
Merge tag 'clone-5.5.57-build' into mysql-5.5-cluster-7.2
2 parents 5109c04 + bb9e547 commit 5186865

Some content is hidden

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

48 files changed

+829
-148
lines changed

CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,36 @@ IF (ENABLE_GCOV AND NOT WIN32 AND NOT APPLE)
263263
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage -lgcov")
264264
ENDIF()
265265

266+
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
267+
OPTION(REPRODUCIBLE_BUILD "Take extra pains to make build result independent of build location and time" OFF)
268+
ENDIF()
269+
IF(REPRODUCIBLE_BUILD)
270+
SET(DEBUG_PREFIX_FLAGS
271+
"-fdebug-prefix-map=${CMAKE_SOURCE_DIR}/=./ -fdebug-prefix-map=${CMAKE_CURRENT_BINARY_DIR}=./obj")
272+
273+
# See if -fdebug-prefix= commands are included in the debug output,
274+
# making the build unreproducible with switches recorded.
275+
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69821.
276+
EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -g3 -x c -S -fdebug-prefix-map=foo=bar -o - -
277+
INPUT_FILE /dev/null OUTPUT_VARIABLE DEBUG_PREFIX_MAP_RESULT)
278+
IF(DEBUG_PREFIX_MAP_RESULT MATCHES "foo=bar")
279+
SET(DEBUG_PREFIX_FLAGS "${DEBUG_PREFIX_FLAGS} -gno-record-gcc-switches")
280+
ENDIF()
281+
282+
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_PREFIX_FLAGS}")
283+
SET(CMAKE_C_FLAGS_RELWITHDEBINFO
284+
"${CMAKE_C_FLAGS_RELWITHDEBINFO} ${DEBUG_PREFIX_FLAGS}")
285+
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_PREFIX_FLAGS}")
286+
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO
287+
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${DEBUG_PREFIX_FLAGS}")
288+
289+
SET(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--build-id=none")
290+
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--build-id=none")
291+
292+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE
293+
"${CMAKE_SOURCE_DIR}/scripts/invoke-with-relative-paths.pl")
294+
ENDIF()
295+
266296
OPTION(ENABLED_LOCAL_INFILE
267297
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
268298
MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
MYSQL_VERSION_MAJOR=5
22
MYSQL_VERSION_MINOR=5
3-
MYSQL_VERSION_PATCH=55
3+
MYSQL_VERSION_PATCH=57
44
MYSQL_VERSION_EXTRA=-ndb-7.2.30

client/mysql.cc

Lines changed: 85 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
142142
default_pager_set= 0, opt_sigint_ignore= 0,
143143
auto_vertical_output= 0,
144144
show_warnings= 0, executing_query= 0, interrupted_query= 0,
145-
ignore_spaces= 0;
145+
ignore_spaces= 0, opt_binhex= 0;
146146
static my_bool debug_info_flag, debug_check_flag;
147147
static my_bool column_types_flag;
148148
static my_bool preserve_comments= 0;
@@ -1395,6 +1395,8 @@ static struct my_option my_long_options[] =
13951395
{"batch", 'B',
13961396
"Don't use history file. Disable interactive behavior. (Enables --silent.)",
13971397
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1398+
{"binary-as-hex", 'b', "Print binary data as hex", &opt_binhex, &opt_binhex,
1399+
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
13981400
#ifndef MCP_WL3126
13991401
{"bind-address", 0, "IP address to bind to.",
14001402
(uchar**) &opt_bind_addr, (uchar**) &opt_bind_addr, 0, GET_STR,
@@ -3109,7 +3111,8 @@ com_go(String *buffer,char *line __attribute__((unused)))
31093111
print_table_data_html(result);
31103112
else if (opt_xml)
31113113
print_table_data_xml(result);
3112-
else if (vertical || (auto_vertical_output && (terminal_width < get_result_width(result))))
3114+
else if (vertical || (auto_vertical_output &&
3115+
(terminal_width < get_result_width(result))))
31133116
print_table_data_vertically(result);
31143117
else if (opt_silent && verbose <= 2 && !output_tables)
31153118
print_tab_data(result);
@@ -3328,6 +3331,41 @@ print_field_types(MYSQL_RES *result)
33283331
}
33293332

33303333

3334+
/* Used to determine if we should invoke print_as_hex for this field */
3335+
3336+
static bool
3337+
is_binary_field(MYSQL_FIELD *field)
3338+
{
3339+
if ((field->charsetnr == 63) &&
3340+
(field->type == MYSQL_TYPE_BIT ||
3341+
field->type == MYSQL_TYPE_BLOB ||
3342+
field->type == MYSQL_TYPE_LONG_BLOB ||
3343+
field->type == MYSQL_TYPE_MEDIUM_BLOB ||
3344+
field->type == MYSQL_TYPE_TINY_BLOB ||
3345+
field->type == MYSQL_TYPE_VAR_STRING ||
3346+
field->type == MYSQL_TYPE_STRING ||
3347+
field->type == MYSQL_TYPE_VARCHAR ||
3348+
field->type == MYSQL_TYPE_GEOMETRY))
3349+
return 1;
3350+
return 0;
3351+
}
3352+
3353+
3354+
/* Print binary value as hex literal (0x ...) */
3355+
3356+
static void
3357+
print_as_hex(FILE *output_file, const char *str, ulong len, ulong total_bytes_to_send)
3358+
{
3359+
const char *ptr= str, *end= ptr+len;
3360+
ulong i;
3361+
fprintf(output_file, "0x");
3362+
for(; ptr < end; ptr++)
3363+
fprintf(output_file, "%02X", *((uchar*)ptr));
3364+
for (i= 2*len+2; i < total_bytes_to_send; i++)
3365+
tee_putc((int)' ', output_file);
3366+
}
3367+
3368+
33313369
static void
33323370
print_table_data(MYSQL_RES *result)
33333371
{
@@ -3354,7 +3392,9 @@ print_table_data(MYSQL_RES *result)
33543392
length=max(length,field->max_length);
33553393
if (length < 4 && !IS_NOT_NULL(field->flags))
33563394
length=4; // Room for "NULL"
3357-
field->max_length=length;
3395+
if (opt_binhex && is_binary_field(field))
3396+
length= 2 + length * 2;
3397+
field->max_length=(ulong) length;
33583398
separator.fill(separator.length()+length+2,'-');
33593399
separator.append('+');
33603400
}
@@ -3421,9 +3461,11 @@ print_table_data(MYSQL_RES *result)
34213461
many extra padding-characters we should send with the printing function.
34223462
*/
34233463
visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
3424-
extra_padding= data_length - visible_length;
3464+
extra_padding= (uint) (data_length - visible_length);
34253465

3426-
if (field_max_length > MAX_COLUMN_LENGTH)
3466+
if (opt_binhex && is_binary_field(field))
3467+
print_as_hex(PAGER, cur[off], lengths[off], field_max_length);
3468+
else if (field_max_length > MAX_COLUMN_LENGTH)
34273469
tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE);
34283470
else
34293471
{
@@ -3556,11 +3598,15 @@ print_table_data_html(MYSQL_RES *result)
35563598
if (interrupted_query)
35573599
break;
35583600
ulong *lengths=mysql_fetch_lengths(result);
3601+
field= mysql_fetch_fields(result);
35593602
(void) tee_fputs("<TR>", PAGER);
35603603
for (uint i=0; i < mysql_num_fields(result); i++)
35613604
{
35623605
(void) tee_fputs("<TD>", PAGER);
3563-
xmlencode_print(cur[i], lengths[i]);
3606+
if (opt_binhex && is_binary_field(&field[i]))
3607+
print_as_hex(PAGER, cur[i], lengths[i], lengths[i]);
3608+
else
3609+
xmlencode_print(cur[i], lengths[i]);
35643610
(void) tee_fputs("</TD>", PAGER);
35653611
}
35663612
(void) tee_fputs("</TR>", PAGER);
@@ -3596,7 +3642,10 @@ print_table_data_xml(MYSQL_RES *result)
35963642
if (cur[i])
35973643
{
35983644
tee_fprintf(PAGER, "\">");
3599-
xmlencode_print(cur[i], lengths[i]);
3645+
if (opt_binhex && is_binary_field(&fields[i]))
3646+
print_as_hex(PAGER, cur[i], lengths[i], lengths[i]);
3647+
else
3648+
xmlencode_print(cur[i], lengths[i]);
36003649
tee_fprintf(PAGER, "</field>\n");
36013650
}
36023651
else
@@ -3643,23 +3692,28 @@ print_table_data_vertically(MYSQL_RES *result)
36433692
{
36443693
unsigned int i;
36453694
const char *p;
3646-
3695+
if (opt_binhex && is_binary_field(field))
3696+
fprintf(PAGER, "0x");
36473697
for (i= 0, p= cur[off]; i < lengths[off]; i+= 1, p+= 1)
36483698
{
3649-
if (*p == '\0')
3650-
tee_putc((int)' ', PAGER);
3699+
if (opt_binhex && is_binary_field(field))
3700+
fprintf(PAGER, "%02X", *((uchar*)p));
36513701
else
3652-
tee_putc((int)*p, PAGER);
3702+
{
3703+
if (*p == '\0')
3704+
tee_putc((int)' ', PAGER);
3705+
else
3706+
tee_putc((int)*p, PAGER);
3707+
}
36533708
}
36543709
tee_putc('\n', PAGER);
36553710
}
3656-
else
3711+
else
36573712
tee_fprintf(PAGER, "NULL\n");
36583713
}
36593714
}
36603715
}
36613716

3662-
36633717
/* print_warnings should be called right after executing a statement */
36643718

36653719
static void print_warnings()
@@ -3796,11 +3850,19 @@ print_tab_data(MYSQL_RES *result)
37963850
while ((cur = mysql_fetch_row(result)))
37973851
{
37983852
lengths=mysql_fetch_lengths(result);
3799-
safe_put_field(cur[0],lengths[0]);
3853+
field= mysql_fetch_fields(result);
3854+
if (opt_binhex && is_binary_field(&field[0]))
3855+
print_as_hex(PAGER, cur[0], lengths[0], lengths[0]);
3856+
else
3857+
safe_put_field(cur[0],lengths[0]);
3858+
38003859
for (uint off=1 ; off < mysql_num_fields(result); off++)
38013860
{
38023861
(void) tee_fputs("\t", PAGER);
3803-
safe_put_field(cur[off], lengths[off]);
3862+
if (opt_binhex && field && is_binary_field(&field[off]))
3863+
print_as_hex(PAGER, cur[off], lengths[off], lengths[off]);
3864+
else
3865+
safe_put_field(cur[off], lengths[off]);
38043866
}
38053867
(void) tee_fputs("\n", PAGER);
38063868
}
@@ -4178,10 +4240,9 @@ com_use(String *buffer __attribute__((unused)), char *line)
41784240
bzero(buff, sizeof(buff));
41794241

41804242
/*
4181-
In case number of quotes exceed 2, we try to get
4182-
the normalized db name.
4243+
In case of quotes used, try to get the normalized db name.
41834244
*/
4184-
if (get_quote_count(line) > 2)
4245+
if (get_quote_count(line) > 0)
41854246
{
41864247
if (normalize_dbname(line, buff, sizeof(buff)))
41874248
return put_error(&mysql);
@@ -4399,11 +4460,13 @@ char *get_arg(char *line, my_bool get_next_arg)
43994460
static int
44004461
get_quote_count(const char *line)
44014462
{
4402-
int quote_count;
4403-
const char *ptr= line;
4463+
int quote_count= 0;
4464+
const char *quote= line;
44044465

4405-
for(quote_count= 0; ptr ++ && *ptr; ptr= strpbrk(ptr, "\"\'`"))
4406-
quote_count ++;
4466+
while ((quote= strpbrk(quote, "'`\"")) != NULL) {
4467+
quote_count++;
4468+
quote++;
4469+
}
44074470

44084471
return quote_count;
44094472
}

include/my_global.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -1064,19 +1064,9 @@ typedef char my_bool; /* Small bool */
10641064
((uint32) (uchar) (A)[0])))
10651065
#define sint4korr(A) (*((long *) (A)))
10661066
#define uint2korr(A) (*((uint16 *) (A)))
1067-
#if defined(HAVE_purify) && !defined(_WIN32)
10681067
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
10691068
(((uint32) ((uchar) (A)[1])) << 8) +\
10701069
(((uint32) ((uchar) (A)[2])) << 16))
1071-
#else
1072-
/*
1073-
ATTENTION !
1074-
1075-
Please, note, uint3korr reads 4 bytes (not 3) !
1076-
It means, that you have to provide enough allocated space !
1077-
*/
1078-
#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
1079-
#endif /* HAVE_purify && !_WIN32 */
10801070
#define uint4korr(A) (*((uint32 *) (A)))
10811071
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
10821072
(((uint32) ((uchar) (A)[1])) << 8) +\

include/my_sys.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -49,6 +49,7 @@ typedef struct my_aio_result {
4949
#ifdef _WIN32
5050
#include <malloc.h> /*for alloca*/
5151
#endif
52+
#include <sys/stat.h>
5253

5354
#define MY_INIT(name) { my_progname= name; my_init(); }
5455

@@ -491,6 +492,16 @@ typedef struct st_io_cache /* Used when cacheing files */
491492

492493
typedef int (*qsort2_cmp)(const void *, const void *, const void *);
493494

495+
/*
496+
Subset of struct stat fields filled by stat/lstat/fstat that uniquely
497+
identify a file
498+
*/
499+
typedef struct st_file_id
500+
{
501+
dev_t st_dev;
502+
ino_t st_ino;
503+
} ST_FILE_ID;
504+
494505
/* defines for mf_iocache */
495506

496507
/* Test if buffer is inited */
@@ -569,8 +580,9 @@ extern File my_create(const char *FileName,int CreateFlags,
569580
extern int my_close(File Filedes,myf MyFlags);
570581
extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
571582
extern int my_readlink(char *to, const char *filename, myf MyFlags);
572-
extern int my_is_symlink(const char *filename);
583+
extern int my_is_symlink(const char *filename, ST_FILE_ID *file_id);
573584
extern int my_realpath(char *to, const char *filename, myf MyFlags);
585+
extern int my_is_same_file(File file, const ST_FILE_ID *file_id);
574586
extern File my_create_with_symlink(const char *linkname, const char *filename,
575587
int createflags, int access_flags,
576588
myf MyFlags);

libmysql/libmysql.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -4678,10 +4678,14 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
46784678
mysql->status= MYSQL_STATUS_READY;
46794679
}
46804680
int4store(buff, stmt->stmt_id);
4681-
if ((rc= stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt)))
4682-
{
4683-
set_stmt_errmsg(stmt, &mysql->net);
4684-
}
4681+
/*
4682+
If stmt_command failed, it would have already raised
4683+
error using set_mysql_error. Caller should use
4684+
mysql_error() or mysql_errno() to find out details.
4685+
Memory allocated for stmt will be released regardless
4686+
of the error.
4687+
*/
4688+
rc= stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt);
46854689
}
46864690
}
46874691

mysql-test/mysql-test-run.pl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/perl
22
# -*- cperl -*-
33

4-
# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
4+
# Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
55
#
66
# This program is free software; you can redistribute it and/or modify
77
# it under the terms of the GNU General Public License as published by
@@ -2488,6 +2488,17 @@ sub environment_setup {
24882488
"$basedir/storage/myisam/myisampack",
24892489
"$basedir/myisam/myisampack"));
24902490

2491+
# ----------------------------------------------------
2492+
# mysqlaccess
2493+
# ----------------------------------------------------
2494+
my $mysqlaccess=
2495+
mtr_pl_maybe_exists("$bindir/scripts/mysqlaccess") ||
2496+
mtr_pl_maybe_exists("$path_client_bindir/mysqlaccess");
2497+
if ($mysqlaccess)
2498+
{
2499+
$ENV{'MYSQLACCESS'}= $mysqlaccess;
2500+
}
2501+
24912502
# ----------------------------------------------------
24922503
# mysqlhotcopy
24932504
# ----------------------------------------------------

0 commit comments

Comments
 (0)