Browse Source

mariadb package update

Signed-off-by: mariadbbuilder_pel7x64builder0 <mariadbbuilder@powerel.org>
master
mariadbbuilder_pel7x64builder0 6 years ago
commit
235cec5e16
  1. 13
      SOURCES/README.mysql-cnf
  2. 4
      SOURCES/README.mysql-docs
  3. 9
      SOURCES/README.mysql-license
  4. 24
      SOURCES/mariadb-admincrash.patch
  5. 16
      SOURCES/mariadb-basedir.patch
  6. 57
      SOURCES/mariadb-covscan-stroverflow.patch
  7. 18
      SOURCES/mariadb-errno.patch
  8. 45
      SOURCES/mariadb-file-contents.patch
  9. 38
      SOURCES/mariadb-install-db-sharedir.patch
  10. 56
      SOURCES/mariadb-install-test.patch
  11. 71
      SOURCES/mariadb-logrotate.patch
  12. 16
      SOURCES/mariadb-notestdb.patch
  13. 31
      SOURCES/mariadb-ownsetup.patch
  14. 37
      SOURCES/mariadb-scripts.patch
  15. 89
      SOURCES/mariadb-ssltest.patch
  16. 22
      SOURCES/mariadb-string-overflow.patch
  17. 30
      SOURCES/mariadb-strmov.patch
  18. 18
      SOURCES/my.cnf.in
  19. 33
      SOURCES/my_config.h
  20. 39
      SOURCES/mysql-check-socket.sh
  21. 39
      SOURCES/mysql-check-upgrade.sh
  22. 26
      SOURCES/mysql-embedded-check.c
  23. 89
      SOURCES/mysql-prepare-db-dir.sh
  24. 58
      SOURCES/mysql-scripts-common.sh
  25. 45
      SOURCES/mysql-wait-ready.sh
  26. 36
      SOURCES/mysql-wait-stop.sh
  27. 186
      SOURCES/mysql.init.in
  28. 70
      SOURCES/mysql.service.in
  29. 3
      SOURCES/mysql.tmpfiles.d.in
  30. 77
      SOURCES/mysql@.service.in
  31. 26
      SOURCES/mysql_config_multilib.sh
  32. 12
      SOURCES/rh-skipped-tests-arm.list
  33. 14
      SOURCES/rh-skipped-tests-base.list
  34. 22
      SOURCES/rh-skipped-tests-ppc-s390.list
  35. 1755
      SPECS/mariadb.spec

13
SOURCES/README.mysql-cnf

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
This directory contains prepared configuration files with .cnf extension,
which provide a configuration for some common MariaDB deployment scenarios.
These configuration files do not include the default configuration of datadir,
log-file and pid-file locations, as specified in the default my.cnf file,
provided in this distribution.

Thus, it is recommended to use these configuration files as an addition to the
default my.cnf configuration file.

Since default my.cnf contains `!includedir @INSTALL_SYSCONF2DIR@` directive, it is
recommended to copy required configuration under @INSTALL_SYSCONF2DIR@ directory,
so the default my.cnf specifications will be extended.

4
SOURCES/README.mysql-docs

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
The official MySQL documentation is not freely redistributable, so we cannot
include it in RHEL or Fedora. You can find it on-line at

http://dev.mysql.com/doc/

9
SOURCES/README.mysql-license

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
MySQL is distributed under GPL v2, but there are some licensing exceptions
that allow the client libraries to be linked with a non-GPL application,
so long as the application is under a license approved by Oracle.
For details see

http://www.mysql.com/about/legal/licensing/foss-exception/

Some innobase code from Percona and Google is under BSD license.
Some code related to test-suite is under LGPLv2.

24
SOURCES/mariadb-admincrash.patch

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
mysqladmin crash on execution of below command:

#> mysqladmin -u root -p
...
Segmentation fault (core dumped)

This is probably caused by memory corruption based on working with temp_argv[-1].

RHBZ: #1207041
Upstream report: https://mariadb.atlassian.net/browse/MDEV-7883

diff -up mariadb-5.5.41/client/mysqladmin.cc.bz1207041 mariadb-5.5.41/client/mysqladmin.cc
--- mariadb-5.5.41/client/mysqladmin.cc.bz1207041 2015-03-30 12:37:31.078880914 +0200
+++ mariadb-5.5.41/client/mysqladmin.cc 2015-03-30 13:03:32.442152833 +0200
@@ -1215,7 +1215,8 @@ static char **mask_password(int argc, ch
}
argc--;
}
- temp_argv[argc]= my_strdup((*argv)[argc], MYF(MY_FAE));
+ if (argc >= 0)
+ temp_argv[argc]= my_strdup((*argv)[argc], MYF(MY_FAE));
return(temp_argv);
}

16
SOURCES/mariadb-basedir.patch

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
Don't guess basedir in mysql_config; we place it under _libdir because
of multilib conflicts, so use rather configured @prefix@ path directly.

diff -up mariadb-10.0.13/scripts/mysql_config.sh.patch32 mariadb-10.0.13/scripts/mysql_config.sh
--- mariadb-10.0.13/scripts/mysql_config.sh.patch32 2014-08-13 17:28:51.174776518 +0200
+++ mariadb-10.0.13/scripts/mysql_config.sh 2014-08-13 17:32:18.205275028 +0200
@@ -76,8 +76,7 @@ get_full_path ()
me=`get_full_path $0`
-# Script might have been renamed but assume mysql_<something>config<something>
-basedir=`echo $me | sed -e 's;/bin/mysql_.*config.*;;'`
+basedir='@prefix@'
ldata='@localstatedir@'
execdir='@libexecdir@'

57
SOURCES/mariadb-covscan-stroverflow.patch

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
The following problems have been found by Coverity - static analysis tool.

mysql-5.5.31/plugin/semisync/semisync_master.cc:672:parameter_as_source – Note: This defect has an elevated risk because the source argument is a parameter of the current function.

mysql-5.5.31/plugin/semisync/semisync_master.cc:661:parameter_as_source – Note: This defect has an elevated risk because the source argument is a parameter of the current function.

mysql-5.5.31/plugin/semisync/semisync_master.cc:555:parameter_as_source – Note: This defect has an elevated risk because the source argument is a parameter of the current function.

