Skip to content

SUSE patches we keep against 5.6 #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 29 additions & 13 deletions client/mysql_upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,21 +583,37 @@ static int extract_variable_from_show(DYNAMIC_STRING* ds, char* value)

static int get_upgrade_info_file_name(char* name)
{
DYNAMIC_STRING ds_datadir;
DBUG_ENTER("get_upgrade_info_file_name");
static char *data_dir = NULL;
static size_t len;

if (init_dynamic_string(&ds_datadir, NULL, 32, 32))
die("Out of memory");
DBUG_ENTER("get_upgrade_info_file_name");

if (run_query("show variables like 'datadir'",
&ds_datadir, FALSE) ||
extract_variable_from_show(&ds_datadir, name))
if(data_dir==NULL)
{
DYNAMIC_STRING ds_datadir;

if (init_dynamic_string(&ds_datadir, NULL, 32, 32))
die("Out of memory");

if (run_query("show variables like 'datadir'",
&ds_datadir, FALSE) ||
extract_variable_from_show(&ds_datadir, name)
)
{
dynstr_free(&ds_datadir);
DBUG_RETURN(1); /* Query failed */
}
dynstr_free(&ds_datadir);
DBUG_RETURN(1); /* Query failed */
}
len = strlen(name)+1;
if ((data_dir=(char*)malloc(sizeof(char)*len))==NULL)
{
die("Out of memory");
}
strncpy(data_dir,name,len);

dynstr_free(&ds_datadir);
} else {
strncpy(name, data_dir, len);
}

fn_format(name, "mysql_upgrade_info", name, "", MYF(0));
DBUG_PRINT("exit", ("name: %s", name));
Expand Down Expand Up @@ -1010,7 +1026,7 @@ int main(int argc, char **argv)
Read the mysql_upgrade_info file to check if mysql_upgrade
already has been run for this installation of MySQL
*/
if (!opt_force && upgrade_already_done())
if (upgrade_already_done() && !opt_force)
{
printf("This installation of MySQL is already upgraded to %s, "
"use --force if you still need to run mysql_upgrade\n",
Expand All @@ -1029,9 +1045,9 @@ int main(int argc, char **argv)
*/
if ((!opt_systables_only &&
(run_mysqlcheck_mysql_db_fixnames() || run_mysqlcheck_mysql_db_upgrade())) ||
run_sql_fix_privilege_tables() ||
(!opt_systables_only &&
(run_mysqlcheck_fixnames() || run_mysqlcheck_upgrade())))
(run_mysqlcheck_fixnames() || run_mysqlcheck_upgrade()))
|| run_sql_fix_privilege_tables())
{
/*
The upgrade failed to complete in some way or another,
Expand Down
2 changes: 1 addition & 1 deletion libservices/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ SET(MYSQLSERVICES_SOURCES
my_thread_scheduler_service.c
mysql_string_service.c)

ADD_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
ADD_LIBRARY(mysqlservices STATIC ${MYSQLSERVICES_SOURCES})
INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR} COMPONENT Development)
2 changes: 1 addition & 1 deletion mysys/mf_loadpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ char * my_load_path(char * to, const char *path,
if (is_cur)
is_cur=2; /* Remove current dir */
if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0)))
(void) strncat(buff, path+is_cur, FN_REFLEN-1);
(void) strncat(buff, path+is_cur, FN_REFLEN-strlen(buff)-1);
else
(void) strnmov(buff, path, FN_REFLEN); /* Return org file name */
}
Expand Down
10 changes: 9 additions & 1 deletion regex/regcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,15 @@ const CHARSET_INFO *charset;
(NC-1)*sizeof(cat_t));
if (g == NULL)
return(MY_REG_ESPACE);
p->ssize = (long) (len/(size_t)2*(size_t)3 + (size_t)1); /* ugh */
{
/* Patched for CERT Vulnerability Note VU#695940, Feb 2015. */
size_t new_ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
if (new_ssize < len || new_ssize > LONG_MAX / sizeof(sop)) {
free((char *) g);
return MY_REG_INVARG;
}
p->ssize = (long) new_ssize;
}
p->strip = (sop *)malloc(p->ssize * sizeof(sop));
p->slen = 0;
if (p->strip == NULL) {
Expand Down
1 change: 1 addition & 0 deletions scripts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ ENDIF()

SET(HOSTNAME "hostname")
SET(MYSQLD_USER "mysql")
SET(MYSQLD_GROUP "mysql")

# Required for mysqlbug until autotools are deprecated, once done remove these
# and expand default cmake variables
Expand Down
2 changes: 1 addition & 1 deletion scripts/mysql_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ fi

version='@VERSION@'
socket='@MYSQL_UNIX_ADDR@'
ldflags='@LDFLAGS@'
ldflags='@SAVE_LDFLAGS@'

if [ @MYSQL_TCP_PORT_DEFAULT@ -eq 0 ]; then
port=0
Expand Down
22 changes: 19 additions & 3 deletions scripts/mysql_install_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ args=""
defaults=""
mysqld_opt=""
user=""
group=""

force=0
in_rpm=0
Expand Down Expand Up @@ -68,6 +69,11 @@ Usage: $0 [OPTIONS]
user. You must be root to use this option. By default
mysqld runs using your current login name and files and
directories that it creates will be owned by you.
--group=group_name The login group to use for running mysqld. Files and
directories created by mysqld will be owned by this
group. You must be root to use this option. By default
mysqld runs using your current group and files and
directories that it creates will be owned by you.

All other options are passed to the mysqld program

Expand Down Expand Up @@ -108,11 +114,11 @@ parse_arguments()
--builddir=*) builddir=`parse_arg "$arg"` ;;
--srcdir=*) srcdir=`parse_arg "$arg"` ;;
--ldata=*|--datadir=*) ldata=`parse_arg "$arg"` ;;
--user=*)
# Note that the user will be passed to mysqld so that it runs
# as 'user' (crucial e.g. if log-bin=/some_other_path/
# where a chown of datadir won't help)
user=`parse_arg "$arg"` ;;
--user=*) user=`parse_arg "$arg"` ;;
--group=*) group=`parse_arg "$arg"` ;;
--skip-name-resolve) ip_only=1 ;;
--verbose) verbose=1 ;; # Obsolete
--rpm) in_rpm=1 ;;
Expand Down Expand Up @@ -365,7 +371,12 @@ do
fi
if test -n "$user"
then
chown $user $dir
if test -z "$group"
then
chown $user $dir
else
chown $user:$group $dir
fi
if test $? -ne 0
then
echo "Cannot change ownership of the database directories to the '$user'"
Expand All @@ -380,6 +391,11 @@ then
args="$args --user=$user"
fi

