From 1d1616dee3d76ef31f01bd4423ceff3831ce855b Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 22 Dec 2010 08:25:37 +0100 Subject: more work on MySQL 5.5.8 --- Makefile | 4 ++ compat-mysql51.spec | 180 ++++++++++++++++++++++++++++++++++++++++++++++ filter-requires-mysql.sh | 3 + my_config.h | 24 +++++++ mysql-chain-certs.patch | 41 +++++++++++ mysql-cve-2008-7247.patch | 58 +++++++++++++++ mysql-errno.patch | 21 ++++++ mysql-setschedparam.patch | 22 ++++++ mysql-ssl-multilib.patch | 20 ++++++ mysql-stack-guard.patch | 145 +++++++++++++++++++++++++++++++++++++ mysql-strmov.patch | 32 +++++++++ 11 files changed, 550 insertions(+) create mode 100644 Makefile create mode 100755 compat-mysql51.spec create mode 100755 filter-requires-mysql.sh create mode 100644 my_config.h create mode 100644 mysql-chain-certs.patch create mode 100644 mysql-cve-2008-7247.patch create mode 100644 mysql-errno.patch create mode 100644 mysql-setschedparam.patch create mode 100644 mysql-ssl-multilib.patch create mode 100644 mysql-stack-guard.patch create mode 100644 mysql-strmov.patch diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1e65467 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../common/Makefile + diff --git a/compat-mysql51.spec b/compat-mysql51.spec new file mode 100755 index 0000000..0fd39f1 --- /dev/null +++ b/compat-mysql51.spec @@ -0,0 +1,180 @@ +Name: compat-mysql51 +Version: 5.1.54 +Release: 1%{dist} +Summary: MySQL shared libraries. +License: GPL +Group: Applications/Databases +URL: http://www.mysql.com + +Source0: http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-%{version}%{-srctype}.tar.gz +Source5: my_config.h +Source6: ndbd.init +Source7: ndb_mgmd.init +Source8: ndb_types.h +# Working around perl dependency checking bug in rpm FTTB. Remove later. +Source999: filter-requires-mysql.sh + +Patch1: mysql-ssl-multilib.patch +Patch2: mysql-errno.patch +Patch6: mysql-stack-guard.patch +# add by a simple echo - Patch7: mysql-disable-test.patch +Patch8: mysql-setschedparam.patch +Patch10: mysql-strmov.patch +Patch12: mysql-cve-2008-7247.patch +Patch16: mysql-chain-certs.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-root +BuildRequires: gperf, perl, readline-devel, openssl-devel +BuildRequires: gcc-c++, ncurses-devel, zlib-devel +BuildRequires: libtool automake autoconf +# make test requires time and ps +BuildRequires: time procps +Requires: bash + +Obsoletes: mysqlclient16 < %{version} +Provides: mysqlclient16 = %{version} + +# Working around perl dependency checking bug in rpm FTTB. Remove later. +%define __perl_requires %{SOURCE999} + +# Force include and library files into a nonstandard place +%{expand: %%define _origincludedir %{_includedir}} +%{expand: %%define _origlibdir %{_libdir}} +%define _includedir %{_origincludedir}/mysql51 +%define _libdir %{_origlibdir}/mysql51 + +%description +This package contains backlevel versions of the MySQL client libraries +for use with applications linked against them. These shared libraries +were created using MySQL %[version}. + +%package devel + +Summary: Files for development of MySQL applications. +License: GPL +Group: Applications/Databases +Requires: %{name} = %{version}-%{release} + +%description devel +This package contains the libraries and header files that are needed for +developing MySQL applications using client libraries. + +%prep +%setup -q -n mysql-%{version} + +%patch1 -p1 +%patch2 -p1 +%patch6 -p1 +%patch10 -p1 +%patch12 -p1 +%patch16 -p1 + +libtoolize --force +aclocal +automake --add-missing -Wno-portability +autoconf +autoheader + +%build +CFLAGS="%{optflags} -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" +CFLAGS="$CFLAGS -fno-strict-aliasing -fwrapv" +%ifarch alpha +# Can't link C++ objects into an executable without this. Odd! +# -ECL 2002-12-19 +CFLAGS="$CFLAGS -fPIC" +%endif +CXXFLAGS="$CFLAGS -fno-rtti -fno-exceptions" +export CFLAGS CXXFLAGS + +%configure \ + --with-readline \ + --with-ssl \ + --without-debug \ + --enable-shared \ + --without-bench \ + --without-server \ + --without-docs \ + --without-man \ + --localstatedir=/var/lib/mysql \ + --with-unix-socket-path=/var/lib/mysql/mysql.sock \ + --with-mysqld-user="mysql" \ + --with-extra-charsets=all \ + --without-plugin-archive \ + --without-plugin-blackhole \ + --without-plugin-example \ + --without-plugin-federated \ + --without-plugin-innobase \ + --enable-local-infile \ + --enable-largefile \ + --enable-thread-safe-client \ + --disable-dependency-tracking \ + --with-named-thread-libs="-lpthread" + +make %{?_smp_mflags} +make check + +%install +rm -rf $RPM_BUILD_ROOT + +%makeinstall + +install -m 644 include/my_config.h $RPM_BUILD_ROOT%{_includedir}/mysql/my_config_`uname -i`.h +install -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{_includedir}/mysql/ + +# We want the .so files both in regular _libdir (for execution) and +# in special _libdir/mysql4 directory (for convenient building of clients). +# The ones in the latter directory should be just symlinks though. +mkdir -p ${RPM_BUILD_ROOT}%{_origlibdir}/mysql +pushd ${RPM_BUILD_ROOT}%{_origlibdir}/mysql +mv -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqlclient.so.16.*.* . +mv -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqlclient_r.so.16.*.* . +cp -p -d ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqlclient*.so.* . +popd +pushd ${RPM_BUILD_ROOT}%{_libdir}/mysql +ln -s ../../mysql/libmysqlclient.so.16.*.* . +ln -s ../../mysql/libmysqlclient_r.so.16.*.* . +popd + +# Put the config script into special libdir +cp -p $RPM_BUILD_ROOT%{_bindir}/mysql_config ${RPM_BUILD_ROOT}%{_libdir}/mysql + +rm -rf $RPM_BUILD_ROOT%{_prefix}/mysql-test +rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/*.a +rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/*.la +rm -rf $RPM_BUILD_ROOT%{_datadir}/mysql +rm -rf $RPM_BUILD_ROOT%{_bindir} +rm -rf $RPM_BUILD_ROOT%{_libexecdir} +rm -rf $RPM_BUILD_ROOT%{_infodir}/* +rm -rf $RPM_BUILD_ROOT%{_mandir}/man?/* +rm -rf $RPM_BUILD_ROOT%{_prefix}/sql-bench +rm -rf $RPM_BUILD_ROOT%{_datadir}/aclocal/mysql.m4 + + + +mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d +echo "%{_origlibdir}/mysql" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%doc README COPYING +%{_origlibdir}/mysql/libmysqlclient*.so.* +/etc/ld.so.conf.d/* + +%files devel +%defattr(-,root,root) +%{_includedir} +%{_libdir} + +%changelog +* Tue Dec 21 2010 Remi Collet 5.1.54-1 +- update to 5.1.54 + +* Fri Jan 09 2009 Remi Collet 5.1.30-1.###.remi +- first build of mysqlclient16 diff --git a/filter-requires-mysql.sh b/filter-requires-mysql.sh new file mode 100755 index 0000000..4e75ff6 --- /dev/null +++ b/filter-requires-mysql.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +/usr/lib/rpm/perl.req $* | grep -v -e "perl(th" -e "perl(lib::mtr" diff --git a/my_config.h b/my_config.h new file mode 100644 index 0000000..ad2e3da --- /dev/null +++ b/my_config.h @@ -0,0 +1,24 @@ +/* + * 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. + * + * 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(__ia64__) +#include "my_config_ia64.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" +#endif diff --git a/mysql-chain-certs.patch b/mysql-chain-certs.patch new file mode 100644 index 0000000..3b20a28 --- /dev/null +++ b/mysql-chain-certs.patch @@ -0,0 +1,41 @@ +Fix things so that chains of certificates work in the server and client +certificate files. + +This only really works for OpenSSL-based builds, as yassl is unable to read +multiple certificates from a file. The patch below to yassl/src/ssl.cpp +doesn't fix that, but just arranges that the viosslfactories.c patch won't +have any ill effects in a yassl build. Since we don't use yassl in Red Hat/ +Fedora builds, I'm not feeling motivated to try to fix yassl for this. + +See RH bug #598656. Filed upstream at http://bugs.mysql.com/bug.php?id=54158 + + +diff -Naur mysql-5.1.47.orig/vio/viosslfactories.c mysql-5.1.47/vio/viosslfactories.c +--- mysql-5.1.47.orig/vio/viosslfactories.c 2010-05-06 11:28:07.000000000 -0400 ++++ mysql-5.1.47/vio/viosslfactories.c 2010-05-26 23:23:46.000000000 -0400 +@@ -100,7 +100,7 @@ + (long) ctx, cert_file, key_file)); + if (cert_file) + { +- if (SSL_CTX_use_certificate_file(ctx, cert_file, SSL_FILETYPE_PEM) <= 0) ++ if (SSL_CTX_use_certificate_chain_file(ctx, cert_file) <= 0) + { + *error= SSL_INITERR_CERT; + DBUG_PRINT("error",("%s from file '%s'", sslGetErrString(*error), cert_file)); +diff -Naur mysql-5.1.47.orig/extra/yassl/src/ssl.cpp mysql-5.1.47/extra/yassl/src/ssl.cpp +--- mysql-5.1.47.orig/extra/yassl/src/ssl.cpp 2010-05-06 11:24:26.000000000 -0400 ++++ mysql-5.1.47/extra/yassl/src/ssl.cpp 2010-05-26 23:29:13.000000000 -0400 +@@ -1606,10 +1606,10 @@ + } + + +- int SSL_CTX_use_certificate_chain_file(SSL_CTX*, const char*) ++ int SSL_CTX_use_certificate_chain_file(SSL_CTX* ctx, const char* file) + { +- // TDOD: +- return SSL_SUCCESS; ++ // For the moment, treat like use_certificate_file ++ return read_file(ctx, file, SSL_FILETYPE_PEM, Cert); + } + + diff --git a/mysql-cve-2008-7247.patch b/mysql-cve-2008-7247.patch new file mode 100644 index 0000000..acd460f --- /dev/null +++ b/mysql-cve-2008-7247.patch @@ -0,0 +1,58 @@ +Back-ported patch for upstream bug #39277. + + +diff -Naur mysql-5.1.42.orig/sql/sql_table.cc mysql-5.1.42/sql/sql_table.cc +--- mysql-5.1.42.orig/sql/sql_table.cc 2009-12-16 12:57:30.000000000 -0500 ++++ mysql-5.1.42/sql/sql_table.cc 2010-01-28 14:33:52.000000000 -0500 +@@ -3892,15 +3892,43 @@ + create_info->table_existed= 0; // Mark that table is created + + #ifdef HAVE_READLINK +- if (test_if_data_home_dir(create_info->data_file_name)) + { +- my_error(ER_WRONG_ARGUMENTS, MYF(0), "DATA DIRECTORY"); +- goto unlock_and_end; +- } +- if (test_if_data_home_dir(create_info->index_file_name)) +- { +- my_error(ER_WRONG_ARGUMENTS, MYF(0), "INDEX DIRECTORY"); +- goto unlock_and_end; ++ size_t dirlen; ++ char dirpath[FN_REFLEN]; ++ ++ /* ++ data_file_name and index_file_name include the table name without ++ extension. Mostly this does not refer to an existing file. When ++ comparing data_file_name or index_file_name against the data ++ directory, we try to resolve all symbolic links. On some systems, ++ we use realpath(3) for the resolution. This returns ENOENT if the ++ resolved path does not refer to an existing file. my_realpath() ++ does then copy the requested path verbatim, without symlink ++ resolution. Thereafter the comparison can fail even if the ++ requested path is within the data directory. E.g. if symlinks to ++ another file system are used. To make realpath(3) return the ++ resolved path, we strip the table name and compare the directory ++ path only. If the directory doesn't exist either, table creation ++ will fail anyway. ++ */ ++ if (create_info->data_file_name) ++ { ++ dirname_part(dirpath, create_info->data_file_name, &dirlen); ++ if (test_if_data_home_dir(dirpath)) ++ { ++ my_error(ER_WRONG_ARGUMENTS, MYF(0), "DATA DIRECTORY"); ++ goto unlock_and_end; ++ } ++ } ++ if (create_info->index_file_name) ++ { ++ dirname_part(dirpath, create_info->index_file_name, &dirlen); ++ if (test_if_data_home_dir(dirpath)) ++ { ++ my_error(ER_WRONG_ARGUMENTS, MYF(0), "INDEX DIRECTORY"); ++ goto unlock_and_end; ++ } ++ } + } + + #ifdef WITH_PARTITION_STORAGE_ENGINE diff --git a/mysql-errno.patch b/mysql-errno.patch new file mode 100644 index 0000000..30cb09b --- /dev/null +++ b/mysql-errno.patch @@ -0,0 +1,21 @@ +"extern int errno" is just a really bad idea. + + +diff -Naur mysql-5.1.32.orig/include/my_sys.h mysql-5.1.32/include/my_sys.h +--- mysql-5.1.32.orig/include/my_sys.h 2009-02-13 19:52:19.000000000 -0500 ++++ mysql-5.1.32/include/my_sys.h 2009-03-04 18:08:40.000000000 -0500 +@@ -199,13 +199,8 @@ + #define my_afree(PTR) my_free(PTR,MYF(MY_WME)) + #endif /* HAVE_ALLOCA */ + +-#ifndef errno /* did we already get it? */ +-#ifdef HAVE_ERRNO_AS_DEFINE + #include /* errno is a define */ +-#else +-extern int errno; /* declare errno */ +-#endif +-#endif /* #ifndef errno */ ++ + extern char *home_dir; /* Home directory for user */ + extern const char *my_progname; /* program-name (printed in errors) */ + extern char NEAR curr_dir[]; /* Current directory for user */ diff --git a/mysql-setschedparam.patch b/mysql-setschedparam.patch new file mode 100644 index 0000000..3b0e518 --- /dev/null +++ b/mysql-setschedparam.patch @@ -0,0 +1,22 @@ +mysql tries to use pthread_setschedparam() with policy = SCHED_OTHER, +which is not standardized and is not presently supported on Red Hat +platforms; in fact it generates lots of SELinux warnings (bug #477624). +Easiest fix is to disable the configure test for it. + + +diff -Naur mysql-5.1.33.orig/configure.in mysql-5.1.33/configure.in +--- mysql-5.1.33.orig/configure.in 2009-03-13 17:48:52.000000000 -0400 ++++ mysql-5.1.33/configure.in 2009-04-07 19:27:25.000000000 -0400 +@@ -2046,10 +2046,10 @@ + localtime_r gethrtime gmtime_r \ + locking longjmp lrand48 madvise mallinfo memcpy memmove \ + mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \ +- pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \ ++ pthread_attr_getstacksize pthread_attr_setprio \ + pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \ + pthread_key_delete pthread_rwlock_rdlock pthread_setprio \ +- pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \ ++ pthread_setprio_np pthread_sigmask readlink \ + realpath rename rint rwlock_init setupterm \ + shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \ + sighold sigset sigthreadmask port_create sleep \ diff --git a/mysql-ssl-multilib.patch b/mysql-ssl-multilib.patch new file mode 100644 index 0000000..845984b --- /dev/null +++ b/mysql-ssl-multilib.patch @@ -0,0 +1,20 @@ +We can do without -L/usr/lib/, especially in 64-bit builds ... + + +diff -Naur mysql-5.1.30.orig/config/ac-macros/ssl.m4 mysql-5.1.30/config/ac-macros/ssl.m4 +--- mysql-5.1.30.orig/config/ac-macros/ssl.m4 2008-11-14 11:34:23.000000000 -0500 ++++ mysql-5.1.30/config/ac-macros/ssl.m4 2009-01-13 19:17:09.000000000 -0500 +@@ -102,7 +102,12 @@ + # + # Try to link with openSSL libs in + # +- openssl_libs="-L$location/lib/ -lssl -lcrypto" ++ if test "$location" != "/usr" ++ then ++ openssl_libs="-L$location/lib/ -lssl -lcrypto" ++ else ++ openssl_libs="-lssl -lcrypto" ++ fi + MYSQL_CHECK_SSL_DIR([$openssl_includes], [$openssl_libs]) + + if test "$mysql_ssl_found" == "no" diff --git a/mysql-stack-guard.patch b/mysql-stack-guard.patch new file mode 100644 index 0000000..d1e3a3f --- /dev/null +++ b/mysql-stack-guard.patch @@ -0,0 +1,145 @@ +mysql is not accounting for the "guard page" when setting thread stack size +requests. This is fatal on PPC systems, which may use guard pages as large +as 64K. This patch also documents the IA64 situation a bit better. + +Note: there are quite a few other setstacksize calls besides the two in +mysqld.cc; is it important to fix any of the others? + +Filed upstream at http://bugs.mysql.com/bug.php?id=35019 + + +diff -Naur mysql-5.1.30.orig/sql/mysqld.cc mysql-5.1.30/sql/mysqld.cc +--- mysql-5.1.30.orig/sql/mysqld.cc 2008-11-14 11:37:13.000000000 -0500 ++++ mysql-5.1.30/sql/mysqld.cc 2009-01-13 12:08:35.000000000 -0500 +@@ -2602,6 +2602,70 @@ + } + + ++/* pthread_attr_setstacksize without so much platform-dependency */ ++/* returns the actual stack size if possible */ ++static size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize) ++{ ++ size_t guard_size = 0; ++ ++#if defined(__ia64__) || defined(__ia64) ++ /* ++ On IA64, half of the requested stack size is used for "normal stack" ++ and half for "register stack". The space measured by check_stack_overrun ++ is the "normal stack", so double the request to make sure we have the ++ caller-expected amount of normal stack. ++ ++ NOTE: there is no guarantee that the register stack can't grow faster ++ than normal stack, so it's very unclear that we won't dump core due to ++ stack overrun despite check_stack_overrun's efforts. Experimentation ++ shows that in the execution_constants test, the register stack grows ++ less than half as fast as normal stack, but perhaps other scenarios are ++ less forgiving. If it turns out that more space is needed for the ++ register stack, that could be forced (rather inefficiently) by using a ++ multiplier higher than 2 here. ++ */ ++ stacksize *= 2; ++#endif ++ ++ /* ++ On many machines, the "guard space" is subtracted from the requested ++ stack size, and that space is quite large on some platforms. So add ++ it to our request, if we can find out what it is. ++ ++ FIXME: autoconfiscate use of pthread_attr_getguardsize ++ */ ++ if (pthread_attr_getguardsize(attr, &guard_size)) ++ guard_size = 0; /* if can't find it out, treat as 0 */ ++ ++ pthread_attr_setstacksize(attr, stacksize + guard_size); ++ ++ /* Retrieve actual stack size if possible */ ++#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE ++ { ++ size_t real_stack_size= 0; ++ /* We must ignore real_stack_size = 0 as Solaris 2.9 can return 0 here */ ++ if (pthread_attr_getstacksize(attr, &real_stack_size) == 0 && ++ real_stack_size > guard_size) ++ { ++ real_stack_size -= guard_size; ++ if (real_stack_size < stacksize) ++ { ++ if (global_system_variables.log_warnings) ++ sql_print_warning("Asked for %ld thread stack, but got %ld", ++ (long) stacksize, (long) real_stack_size); ++ stacksize= real_stack_size; ++ } ++ } ++ } ++#endif ++ ++#if defined(__ia64__) || defined(__ia64) ++ stacksize /= 2; ++#endif ++ return stacksize; ++} ++ ++ + static void start_signal_handler(void) + { + int error; +@@ -2614,15 +2678,7 @@ + (void) pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); + if (!(opt_specialflag & SPECIAL_NO_PRIOR)) + my_pthread_attr_setprio(&thr_attr,INTERRUPT_PRIOR); +-#if defined(__ia64__) || defined(__ia64) +- /* +- Peculiar things with ia64 platforms - it seems we only have half the +- stack size in reality, so we have to double it here +- */ +- pthread_attr_setstacksize(&thr_attr,my_thread_stack_size*2); +-#else +- pthread_attr_setstacksize(&thr_attr,my_thread_stack_size); +-#endif ++ (void) my_setstacksize(&thr_attr,my_thread_stack_size); + #endif + + (void) pthread_mutex_lock(&LOCK_thread_count); +@@ -4176,40 +4232,12 @@ + init_signals(); + if (!(opt_specialflag & SPECIAL_NO_PRIOR)) + my_pthread_setprio(pthread_self(),CONNECT_PRIOR); +-#if defined(__ia64__) || defined(__ia64) +- /* +- Peculiar things with ia64 platforms - it seems we only have half the +- stack size in reality, so we have to double it here +- */ +- pthread_attr_setstacksize(&connection_attrib,my_thread_stack_size*2); +-#else +- pthread_attr_setstacksize(&connection_attrib,my_thread_stack_size); +-#endif +-#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE +- { +- /* Retrieve used stack size; Needed for checking stack overflows */ +- size_t stack_size= 0; +- pthread_attr_getstacksize(&connection_attrib, &stack_size); +-#if defined(__ia64__) || defined(__ia64) +- stack_size/= 2; +-#endif +- /* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */ +- if (stack_size && stack_size < my_thread_stack_size) +- { +- if (global_system_variables.log_warnings) +- sql_print_warning("Asked for %lu thread stack, but got %ld", +- my_thread_stack_size, (long) stack_size); +-#if defined(__ia64__) || defined(__ia64) +- my_thread_stack_size= stack_size*2; +-#else +- my_thread_stack_size= stack_size; +-#endif +- } +- } +-#endif ++ + #ifdef __NETWARE__ + /* Increasing stacksize of threads on NetWare */ + pthread_attr_setstacksize(&connection_attrib, NW_THD_STACKSIZE); ++#else ++ my_thread_stack_size = my_setstacksize(&connection_attrib,my_thread_stack_size); + #endif + + (void) thr_setconcurrency(concurrency); // 10 by default diff --git a/mysql-strmov.patch b/mysql-strmov.patch new file mode 100644 index 0000000..07e5914 --- /dev/null +++ b/mysql-strmov.patch @@ -0,0 +1,32 @@ +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. + + +--- mysql-5.1.54/include/m_string.h.orig 2010-11-29 11:38:01.000000000 +0100 ++++ mysql-5.1.54/include/m_string.h 2010-12-16 17:52:57.914976701 +0100 +@@ -73,14 +73,6 @@ + extern void *(*my_str_malloc)(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)) +-#ifndef stpcpy +-extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ +-#endif +-#endif + + /* Declared in int2str() */ + extern char NEAR _dig_vec_upper[]; -- cgit