diff -up mariadb-10.0.21/plugin/semisync/semisync_master.cc.orig mariadb-10.0.21/plugin/semisync/semisync_master.cc
--- mariadb-10.0.21/plugin/semisync/semisync_master.cc.orig 2015-08-05 20:11:31.000000000 +0200
+++ mariadb-10.0.21/plugin/semisync/semisync_master.cc 2015-08-10 17:22:31.700604043 +0200
@@ -553,7 +553,8 @@ int ReplSemiSyncMaster::reportReplyBinlo
if (need_copy_send_pos)
{
- strcpy(reply_file_name_, log_file_name);
+ strncpy(reply_file_name_, log_file_name, sizeof(reply_file_name_)-1);
+ reply_file_name_[sizeof(reply_file_name_)-1] = '\0';
reply_file_pos_ = log_file_pos;
reply_file_name_inited_ = true;
@@ -661,7 +662,8 @@ int ReplSemiSyncMaster::commitTrx(const
if (cmp <= 0)
{
/* This thd has a lower position, let's update the minimum info. */
- strcpy(wait_file_name_, trx_wait_binlog_name);
+ strncpy(wait_file_name_, trx_wait_binlog_name, sizeof(wait_file_name_)-1);
+ wait_file_name_[sizeof(wait_file_name_)-1] = '\0';
wait_file_pos_ = trx_wait_binlog_pos;
rpl_semi_sync_master_wait_pos_backtraverse++;
@@ -672,7 +674,8 @@ int ReplSemiSyncMaster::commitTrx(const
}
else
{
- strcpy(wait_file_name_, trx_wait_binlog_name);
+ strncpy(wait_file_name_, trx_wait_binlog_name, sizeof(wait_file_name_)-1);
+ wait_file_name_[sizeof(wait_file_name_)-1] = '\0';
wait_file_pos_ = trx_wait_binlog_pos;
wait_file_name_inited_ = true;

mysql-5.5.31/sql/rpl_handler.cc:306:fixed_size_dest – You might overrun the 512 byte fixed-size string "log_info->log_file" by copying "log_file + dirname_length(log_file)" without checking the length. diff -up mysql-5.5.31/sql/rpl_handler.cc.covscan-stroverflow mysql-5.5.31/sql/rpl_handler.cc

diff -up mariadb-10.0.21/sql/rpl_handler.cc.orig mariadb-10.0.21/sql/rpl_handler.cc
--- mariadb-10.0.21/sql/rpl_handler.cc.orig 2015-08-05 20:11:31.000000000 +0200
+++ mariadb-10.0.21/sql/rpl_handler.cc 2015-08-10 17:28:57.093803582 +0200
@@ -261,7 +261,8 @@ int Binlog_storage_delegate::after_flush
thd->semisync_info= log_info;
}
- strcpy(log_info->log_file, log_file+dirname_length(log_file));
+ strncpy(log_info->log_file, log_file+dirname_length(log_file), sizeof(log_info->log_file)-1);
+ log_info->log_file[sizeof(log_info->log_file)-1] = '\0';
log_info->log_pos = log_pos;
FOREACH_OBSERVER(ret, after_flush, false,

18
SOURCES/mariadb-errno.patch

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
diff -rup mariadb-10.1.8.orig/include/my_sys.h mariadb-10.1.8/include/my_sys.h
--- mariadb-10.1.8.orig/include/my_sys.h 2015-10-15 17:43:37.000000000 +0200
+++ mariadb-10.1.8/include/my_sys.h 2015-10-21 15:48:00.948590204 +0200
@@ -218,13 +218,7 @@ extern void my_large_free(uchar *ptr);
#define my_safe_afree(ptr, size) my_afree(ptr)
#endif /* HAVE_ALLOCA */
-#ifndef errno /* did we already get it? */
-#ifdef HAVE_ERRNO_AS_DEFINE
-#include <errno.h> /* errno is a define */
-#else
-extern int errno; /* declare errno */
-#endif
-#endif /* #ifndef errno */
+#include <errno.h> /* errno is a define */
extern char *home_dir; /* Home directory for user */
extern MYSQL_PLUGIN_IMPORT char *mysql_data_home;
extern const char *my_progname; /* program-name (printed in errors) */

45
SOURCES/mariadb-file-contents.patch

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
Upstream chooses to install INFO_SRC and INFO_BIN into the docs dir, which
breaks at least two packaging commandments, so we put them into $libdir
instead. That means we have to hack the file_contents regression test
to know about this.

Recommendation they change is at http://bugs.mysql.com/bug.php?id=61425


diff -rup mariadb-10.1.8.orig/mysql-test/t/file_contents.test mariadb-10.1.8/mysql-test/t/file_contents.test
--- mariadb-10.1.8.orig/mysql-test/t/file_contents.test 2015-10-15 17:43:44.000000000 +0200
+++ mariadb-10.1.8/mysql-test/t/file_contents.test 2015-10-19 13:54:53.505550439 +0200
@@ -11,7 +11,7 @@
--perl
print "\nChecking 'INFO_SRC' and 'INFO_BIN'\n";
$dir_bin = $ENV{'MYSQL_BINDIR'};
-if ($dir_bin eq '/usr/') {
+if ($dir_bin =~ '.*/usr/$') {
# RPM package
$dir_docs = $dir_bin;
$dir_docs =~ s|/lib|/share/doc|;
@@ -22,7 +22,7 @@ if ($dir_bin eq '/usr/') {
# RedHat: version number in directory name
$dir_docs = glob "$dir_docs/MariaDB-server*";
}
-} elsif ($dir_bin eq '/usr') {
+} elsif ($dir_bin =~ '.*/usr$') {
# RPM build during development
$dir_docs = "$dir_bin/share/doc";
if(-d "$dir_docs/packages") {
@@ -32,6 +32,15 @@ if ($dir_bin eq '/usr/') {
# RedHat/Debian: version number in directory name
$dir_docs = glob "$dir_docs/mariadb-server-*";
$dir_docs = glob "$dir_docs/MariaDB-server*" unless -d $dir_docs;
+
+ # All the above is entirely wacko, because these files are not docs;
+ # they should be kept in libdir instead. mtr does not provide a nice
+ # way to find libdir though, so we have to kluge it like this:
+ if (-d "$dir_bin/lib64/mysql") {
+ $dir_docs = "$dir_bin/lib64/mysql";
+ } else {
+ $dir_docs = "$dir_bin/lib/mysql";
+ }
}
# Slackware
$dir_docs = glob "$dir_bin/doc/mariadb-[0-9]*" unless -d $dir_docs;

38
SOURCES/mariadb-install-db-sharedir.patch

@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
Use configured value instead of hardcoded path

diff -up mariadb-10.0.13/scripts/mysql_install_db.pl.in.pbasedir mariadb-10.0.13/scripts/mysql_install_db.pl.in
--- mariadb-10.0.13/scripts/mysql_install_db.pl.in.pbasedir 2014-09-04 12:50:24.061979080 +0200
+++ mariadb-10.0.13/scripts/mysql_install_db.pl.in 2014-09-04 12:51:22.929045559 +0200
@@ -318,7 +318,7 @@ elsif ( $opt->{basedir} )
find_in_basedir($opt,"file","mysqld-nt",
"bin"); # ,"sql"
$pkgdatadir = find_in_basedir($opt,"dir","fill_help_tables.sql",
- "share","share/mysql"); # ,"scripts"
+ "share","@INSTALL_MYSQLSHAREDIR@"); # ,"scripts"
$scriptdir = "$opt->{basedir}/scripts";
}
else
diff -up mariadb-10.0.13/scripts/mysql_install_db.sh.pbasedir mariadb-10.0.13/scripts/mysql_install_db.sh
--- mariadb-10.0.13/scripts/mysql_install_db.sh.pbasedir 2014-09-04 12:51:59.005086301 +0200
+++ mariadb-10.0.13/scripts/mysql_install_db.sh 2014-09-04 12:54:02.794222597 +0200
@@ -280,16 +280,16 @@ then
cannot_find_file mysqld $basedir/libexec $basedir/sbin $basedir/bin
exit 1
fi
- langdir=`find_in_basedir --dir errmsg.sys share/english share/mysql/english`
+ langdir=`find_in_basedir --dir errmsg.sys share/english @INSTALL_MYSQLSHAREDIR@/english`
if test -z "$langdir"
then
- cannot_find_file errmsg.sys $basedir/share/english $basedir/share/mysql/english
+ cannot_find_file errmsg.sys $basedir/share/english $basedir/@INSTALL_MYSQLSHAREDIR@/english
exit 1
fi
- pkgdatadir=`find_in_basedir --dir fill_help_tables.sql share share/mysql`
+ pkgdatadir=`find_in_basedir --dir fill_help_tables.sql share @INSTALL_MYSQLSHAREDIR@`
if test -z "$pkgdatadir"
then
- cannot_find_file fill_help_tables.sql $basedir/share $basedir/share/mysql
+ cannot_find_file fill_help_tables.sql $basedir/share $basedir/@INSTALL_MYSQLSHAREDIR@
exit 1
fi
scriptdir="$basedir/scripts"

56
SOURCES/mariadb-install-test.patch

@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
Improve the documentation that will be installed in the mysql-test RPM.

diff -up mariadb-10.0.10/mysql-test/README.p3 mariadb-10.0.10/mysql-test/README
--- mariadb-10.0.10/mysql-test/README.p3 2014-04-07 16:05:51.402631548 +0200
+++ mariadb-10.0.10/mysql-test/README 2014-04-07 16:06:06.137637991 +0200
@@ -1,15 +1,28 @@
-This directory contains a test suite for the MySQL daemon. To run
-the currently existing test cases, simply execute ./mysql-test-run in
-this directory. It will fire up the newly built mysqld and test it.
-
-Note that you do not have to have to do "make install", and you could
-actually have a co-existing MySQL installation. The tests will not
-conflict with it. To run the test suite in a source directory, you
-must do make first.
-
-All tests must pass. If one or more of them fail on your system, please
-read the following manual section for instructions on how to report the
-problem:
+This directory contains a test suite for the MariaDB daemon. To run
+the currently existing test cases, execute ./mysql-test-run in
+this directory.
+
+For use in Red Hat distributions, you should run the script as user mysql,
+who is created with nologin shell however, so the best bet is something like
+ $ su -
+ # cd /usr/share/mysql-test
+ # su -s /bin/bash mysql -c "./mysql-test-run --skip-test-list=rh-skipped-tests.list"
+
+This will use the installed mysql executables, but will run a private copy
+of the server process (using data files within /usr/share/mysql-test),
+so you need not start the mysqld service beforehand.
+
+The "--skip-test-list=rh-skipped-tests.list" option excludes tests that are
+known to fail on one or more Red-Hat-supported platforms. You can omit it
+if you want to check whether such failures occur for you. Documentation
+about the reasons for omitting such tests can be found in the file
+rh-skipped-tests.list.
+
+To clean up afterwards, remove the created "var" subdirectory, eg
+ # su -s /bin/bash - mysql -c "rm -rf /usr/share/mysql-test/var"
+
+If one or more tests fail on your system, please read the following manual
+section for instructions on how to report the problem:
http://kb.askmonty.org/v/reporting-bugs
@@ -26,7 +39,8 @@ other relevant options.
With no test cases named on the command line, mysql-test-run falls back
to the normal "non-extern" behavior. The reason for this is that some
-tests cannot run with an external server.
+tests cannot run with an external server (because they need to control the
+options with which the server is started).
You can create your own test cases. To create a test case, create a new
file in the t subdirectory using a text editor. The file should have a .test

71
SOURCES/mariadb-logrotate.patch

@ -0,0 +1,71 @@ @@ -0,0 +1,71 @@
Adjust the mysql-log-rotate script in several ways:

* Use the correct log file pathname for Red Hat installations.
* Enable creation of the log file by logrotate (needed since
/var/log/ isn't writable by mysql user); and set the same 640
permissions we normally use.
* Comment out the actual rotation commands, so that user must edit
the file to enable rotation. This is unfortunate, but the fact
that the script will probably fail without manual configuration
(to set a root password) means that we can't really have it turned
on by default. Fortunately, in most configurations the log file
is low-volume and so rotation is not critical functionality.

See discussions at RH bugs 799735, 547007


diff -up mariadb-10.0.10/support-files/mysql-log-rotate.sh.p5 mariadb-10.0.10/support-files/mysql-log-rotate.sh
--- mariadb-10.0.10/support-files/mysql-log-rotate.sh.p5 2014-03-30 19:56:53.000000000 +0200
+++ mariadb-10.0.10/support-files/mysql-log-rotate.sh 2014-04-07 16:30:11.264618655 +0200
@@ -1,9 +1,9 @@
# This logname can be set in /etc/my.cnf
-# by setting the variable "err-log"
-# in the [safe_mysqld] section as follows:
+# by setting the variable "log-error"
+# in the [mysqld_safe] section as follows:
#
-# [safe_mysqld]
-# err-log=@localstatedir@/mysqld.log
+# [mysqld_safe]
+# log-error=@LOG_LOCATION@
#
# If the root user has a password you have to create a
# /root/.my.cnf configuration file with the following
@@ -18,19 +18,21 @@
# ATTENTION: This /root/.my.cnf should be readable ONLY
# for root !
-@localstatedir@/mysqld.log {
- # create 600 mysql mysql
- notifempty
- daily
- rotate 3
- missingok
- compress
- postrotate
- # just if mysqld is really running
- if test -x @bindir@/mysqladmin && \
- @bindir@/mysqladmin ping &>/dev/null
- then
- @bindir@/mysqladmin flush-logs
- fi
- endscript
-}
+# Then, un-comment the following lines to enable rotation of mysql's log file:
+
+#@LOG_LOCATION@ {
+# create 640 mysql mysql
+# notifempty
+# daily
+# rotate 3
+# missingok
+# compress
+# postrotate
+# # just if mysqld is really running
+# if test -x @bindir@/mysqladmin && \
+# @bindir@/mysqladmin ping &>/dev/null
+# then
+# @bindir@/mysqladmin flush-logs
+# fi
+# endscript
+#}

16
SOURCES/mariadb-notestdb.patch

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
diff -up mariadb-10.0.16/scripts/mysql_install_db.pl.in.createtestdb mariadb-10.0.16/scripts/mysql_install_db.pl.in
--- mariadb-10.0.16/scripts/mysql_install_db.pl.in.createtestdb 2015-03-03 23:02:33.287620715 +0100
+++ mariadb-10.0.16/scripts/mysql_install_db.pl.in 2015-03-03 23:02:56.664641960 +0100
@@ -398,10 +398,10 @@ if ( $opt->{'skip-name-resolve'} and $re
}
# ----------------------------------------------------------------------
-# Create database directories mysql & test
+# Create database directories mysql
# ----------------------------------------------------------------------
-foreach my $dir ( $opt->{ldata}, "$opt->{ldata}/mysql", "$opt->{ldata}/test" )
+foreach my $dir ( $opt->{ldata}, "$opt->{ldata}/mysql" )
{
# FIXME not really the same as original "mkdir -p", but ok?
mkdir($dir, 0700) unless -d $dir;

31
SOURCES/mariadb-ownsetup.patch

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
diff -up mariadb-10.1.8/support-files/CMakeLists.txt.p9 mariadb-10.1.8/support-files/CMakeLists.txt
--- mariadb-10.1.8/support-files/CMakeLists.txt.p9 2015-11-03 11:38:46.029139464 +0100
+++ mariadb-10.1.8/support-files/CMakeLists.txt 2015-11-03 11:41:07.107605055 +0100
@@ -62,6 +62,7 @@ IF(UNIX)
ENDIF()
CONFIGURE_FILE(mariadb.pc.in ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc @ONLY)
+ CONFIGURE_FILE(rpm/server.cnf ${CMAKE_CURRENT_BINARY_DIR}/rpm/server.cnf @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc DESTINATION ${INSTALL_SHAREDIR}/pkgconfig COMPONENT Development)
INSTALL(FILES mysql.m4 DESTINATION ${INSTALL_SHAREDIR}/aclocal COMPONENT Development)
diff -up mariadb-10.1.8/support-files/rpm/server.cnf.p9 mariadb-10.1.8/support-files/rpm/server.cnf
--- mariadb-10.1.8/support-files/rpm/server.cnf.p9 2015-10-15 17:44:19.000000000 +0200
+++ mariadb-10.1.8/support-files/rpm/server.cnf 2015-11-03 11:38:25.228070808 +0100
@@ -9,7 +9,16 @@
[server]
# this is only for the mysqld standalone daemon
+# Settings user and group are ignored when systemd is used.
+# If you need to run mysqld under a different user or group,
+# customize your systemd unit file for mysqld/mariadb according to the
+# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld]
+datadir=@MYSQL_DATADIR@
+socket=@MYSQL_UNIX_ADDR@
+log-error=@LOG_LOCATION@
+pid-file=@PID_FILE_DIR@/@DAEMON_NO_PREFIX@.pid
+
#
# * Galera-related settings

37
SOURCES/mariadb-scripts.patch

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
--- mariadb-10.1.11.orig/scripts/CMakeLists.txt 2016-01-28 13:12:51.000000000 +0100
+++ mariadb-10.1.11/scripts/CMakeLists.txt 2016-02-03 12:46:26.306109293 +0100
@@ -320,6 +320,34 @@ ELSE()
COMPONENT ${${file}_COMPONENT}
)
ENDFOREACH()
+
+ # files for systemd
+ SET(SYSTEMD_SCRIPTS
+ mysql.tmpfiles.d
+ mysql.service
+ mysql@.service
+ mysql-prepare-db-dir
+ mysql-wait-ready
+ mysql-wait-stop
+ mysql-check-socket
+ mysql-check-upgrade
+ mysql-scripts-common
+ mysql_config_multilib
+ mysql.init
+ my.cnf
+ )
+ FOREACH(file ${SYSTEMD_SCRIPTS})
+ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh)
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY)
+ ELSEIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.in)
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY)
+ ELSE()
+ MESSAGE(FATAL_ERROR "Can not find ${file}.sh or ${file}.in in "
+ "${CMAKE_CURRENT_SOURCE_DIR}" )
+ ENDIF()
+ ENDFOREACH()
ENDIF()
# Configure two scripts from one 'in' file.

89
SOURCES/mariadb-ssltest.patch

@ -0,0 +1,89 @@ @@ -0,0 +1,89 @@
DHE-RSA-AES256-GCM-SHA384 is not what we get in Fedora openssl, so we need
to replace a different cipher.

diff -up mariadb-10.0.18/mysql-test/t/openssl_1.test.ssltest mariadb-10.0.18/mysql-test/t/openssl_1.test
--- mariadb-10.0.18/mysql-test/t/openssl_1.test.ssltest 2015-05-08 07:26:43.836965643 +0200
+++ mariadb-10.0.18/mysql-test/t/openssl_1.test 2015-05-08 07:28:16.144215861 +0200
@@ -132,7 +132,7 @@ drop table t1;
# verification of servers certificate by setting both ca certificate
# and ca path to NULL
#
---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
+--replace_result AES128-GCM-SHA256 DHE-RSA-AES256-SHA
--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1
--echo End of 5.0 tests
@@ -257,7 +257,7 @@ select 'is still running; no cipher requ
GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509;
FLUSH PRIVILEGES;
connect(con1,localhost,bug42158,,,,,SSL);
---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
+--replace_result AES128-GCM-SHA256 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
disconnect con1;
connection default;
diff -up mariadb-10.0.18/mysql-test/t/ssl_timeout.test.ssltest mariadb-10.0.18/mysql-test/t/ssl_timeout.test
--- mariadb-10.0.18/mysql-test/t/ssl_timeout.test.ssltest 2015-05-08 07:22:24.504341009 +0200
+++ mariadb-10.0.18/mysql-test/t/ssl_timeout.test 2015-05-08 07:26:04.192885581 +0200
@@ -7,7 +7,7 @@
connect (ssl_con,localhost,root,,,,,SSL read_timeout=5);
--echo # Check ssl turned on
---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
+--replace_result AES128-GCM-SHA256 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
# --error CR_SERVER_LOST
diff -rup mysql-test-orig/t/ssl_8k_key.test mysql-test/t/ssl_8k_key.test
--- mariadb-10.0.20/mysql-test-orig/t/ssl_8k_key.test 2015-06-23 22:19:52.926707552 -0400
+++ mariadb-10.0.20/mysql-test/t/ssl_8k_key.test 2015-06-23 22:24:28.304261714 -0400
@@ -5,6 +5,7 @@
#
# Bug#29784 YaSSL assertion failure when reading 8k key.
#
+--replace_result AES128-GCM-SHA256 DHE-RSA-AES256-SHA
--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1
## This test file is for testing encrypted communication only, not other
diff -rup mysql-test-orig/t/ssl_compress.test mysql-test/t/ssl_compress.test
--- mariadb-10.0.20/mysql-test-orig/t/ssl_compress.test 2015-06-23 22:19:52.912707611 -0400
+++ mariadb-10.0.20/mysql-test/t/ssl_compress.test 2015-06-23 22:22:38.760221667 -0400
@@ -11,7 +11,7 @@
connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS);
# Check ssl turned on
---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
+--replace_result AES128-GCM-SHA256 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on
@@ -21,7 +21,7 @@ SHOW STATUS LIKE 'Compression';
-- source include/common-tests.inc
# Check ssl turned on
---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
+--replace_result AES128-GCM-SHA256 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on
diff -rup mysql-test-orig/t/ssl.test mysql-test/t/ssl.test
--- mariadb-10.0.20/mysql-test-orig/t/ssl.test 2015-06-23 22:19:52.902707654 -0400
+++ mariadb-10.0.20/mysql-test/t/ssl.test 2015-06-23 22:25:26.153282864 -0400
@@ -11,7 +11,7 @@
connect (ssl_con,localhost,root,,,,,SSL);
# Check ssl turned on
---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
+--replace_result AES128-GCM-SHA256 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
# Check ssl expiration
@@ -22,7 +22,7 @@ SHOW STATUS LIKE 'Ssl_server_not_after';
-- source include/common-tests.inc
# Check ssl turned on
---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
+--replace_result AES128-GCM-SHA256 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
#

22
SOURCES/mariadb-string-overflow.patch

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
These issues were found by Coverity static analysis tool, for more info
see messages by particular fixes (messages belong to 5.1.61).

Filed upstream at http://bugs.mysql.com/bug.php?id=64631


Error: BUFFER_SIZE_WARNING:
/builddir/build/BUILD/mysql-5.1.61/sql/sql_prepare.cc:2749: buffer_size_warning: Calling strncpy with a maximum size argument of 512 bytes on destination array "this->stmt->last_error" of size 512 bytes might leave the destination string unterminated.


diff -up mariadb-10.0.10/sql/sql_prepare.cc.p8 mariadb-10.0.10/sql/sql_prepare.cc
--- mariadb-10.0.10/sql/sql_prepare.cc.p8 2014-03-30 19:56:42.000000000 +0200
+++ mariadb-10.0.10/sql/sql_prepare.cc 2014-04-07 18:43:33.901074770 +0200
@@ -3021,7 +3021,7 @@ void mysql_stmt_get_longdata(THD *thd, c
{
stmt->state= Query_arena::STMT_ERROR;
stmt->last_errno= thd->get_stmt_da()->sql_errno();
- strncpy(stmt->last_error, thd->get_stmt_da()->message(), MYSQL_ERRMSG_SIZE);
+ strncpy(stmt->last_error, thd->get_stmt_da()->message(), sizeof(stmt->last_error)-1);
}
thd->set_stmt_da(save_stmt_da);

30
SOURCES/mariadb-strmov.patch

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
Remove overly optimistic definition of strmov() as stpcpy().

mysql uses this macro with overlapping source and destination strings,
which is verboten per spec, and fails on some Red Hat platforms.
Deleting the definition is sufficient to make it fall back to a
byte-at-a-time copy loop, which should consistently give the
expected behavior.

Note: the particular case that prompted this patch is reported and fixed
at http://bugs.mysql.com/bug.php?id=48864. However, my faith in upstream's
ability to detect this type of error is low, and I also see little evidence
of any real performance gain from optimizing these calls. So I'm keeping
this patch.

diff -up mariadb-10.0.15/include/m_string.h.orig mariadb-10.0.15/include/m_string.h
--- mariadb-10.0.15/include/m_string.h.orig 2014-11-27 14:40:32.622032698 +0100
+++ mariadb-10.0.15/include/m_string.h 2014-11-27 14:38:56.211864712 +0100
@@ -73,12 +73,6 @@ extern void *(*my_str_malloc)(size_t);
extern void *(*my_str_realloc)(void *, size_t);
extern void (*my_str_free)(void *);
-#if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER)
-#define strmov(A,B) __builtin_stpcpy((A),(B))
-#elif defined(HAVE_STPCPY)
-#define strmov(A,B) stpcpy((A),(B))
-#endif
-
/* Declared in int2str() */
extern const char _dig_vec_upper[];
extern const char _dig_vec_lower[];

18
SOURCES/my.cnf.in

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]

#
# This group is read by the server
#
[mysqld]
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

#
# include all files from the config directory
#
!includedir @INSTALL_SYSCONF2DIR@

33
SOURCES/my_config.h

@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
/*
* Kluge to support multilib installation of both 32- and 64-bit RPMS:
* we need to arrange that header files that appear in both RPMs are
* identical. Hence, this file is architecture-independent and calls
* in an arch-dependent file that will appear in just one RPM.
*
* To avoid breaking arches not explicitly supported by Red Hat, we
* use this indirection file *only* on known multilib arches.
*
* Note: this may well fail if user tries to use gcc's -I- option.
* But that option is deprecated anyway.
*/
#if defined(__x86_64__)
#include "my_config_x86_64.h"
#elif defined(__i386__)
#include "my_config_i386.h"
#elif defined(__ppc64__) || defined(__powerpc64__)
#include "my_config_ppc64.h"
#elif defined(__ppc__) || defined(__powerpc__)
#include "my_config_ppc.h"
#elif defined(__s390x__)
#include "my_config_s390x.h"
#elif defined(__s390__)
#include "my_config_s390.h"
#elif defined(__sparc__) && defined(__arch64__)
#include "my_config_sparc64.h"
#elif defined(__sparc__)
#include "my_config_sparc.h"
#elif defined(__arm__)
#include "my_config_arm.h"
#elif defined(__aarch64__)
#include "my_config_aarch64.h"
#endif

39
SOURCES/mysql-check-socket.sh

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
#!/bin/sh

# We check if there is already a process using the socket file,
# since otherwise the systemd service file could report false
# positive result when starting and mysqld_safe could remove
# a socket file, which is actually being used by a different daemon.

source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common"

if test -e "$socketfile" ; then
echo "Socket file $socketfile exists." >&2

# no write permissions
if ! test -w "$socketfile" ; then
echo "Not enough permission to write to the socket file $socketfile, which is suspicious." >&2
echo "Please, remove $socketfile manually to start the service." >&2
exit 1
fi

# not a socket file
if ! test -S "$socketfile" ; then
echo "The file $socketfile is not a socket file, which is suspicious." >&2
echo "Please, remove $socketfile manually to start the service." >&2
exit 1
fi

# some process uses the socket file
if fuser "$socketfile" &>/dev/null ; then
socketpid=$(fuser "$socketfile" 2>/dev/null)
echo "Is another MySQL daemon already running with the same unix socket?" >&2
echo "Please, stop the process $socketpid or remove $socketfile manually to start the service." >&2
exit 1
fi

# socket file is a garbage
echo "No process is using $socketfile, which means it is a garbage, so it will be removed automatically." >&2
fi

exit 0

39
SOURCES/mysql-check-upgrade.sh

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
#!/bin/sh

source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common"

upgrade_info_file="$datadir/mysql_upgrade_info"
version=0
# get version as integer from mysql_upgrade_info file
if [ -f "$upgrade_info_file" ] && [ -r "$upgrade_info_file" ] ; then
version_major=$(cat "$upgrade_info_file" | head -n 1 | sed -e 's/\([0-9]*\)\.\([0-9]*\)\..*$/\1/')
version_minor=$(cat "$upgrade_info_file" | head -n 1 | sed -e 's/\([0-9]*\)\.\([0-9]*\)\..*$/\2/')
if [[ $version_major =~ ^[0-9]+$ ]] && [[ $version_minor =~ ^[0-9]+$ ]] ; then
version=$((version_major*100+version_minor))
fi
fi

# compute current version as integer
thisversion=$((@MAJOR_VERSION@*100+@MINOR_VERSION@))

# provide warning in cases we should run mysql_upgrade
if [ $version -ne $thisversion ] ; then

# give extra warning if some version seems to be skipped
if [ $version -gt 0 ] && [ $version -lt 505 ] ; then
echo "The datadir located at $datadir seems to be older than of a version 5.5. Please, mind that as a general rule, to upgrade from one release series to another, go to the next series rather than skipping a series." >&2
fi

cat <<EOF >&2
The datadir located at $datadir needs to be upgraded using 'mysql_upgrade' tool. This can be done using the following steps:

1. Back-up your data before with 'mysql_upgrade'
2. Start the database daemon using 'service @DAEMON_NAME@ start'
3. Run 'mysql_upgrade' with a database user that has sufficient privileges

Read more about 'mysql_upgrade' usage at:
https://mariadb.com/kb/en/mariadb/documentation/sql-commands/table-commands/mysql_upgrade/
EOF
fi

exit 0

26
SOURCES/mysql-embedded-check.c

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
/* simple test program to see if we can link the embedded server library */

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

#include "mysql.h"

MYSQL *mysql;

static char *server_options[] = \
{ "mysql_test", "--defaults-file=my.cnf", NULL };
int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;

static char *server_groups[] = { "libmysqld_server",
"libmysqld_client", NULL };

int main(int argc, char **argv)
{
mysql_library_init(num_elements, server_options, server_groups);
mysql = mysql_init(NULL);
mysql_close(mysql);
mysql_library_end();

return 0;
}

89
SOURCES/mysql-prepare-db-dir.sh

@ -0,0 +1,89 @@ @@ -0,0 +1,89 @@
#!/bin/sh

# This script creates the mysql data directory during first service start.
# In subsequent starts, it does nothing much.

source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common"

# If two args given first is user, second is group
# otherwise the arg is the systemd service file
if [ "$#" -eq 2 ]
then
myuser="$1"
mygroup="$2"
else
# Absorb configuration settings from the specified systemd service file,
# or the default service if not specified
SERVICE_NAME="$1"
if [ x"$SERVICE_NAME" = x ]
then
SERVICE_NAME=@DAEMON_NAME@.service
fi

myuser=`systemctl show -p User "${SERVICE_NAME}" |
sed 's/^User=//'`
if [ x"$myuser" = x ]
then
myuser=mysql
fi

mygroup=`systemctl show -p Group "${SERVICE_NAME}" |
sed 's/^Group=//'`
if [ x"$mygroup" = x ]
then
mygroup=mysql
fi
fi

# Set up the errlogfile with appropriate permissions
touch "$errlogfile"
ret=$?
# Provide some advice if the log file cannot be touched
if [ $ret -ne 0 ] ; then
errlogdir=$(dirname $errlogfile)
if ! [ -d "$errlogdir" ] ; then
echo "The directory $errlogdir does not exist."
elif [ -f "$errlogfile" ] ; then
echo "The log file $errlogfile cannot be touched, please, fix its permissions."
else
echo "The log file $errlogfile could not be created."
fi
echo "The daemon will be run under $myuser:$mygroup"
exit 1
fi
chown "$myuser:$mygroup" "$errlogfile"
chmod 0640 "$errlogfile"
[ -x /sbin/restorecon ] && /sbin/restorecon "$errlogfile"

# Make the data directory
if [ ! -d "$datadir/mysql" ] ; then
# First, make sure $datadir is there with correct permissions
# (note: if it's not, and we're not root, this'll fail ...)
if [ ! -e "$datadir" -a ! -h "$datadir" ]
then
mkdir -p "$datadir" || exit 1
fi
chown "$myuser:$mygroup" "$datadir"
chmod 0755 "$datadir"
[ -x /sbin/restorecon ] && /sbin/restorecon "$datadir"

# Now create the database
echo "Initializing @NICE_PROJECT_NAME@ database"
@bindir@/mysql_install_db --rpm --datadir="$datadir" --user="$myuser"
ret=$?
if [ $ret -ne 0 ] ; then
echo "Initialization of @NICE_PROJECT_NAME@ database failed." >&2
echo "Perhaps @sysconfdir@/my.cnf is misconfigured." >&2
# Clean up any partially-created database files
if [ ! -e "$datadir/mysql/user.frm" ] ; then
rm -rf "$datadir"/*
fi
exit $ret
fi
# upgrade does not need to be run on a fresh datadir
echo "@VERSION@-MariaDB" >"$datadir/mysql_upgrade_info"
# In case we're running as root, make sure files are owned properly
chown -R "$myuser:$mygroup" "$datadir"
fi

exit 0

58
SOURCES/mysql-scripts-common.sh

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
#!/bin/sh

# Some useful functions used in other MySQL helper scripts
# This scripts defines variables datadir, errlogfile, socketfile

export LC_ALL=C

# extract value of a MySQL option from config files
# Usage: get_mysql_option VARNAME DEFAULT SECTION [ SECTION, ... ]
# result is returned in $result
# We use my_print_defaults which prints all options from multiple files,
# with the more specific ones later; hence take the last match.
get_mysql_option(){
if [ $# -ne 3 ] ; then
echo "get_mysql_option requires 3 arguments: section option default_value"
return
fi
sections="$1"
option_name="$2"
default_value="$3"
result=`@bindir@/my_print_defaults $sections | sed -n "s/^--${option_name}=//p" | tail -n 1`
if [ -z "$result" ]; then
# not found, use default
result="${default_value}"
fi
}

# Defaults here had better match what mysqld_safe will default to
# The option values are generally defined on three important places
# on the default installation:
# 1) default values are hardcoded in the code of mysqld daemon or
# mysqld_safe script
# 2) configurable values are defined in @sysconfdir@/my.cnf
# 3) default values for helper scripts are specified bellow
# So, in case values are defined in my.cnf, we need to get that value.
# In case they are not defined in my.cnf, we need to get the same value
# in the daemon, as in the helper scripts. Thus, default values here
# must correspond with values defined in mysqld_safe script and source
# code itself.

server_sections="mysqld_safe mysqld server mysqld-@MAJOR_VERSION@.@MINOR_VERSION@ mariadb mariadb-@MAJOR_VERSION@.@MINOR_VERSION@ client-server"

get_mysql_option "$server_sections" datadir "@MYSQL_DATADIR@"
datadir="$result"

# if there is log_error in the my.cnf, my_print_defaults still
# returns log-error
# log-error might be defined in mysqld_safe and mysqld sections,
# the former has bigger priority
get_mysql_option "$server_sections" log-error "$datadir/`hostname`.err"
errlogfile="$result"

get_mysql_option "$server_sections" socket "@MYSQL_UNIX_ADDR@"
socketfile="$result"

get_mysql_option "$server_sections" pid-file "$datadir/`hostname`.pid"
pidfile="$result"

45
SOURCES/mysql-wait-ready.sh

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
#!/bin/sh

source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common"

# This script waits for mysqld to be ready to accept connections
# (which can be many seconds or even minutes after launch, if there's
# a lot of crash-recovery work to do).
# Running this as ExecStartPost is useful so that services declared as
# "After mysqld" won't be started until the database is really ready.

if [ $# -ne 1 ] ; then
echo "You need to pass daemon pid as an argument for this script."
exit 20
fi

# Service file passes us the daemon's PID (actually, mysqld_safe's PID)
daemon_pid="$1"

# Wait for the server to come up or for the mysqld process to disappear
ret=0
while /bin/true; do
# Check process still exists
if ! [ -d "/proc/${daemon_pid}" ] ; then
ret=1
break
fi
RESPONSE=`@bindir@/mysqladmin --no-defaults --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1`
mret=$?
if [ $mret -eq 0 ] ; then
break
fi
# exit codes 1, 11 (EXIT_CANNOT_CONNECT_TO_SERVICE) are expected,
# anything else suggests a configuration error
if [ $mret -ne 1 -a $mret -ne 11 ]; then
echo "Cannot check for @NICE_PROJECT_NAME@ Daemon startup because of mysqladmin failure." >&2
ret=$mret
break
fi
# "Access denied" also means the server is alive
echo "$RESPONSE" | grep -q "Access denied for user" && break

sleep 1
done

exit $ret

36
SOURCES/mysql-wait-stop.sh

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
#!/bin/sh

source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common"

# This script waits for mysqld to be properly stopped
# (which can be many seconds in some large load).
# Running this as ExecStopPost is useful so that starting which is done
# as part of restart doesn't see the former process still running.

# Wait for the server to properly end the main server
ret=0
TIMEOUT=60
SECONDS=0

if ! [ -f "$pidfile" ]; then
exit 0
fi

MYSQLPID=`cat "$pidfile" 2>/dev/null`
if [ -z "$MYSQLPID" ] ; then
exit 2
fi

while /bin/true; do
# Check process still exists
if ! [ -d "/proc/${MYSQLPID}" ] ; then
break
fi
if [ $SECONDS -gt $TIMEOUT ] ; then
ret=3
break
fi
sleep 1
done

exit $ret

186
SOURCES/mysql.init.in

@ -0,0 +1,186 @@ @@ -0,0 +1,186 @@
#!/bin/sh
#
# @DAEMON_NAME@ This shell script takes care of starting and stopping
# the MySQL subsystem (mysqld).
#
# chkconfig: - 64 36
# description: MySQL database server.
# processname: mysqld
# config: @sysconfdir@/my.cnf
# pidfile: /var/run/@DAEMON_NAME@/@DAEMON_NAME@.pid
### BEGIN INIT INFO
# Provides: mysqld
# Required-Start: $local_fs $remote_fs $network $named $syslog $time
# Required-Stop: $local_fs $remote_fs $network $named $syslog $time
# Short-Description: start and stop MySQL server
# Description: MySQL database server
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network


exec="@bindir@/mysqld_safe"
prog="@DAEMON_NAME@"

# Set timeouts here so they can be overridden from @sysconfdir@/sysconfig/@DAEMON_NO_PREFIX@
STARTTIMEOUT=300
STOPTIMEOUT=60

# User and group the daemon will run under
MYUSER=mysql
MYGROUP=mysql

# Edit the following file in order to re-write some of the environment
# variables defined above, like $STARTTIMEOUT, $STOPTIMEOUT, $exec
[ -e @sysconfdir@/sysconfig/@DAEMON_NO_PREFIX@ ] && . @sysconfdir@/sysconfig/@DAEMON_NO_PREFIX@

lockfile=/var/lock/subsys/$prog

# get options from my.cnf
source "@libexecdir@/mysql-scripts-common"

start(){
[ -x $exec ] || exit 5

# check permissions
if ! touch $(dirname $socketfile) &>/dev/null ; then
action $"Starting $prog: " /bin/false
return 4
fi

# check to see if it's already running
MYSQLDRUNNING=0
if [ -f "$pidfile" ]; then
MYSQLPID=`cat "$pidfile" 2>/dev/null`
if [ -n "$MYSQLPID" ] && [ -d "/proc/$MYSQLPID" ] ; then
MYSQLDRUNNING=1
fi
fi
RESPONSE=`@bindir@/mysqladmin --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1`
if [ $MYSQLDRUNNING = 1 ] && [ $? = 0 ]; then
# already running, do nothing
action $"Starting $prog: " /bin/true
ret=0
elif [ $MYSQLDRUNNING = 1 ] && echo "$RESPONSE" | grep -q "Access denied for user"
then
# already running, do nothing
action $"Starting $prog: " /bin/true
ret=0
else
@libexecdir@/mysql-prepare-db-dir $MYUSER $MYGROUP || return 4
@libexecdir@/mysql-check-socket || return 1

# Pass all the options determined above, to ensure consistent behavior.
# In many cases mysqld_safe would arrive at the same conclusions anyway
# but we need to be sure. (An exception is that we don't force the
# log-error setting, since this script doesn't really depend on that,
# and some users might prefer to configure logging to syslog.)
# Note: set --basedir to prevent probes that might trigger SELinux
# alarms, per bug #547485
$exec --datadir="$datadir" --socket="$socketfile" \
--pid-file="$pidfile" \
--basedir=@prefix@ --user=$MYUSER >/dev/null 2>&1 &
safe_pid=$!

# Wait until the daemon is up
@libexecdir@/mysql-wait-ready "$safe_pid"
ret=$?

if [ $ret -eq 0 ]; then
action $"Starting $prog: " /bin/true
chmod o+r $pidfile >/dev/null 2>&1
touch $lockfile
else
action $"Starting $prog: " /bin/false
fi
fi
return $ret
}

stop(){
if [ ! -f "$pidfile" ]; then
# not running; per LSB standards this is "ok"
action $"Stopping $prog: " /bin/true
return 0
fi
MYSQLPID=`cat "$pidfile" 2>/dev/null`
if [ -n "$MYSQLPID" ]; then
if ! [ -d "/proc/$MYSQLPID" ] ; then
# process doesn't run anymore
action $"Stopping $prog: " /bin/true
return 0
fi
/bin/kill "$MYSQLPID" >/dev/null 2>&1
ret=$?
if [ $ret -eq 0 ]; then
TIMEOUT="$STOPTIMEOUT"
while [ $TIMEOUT -gt 0 ]; do
/bin/kill -0 "$MYSQLPID" >/dev/null 2>&1 || break
sleep 1
let TIMEOUT=${TIMEOUT}-1
done
if [ $TIMEOUT -eq 0 ]; then
echo "Timeout error occurred trying to stop MySQL Daemon."
ret=1
action $"Stopping $prog: " /bin/false
else
rm -f $lockfile
rm -f "$socketfile"
action $"Stopping $prog: " /bin/true
fi
else
# kill command failed, probably insufficient permissions
action $"Stopping $prog: " /bin/false
ret=4
fi
else
# failed to read pidfile, probably insufficient permissions
action $"Stopping $prog: " /bin/false
ret=4
fi
return $ret
}
restart(){
stop
start
}

condrestart(){
[ -e $lockfile ] && restart || :
}


# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p "$pidfile" $prog
;;
restart)
restart
;;
condrestart|try-restart)
condrestart
;;
reload)
exit 3
;;
force-reload)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac

exit $?

70
SOURCES/mysql.service.in

@ -0,0 +1,70 @@ @@ -0,0 +1,70 @@
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# best way is to create a file "/etc/systemd/system/@DAEMON_NAME@.service",
# containing
# .include /usr/lib/systemd/system/@DAEMON_NAME@.service
# ...make your changes here...
# or create a file "/etc/systemd/system/@DAEMON_NAME@.service.d/foo.conf",
# which doesn't need to include ".include" call and which will be parsed
# after the file @DAEMON_NAME@.service itself is parsed.
#
# For more info about custom unit files, see systemd.unit(5) or
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F

# For example, if you want to increase mysql's open-files-limit to 10000,
# you need to increase systemd's LimitNOFILE setting, so create a file named
# "/etc/systemd/system/@DAEMON_NAME@.service.d/limits.conf" containing:
# [Service]
# LimitNOFILE=10000

# Note: /usr/lib/... is recommended in the .include line though /lib/...
# still works.
# Don't forget to reload systemd daemon after you change unit configuration:
# root> systemctl --system daemon-reload

# Use [mysqld.INSTANCENAME] as sections in my.cnf to configure this instance.

[Unit]
Description=@NICE_PROJECT_NAME@ @MAJOR_VERSION@.@MINOR_VERSION@ database server
After=syslog.target
After=network.target

[Service]
Type=notify
User=mysql
Group=mysql

ExecStartPre=@libexecdir@/mysql-check-socket
ExecStartPre=@libexecdir@/mysql-prepare-db-dir %n
# MYSQLD_OPTS here is for users to set in /etc/systemd/system/@DAEMON_NAME@@.service.d/MY_SPECIAL.conf
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
# per bug #547485
ExecStart=@libexecdir@/mysqld --basedir=@prefix@ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER
ExecStartPost=@libexecdir@/mysql-check-upgrade
ExecStopPost=@libexecdir@/mysql-wait-stop

# Setting this to true can break replication and the Type=notify settings
# See also bind-address mysqld option.
PrivateNetwork=false

KillMode=process
KillSignal=SIGTERM

# Don't want to see an automated SIGKILL ever
SendSIGKILL=no

# Restart crashed server only, on-failure would also restart, for example, when
# my.cnf contains unknown option
Restart=on-abort
RestartSec=5s

UMask=007

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

# Place temp files in a secure directory, not /tmp
PrivateTmp=true

[Install]
WantedBy=multi-user.target

3
SOURCES/mysql.tmpfiles.d.in

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
# Do not edit this file.
# To override this, put /etc/tmpfiles.d/mariadb.conf instead.
d @PID_FILE_DIR@ 0755 mysql mysql -

77
SOURCES/mysql@.service.in

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
# Multi instance version of mariadb. For if you run mutiple verions at once.
# Also used for @DAEMON_NAME@@bootstrap to bootstrap Galera.
#
# To use multi instance variant, use [mysqld.INSTANCENAME] as sections in my.cnf
# and start the service via:
# systemctl start @DAEMON_NAME@@{instancename}.server
#
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# best way is to create a file "/etc/systemd/system/@DAEMON_NAME@.service",
# containing
# .include /usr/lib/systemd/system/@DAEMON_NAME@.service
# ...make your changes here...
# or create a file "/etc/systemd/system/@DAEMON_NAME@.service.d/foo.conf",
# which doesn't need to include ".include" call and which will be parsed
# after the file @DAEMON_NAME@.service itself is parsed.
#
# For more info about custom unit files, see systemd.unit(5) or
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F

# For example, if you want to increase mysql's open-files-limit to 10000,
# you need to increase systemd's LimitNOFILE setting, so create a file named
# "/etc/systemd/system/@DAEMON_NAME@.service.d/limits.conf" containing:
# [Service]
# LimitNOFILE=10000

# Note: /usr/lib/... is recommended in the .include line though /lib/...
# still works.
# Don't forget to reload systemd daemon after you change unit configuration:
# root> systemctl --system daemon-reload

# Use [mysqld.INSTANCENAME] as sections in my.cnf to configure this instance.

[Unit]
Description=@NICE_PROJECT_NAME@ @MAJOR_VERSION@.@MINOR_VERSION@ database server
After=syslog.target
After=network.target

[Service]
Type=notify
User=mysql
Group=mysql

ExecStartPre=@libexecdir@/mysql-check-socket
ExecStartPre=@libexecdir@/mysql-prepare-db-dir %n
# MYSQLD_OPTS here is for users to set in /etc/systemd/system/@DAEMON_NAME@@.service.d/MY_SPECIAL.conf
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
# per bug #547485
ExecStart=@libexecdir@/mysqld --defaults-group-suffix=.%I --basedir=@prefix@ $MYSQLD_OPTS $_WSREP_NEW_CLUSTER
ExecStartPost=@libexecdir@/mysql-check-upgrade
ExecStopPost=@libexecdir@/mysql-wait-stop

# Setting this to true can break replication and the Type=notify settings
# See also bind-address mysqld option.
PrivateNetwork=false

KillMode=process
KillSignal=SIGTERM

# Don't want to see an automated SIGKILL ever
SendSIGKILL=no

# Restart crashed server only, on-failure would also restart, for example, when
# my.cnf contains unknown option
Restart=on-abort
RestartSec=5s

UMask=007

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

# Place temp files in a secure directory, not /tmp
PrivateTmp=true

[Install]
WantedBy=multi-user.target

26
SOURCES/mysql_config_multilib.sh

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
#! /bin/sh
#
# Wrapper script for mysql_config to support multilib
#
# This command respects setarch

bits=$(rpm --eval %__isa_bits)

case $bits in
32|64) status=known ;;
*) status=unknown ;;
esac

if [ "$status" = "unknown" ] ; then
echo "$0: error: command 'rpm --eval %__isa_bits' returned unknown value: $bits"
exit 1
fi


if [ -x @bindir@/mysql_config-$bits ] ; then
@bindir@/mysql_config-$bits "$@"
else
echo "$0: error: needed binary: @bindir@/mysql_config-$bits is missing"
exit 1
fi

12
SOURCES/rh-skipped-tests-arm.list

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@

connect.bin : rhbz#1096787 (pass on aarch64)
connect.endian : rhbz#1096787

main.partition_exchange : rhbz#1096787
main.analyze_stmt_orderby : rhbz#1096787
main.explain_json_innodb : rhbz#1096787
main.explain_json_format_partitions : rhbz#1096787
main.analyze_format_json : rhbz#1096787
main.explain_json : rhbz#1096787
main.subselect_cache : rhbz#1096787
main.type_year : rhbz#1096787

14
SOURCES/rh-skipped-tests-base.list

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
# These tests fail with MariaDB 10:

main.userstat : rhbz#1096787
main.set_statement_notembedded_binlog : rhbz#1096787
main.ssl_7937 : rhbz#1096787
main.ssl_crl_clients : rhbz#1096787
main.openssl_1 : rhbz#1096787
main.ssl : rhbz#1096787
main.ssl_8k_key : rhbz#1096787
main.ssl_compress : rhbz#1096787
main.ssl_timeout : rhbz#1096787
perfschema.nesting : rhbz#1096787
perfschema.socket_summary_by_event_name_func : rhbz#1096787
perfschema.socket_summary_by_instance_func : rhbz#1096787

22
SOURCES/rh-skipped-tests-ppc-s390.list

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
connect.alter : rhbz#1096787
connect.bin : rhbz#1096787
connect.dbf : rhbz#1096787
connect.index : rhbz#1096787
connect.mrr : rhbz#1149647#c6
connect.part_file : rhbz#1149647
connect.part_table : rhbz#1149647
connect.updelx : rhbz#1149647
connect.updelx2 : rhbz#1149647#c6
connect.json_udf : rhbz#1149647#c8
sys_vars.sysvars_server_notembedded : rhbz#1149647
main.partition_exchange : rhbz#1149647
main.analyze_stmt_orderby : rhbz#1149647
main.explain_json_innodb : rhbz#1149647
encryption.encrypt_and_grep : rhbz#1149647
main.explain_json_format_partitions : rhbz#1149647
main.analyze_format_json : rhbz#1149647
main.explain_json : rhbz#1149647
main.mdev-504 : rhbz#1149647
main.subselect_cache : rhbz#1149647
main.type_year : rhbz#1149647
sys_vars.sysvars_wsrep : rhbz#1149647

1755
SPECS/mariadb.spec

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save