if test -n "$group"
then
args="$args --group=$group"
fi

# When doing a "cross bootstrap" install, no reference to the current
# host should be added to the system tables. So we filter out any
# lines which contain the current host name.
Expand Down
17 changes: 15 additions & 2 deletions scripts/mysqld_safe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ logging=init
want_syslog=0
syslog_tag=
user='@MYSQLD_USER@'
group='@MYSQLD_GROUP@'
pid_file=
err_log=

Expand Down Expand Up @@ -198,6 +199,7 @@ parse_arguments() {
--pid-file=*) pid_file="$val" ;;
--plugin-dir=*) PLUGIN_DIR="$val" ;;
--user=*) user="$val"; SET_USER=1 ;;
--group=*) group="$val"; SET_USER=1 ;;

# these might have been set in a [mysqld_safe] section of my.cnf
# they are added to mysqld command line to override settings from my.cnf
Expand Down Expand Up @@ -592,11 +594,17 @@ then
if test "$user" != "root" -o $SET_USER = 1
then
USER_OPTION="--user=$user"
GROUP_OPTION="--group=$group"
fi
# Change the err log to the right user, if it is in use
if [ $want_syslog -eq 0 ]; then
touch "$err_log"
chown $user "$err_log"
if [ "$user" -a "$group" ]; then
chown $user:$group $err_log
else
[ "$user" ] && chown $user $err_log
[ "$group" ] && chgrp $group $err_log
fi
fi
if test -n "$open_files"
then
Expand All @@ -615,7 +623,12 @@ mysql_unix_port_dir=`dirname $safe_mysql_unix_port`
if [ ! -d $mysql_unix_port_dir ]
then
mkdir $mysql_unix_port_dir
chown $user $mysql_unix_port_dir
if [ "$user" -a "$group" ]; then
chown $user:$group $mysql_unix_port_dir
else
[ "$user" ] && chown $user $mysql_unix_port_dir
[ "$group" ] && chgrp $group $mysql_unix_port_dir
fi
chmod 755 $mysql_unix_port_dir
fi

