Use /var/tmp as default tmpdir to prevent potential issues

Resolves: #905635
This commit is contained in:
Honza Horák 2013-06-03 16:07:28 +02:00
parent 8652d15a40
commit 4e46615aa5
2 changed files with 95 additions and 0 deletions

View File

@ -0,0 +1,88 @@
Directory /tmp is now on tmpfs, which can cause problems with limitted space
or replication. It's documented here:
http://dev.mysql.com/doc/refman/5.5/en/server-options.html#option_mysqld_tmpdir
"If the MySQL server is acting as a replication slave, you should not set --tmpdir
to point to a directory on a memory-based file system or to a directory that is
cleared when the server host restarts."
RHBZ#962087
Upstream bug report: https://mariadb.atlassian.net/browse/MDEV-4165
MySQL bug report: http://bugs.mysql.com/bug.php?id=68338
diff -up mysql-5.5.31/CMakeLists.txt.tmpdir mysql-5.5.31/CMakeLists.txt
--- mysql-5.5.31/CMakeLists.txt.tmpdir 2013-06-03 15:14:51.149345233 +0200
+++ mysql-5.5.31/CMakeLists.txt 2013-06-03 15:29:23.263489056 +0200
@@ -253,6 +253,10 @@ IF(SYSCONFDIR)
SET(DEFAULT_SYSCONFDIR "${SYSCONFDIR}")
ENDIF()
+IF(TMPDIR)
+ SET(DEFAULT_TMPDIR "${TMPDIR}")
+ENDIF()
+
# Run platform tests
INCLUDE(configure.cmake)
diff -up mysql-5.5.31/config.h.cmake.tmpdir mysql-5.5.31/config.h.cmake
--- mysql-5.5.31/config.h.cmake.tmpdir 2013-03-25 14:14:58.000000000 +0100
+++ mysql-5.5.31/config.h.cmake 2013-06-03 15:14:51.149345233 +0200
@@ -600,6 +600,7 @@
#cmakedefine DEFAULT_CHARSET_HOME "@DEFAULT_CHARSET_HOME@"
#cmakedefine PLUGINDIR "@PLUGINDIR@"
#cmakedefine DEFAULT_SYSCONFDIR "@DEFAULT_SYSCONFDIR@"
+#cmakedefine DEFAULT_TMPDIR "@DEFAULT_TMPDIR@"
#cmakedefine SO_EXT "@CMAKE_SHARED_MODULE_SUFFIX@"
diff -up mysql-5.5.31/include/my_global.h.tmpdir mysql-5.5.31/include/my_global.h
--- mysql-5.5.31/include/my_global.h.tmpdir 2013-03-25 14:14:58.000000000 +0100
+++ mysql-5.5.31/include/my_global.h 2013-06-03 15:14:51.150345232 +0200
@@ -1501,4 +1501,11 @@ static inline double rint(double x)
#endif /* EMBEDDED_LIBRARY */
+/*
+ Define default tmpdir if not already set.
+*/
+#if !defined(DEFAULT_TMPDIR)
+#define DEFAULT_TMPDIR P_tmpdir
+#endif
+
#endif /* my_global_h */
diff -up mysql-5.5.31/libmysqld/lib_sql.cc.tmpdir mysql-5.5.31/libmysqld/lib_sql.cc
--- mysql-5.5.31/libmysqld/lib_sql.cc.tmpdir 2013-03-25 14:14:58.000000000 +0100
+++ mysql-5.5.31/libmysqld/lib_sql.cc 2013-06-03 15:14:51.150345232 +0200
@@ -558,7 +558,7 @@ int init_embedded_server(int argc, char
opt_mysql_tmpdir=getenv("TMP");
#endif
if (!opt_mysql_tmpdir || !opt_mysql_tmpdir[0])
- opt_mysql_tmpdir=(char*) P_tmpdir; /* purecov: inspected */
+ opt_mysql_tmpdir=(char*) DEFAULT_TMPDIR; /* purecov: inspected */
init_ssl();
umask(((~my_umask) & 0666));
diff -up mysql-5.5.31/mysys/mf_tempdir.c.tmpdir mysql-5.5.31/mysys/mf_tempdir.c
--- mysql-5.5.31/mysys/mf_tempdir.c.tmpdir 2013-03-25 14:14:58.000000000 +0100
+++ mysql-5.5.31/mysys/mf_tempdir.c 2013-06-03 15:14:51.150345232 +0200
@@ -43,7 +43,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, c
pathlist=getenv("TMP");
#endif
if (!pathlist || !pathlist[0])
- pathlist=(char*) P_tmpdir;
+ pathlist=(char*) DEFAULT_TMPDIR;
}
do
{
diff -up mysql-5.5.31/mysys/mf_tempfile.c.tmpdir mysql-5.5.31/mysys/mf_tempfile.c
--- mysql-5.5.31/mysys/mf_tempfile.c.tmpdir 2013-03-25 14:14:58.000000000 +0100
+++ mysql-5.5.31/mysys/mf_tempfile.c 2013-06-03 15:14:51.150345232 +0200
@@ -111,7 +111,7 @@ File create_temp_file(char *to, const ch
sizeof(prefix_buff)-7),"XXXXXX") -
prefix_buff);
if (!dir && ! (dir =getenv("TMPDIR")))
- dir=P_tmpdir;
+ dir=DEFAULT_TMPDIR;
if (strlen(dir)+ pfx_len > FN_REFLEN-2)
{
errno=my_errno= ENAMETOOLONG;

View File

@ -60,6 +60,7 @@ Patch21: community-mysql-dh1024.patch
Patch22: community-mysql-major.patch
Patch23: community-mysql-sharedir.patch
Patch24: community-mysql-man-pages.patch
Patch25: community-mysql-tmpdir.patch
BuildRequires: perl, readline-devel, openssl-devel
BuildRequires: cmake, ncurses-devel, zlib-devel, libaio-devel
@ -241,6 +242,7 @@ the MySQL sources.
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
# workaround for upstream bug #56342
rm -f mysql-test/t/ssl_8k_key-master.opt
@ -310,6 +312,7 @@ cmake . -DBUILD_CONFIG=mysql_release \
-DWITH_READLINE=ON \
-DWITH_SSL=system \
-DWITH_ZLIB=system \
-DTMPDIR=/var/tmp \
-DWITH_MYSQLD_LDFLAGS="-Wl,-z,relro,-z,now"
make %{?_smp_mflags} VERBOSE=1
@ -700,6 +703,10 @@ install -m 0644 mysql-test/rh-skipped-tests.list ${RPM_BUILD_ROOT}%{_datadir}/my
%{_mandir}/man1/mysql_client_test.1*
%changelog
* Mon Jun 3 2013 Honza Horak <hhorak@redhat.com> 5.5.31-7
- Use /var/tmp as default tmpdir to prevent potential issues
Resolves: #905635
* Wed May 29 2013 Jan Stanek <jstanek@redhat.com> 5.5.31-6
- Added missing command-line options to man-pages (#948930)