Expand Down
19 changes: 18 additions & 1 deletion scripts/mysqlhotcopy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,24 @@ sub get_list_of_tables {
} || [];
warn "Unable to retrieve list of tables in $db: $@" if $@;

return (map { $_->[0] } @$tables);
my @ignore_tables = ();

# Ignore tables for the mysql database
if ($db eq 'mysql') {
@ignore_tables = qw(general_log slow_log schema apply_status);
}

my @res = ();
if ($#ignore_tables > 1) {
my @tmp = (map { $_->[0] } @$tables);
for my $t (@tmp) {
push(@res, $t) if not exists { map { $_=>1 } @ignore_tables }->{$t};
}
} else {
@res = (map { $_->[0] } @$tables);
}

return @res;
}

sub get_list_of_views {
Expand Down
8 changes: 4 additions & 4 deletions sql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,20 +245,20 @@ SET (BINLOG_SOURCE uuid.cc rpl_gtid_misc.cc
log_event.cc log_event_old.cc binlog.cc sql_binlog.cc
rpl_filter.cc rpl_record.cc rpl_record_old.cc rpl_utility.cc
rpl_injector.cc)
ADD_LIBRARY(binlog ${BINLOG_SOURCE})
ADD_LIBRARY(binlog STATIC ${BINLOG_SOURCE})
SET (RPL_SOURCE rpl_handler.cc rpl_tblmap.cc)
ADD_DEPENDENCIES(binlog GenError)
ADD_LIBRARY(rpl ${RPL_SOURCE})
ADD_LIBRARY(rpl STATIC ${RPL_SOURCE})
SET (MASTER_SOURCE rpl_master.cc)
ADD_DEPENDENCIES(rpl GenError)
ADD_LIBRARY(master ${MASTER_SOURCE})
ADD_LIBRARY(master STATIC ${MASTER_SOURCE})
ADD_DEPENDENCIES(master GenError)
SET (SLAVE_SOURCE rpl_slave.cc rpl_reporting.cc rpl_mi.cc rpl_rli.cc
rpl_info_handler.cc rpl_info_file.cc rpl_info_table.cc
rpl_info_values.cc rpl_info.cc rpl_info_factory.cc
rpl_info_table_access.cc dynamic_ids.cc rpl_rli_pdb.cc
rpl_info_dummy.cc)
ADD_LIBRARY(slave ${SLAVE_SOURCE})
ADD_LIBRARY(slave STATIC ${SLAVE_SOURCE})
ADD_DEPENDENCIES(slave GenError)
ADD_LIBRARY(sqlgunitlib
filesort_utils.cc mdl.cc sql_list.cc sql_string.cc thr_malloc.cc
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/row/row0log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2583,7 +2583,7 @@ row_log_table_apply_ops(
and be ignored when the operation is unsupported. */
fallocate(index->online_log->fd,
FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
ofs, srv_buf_size);
ofs, srv_sort_buf_size);
#endif /* FALLOC_FL_PUNCH_HOLE */

next_mrec = index->online_log->head.block;
Expand Down Expand Up @@ -3411,7 +3411,7 @@ row_log_apply_ops(
and be ignored when the operation is unsupported. */
fallocate(index->online_log->fd,
FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
ofs, srv_buf_size);
ofs, srv_sort_buf_size);
#endif /* FALLOC_FL_PUNCH_HOLE */

next_mrec = index->online_log->head.block;
Expand Down
1 change: 1 addition & 0 deletions support-files/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ELSE()
SET(CFLAGS ${CMAKE_C_FLAGS})
SET(CXXFLAGS ${CMAKE_CXX_FLAGS})
SET(MYSQLD_USER "mysql")
SET(MYSQLD_GROUP "mysql")
SET(ini_file_extension "cnf")
SET(HOSTNAME "hostname")
SET(CNF_SOCKET_LINE "# socket = .....")
Expand Down