From 4bcab578af7a90536070663de13e2ec7aeed0138 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Fri, 26 Jun 2009 11:58:19 +0200 Subject: [PATCH 1/4] This is a fix for bug#37808 "make_binary_distribution" does not always generate correct names Originally, we solved deficiencies of the predefined "autoconf" macros (at least on OS X 10.5, they do not correctly differ between "x86" and "x86_64") by providing explicit "--platform" arguments. With this patch, "make_binary_distribution" evaluates CFLAGS, so it "just works" because CFLAGS contains information about the target CPU. This patch is accompanied by a change in our build tools that drops the setting of "--platform" arguments. scripts/make_binary_distribution.sh: This is a fix for bug#37808 "make_binary_distribution" does not always generate correct names Our platform names are the combination of operating system, architecture (CPU), and a possible suffix (typically "64bit", if a CPU is available in 32 bit too). We get these values from some predefined "autoconf" macros. However, these macros are not perfect, especially on OS X 10.5 they do not differ correctly between x86 (32 bit) and x86_64 (64 bit). Originally, we solved that by providing an explicit "--platform" argument, but it is better to get rid of that and ensure the script "just works". The best indication we have about the CPU is the "CFLAGS" value provided with "configure" and used in "make": It describes for which CPU the binaries are generated, not just which one was running the build. This approach should work even if we implement cross-compilation. So this patch evaluates CFLAGS and extracts its "-arch XYZ" part. When touching the file, I also replaced some tab characters by blanks. --- scripts/make_binary_distribution.sh | 50 ++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index f156ea3b986..1be5d253e2f 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -28,6 +28,12 @@ SOURCE=`pwd` CP="cp -p" MV="mv" +# There are platforms, notably OS X on Intel (x86 + x86_64), +# for which "uname" does not provide sufficient information. +# The value of CFLAGS as used during compilation is the most exact info +# we can get - after all, we care about _what_ we built, not _where_ we did it. +cflags="@CFLAGS@" + STRIP=1 DEBUG=0 SILENT=0 @@ -71,10 +77,44 @@ system=`echo $system | sed -e 's/linux-gnu/linux/g'` system=`echo $system | sed -e 's/solaris2.\([0-9]*\)/solaris\1/g'` system=`echo $system | sed -e 's/sco3.2v\(.*\)/openserver\1/g'` +# Get the "machine", which really is the CPU architecture (including the size). +# The precedence is: +# 1) use an explicit argument, if given; +# 2) use platform-specific fixes, if there are any (see bug#37808); +# 3) stay with the default (determined during "configure", using predefined macros). if [ x"$MACHINE" != x"" ] ; then machine=$MACHINE +else + case $system in + osx* ) + # Extract "XYZ" from CFLAGS "... -arch XYZ ...", or empty! + cflag_arch=`echo "$cflags" | sed -n -e 's=.* -arch \([^ ]*\) .*=\1=p'` + case "$cflag_arch" in + i386 ) case $system in + osx10.4 ) machine=i686 ;; # Used a different naming + * ) machine=x86 ;; + esac ;; + x86_64 ) machine=x86_64 ;; + ppc ) ;; # No treatment needed with PPC + ppc64 ) ;; + * ) # No matching compiler flag? "--platform" is needed + if [ x"$PLATFORM" != x"" ] ; then + : # See below: "$PLATFORM" will take precedence anyway + elif [ "$system" = "osx10.3" -a -z "$cflag_arch" ] ; then + : # Special case of OS X 10.3, which is PPC-32 only and doesn't use "-arch" + else + echo "On system '$system' only specific '-arch' values are expected." + echo "It is taken from the 'CFLAGS' whose value is:" + echo "$cflags" + echo "'-arch $cflag_arch' is unexpected, and no '--platform' was given: ABORT" + exit 1 + fi ;; + esac # "$cflag_arch" + ;; + esac # $system fi +# Combine OS and CPU to the "platform". Again, an explicit argument takes precedence. if [ x"$PLATFORM" != x"" ] ; then platform="$PLATFORM" else @@ -117,10 +157,10 @@ which_1 () do for file in $d/$cmd do - if [ -x $file -a ! -d $file ] ; then - echo $file - exit 0 - fi + if [ -x $file -a ! -d $file ] ; then + echo $file + exit 0 + fi done done done @@ -354,7 +394,7 @@ if [ $BASE_SYSTEM = "netware" ] ; then $BASE/support-files/mysql-log-rotate \ $BASE/support-files/binary-configure \ $BASE/support-files/build-tags \ - $BASE/support-files/MySQL-shared-compat.spec \ + $BASE/support-files/MySQL-shared-compat.spec \ $BASE/support-files/ndb-config-2-node.ini \ $BASE/INSTALL-BINARY fi From a1af64f3adc136a2874940880e3bb6ae17b10b07 Mon Sep 17 00:00:00 2001 From: Daniel Fischer Date: Fri, 3 Jul 2009 13:48:08 +0200 Subject: [PATCH 2/4] Bug#44647 - fix file permissions. --- sql-bench/README | 0 tests/grant.pl | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 sql-bench/README mode change 100644 => 100755 tests/grant.pl diff --git a/sql-bench/README b/sql-bench/README old mode 100755 new mode 100644 diff --git a/tests/grant.pl b/tests/grant.pl old mode 100644 new mode 100755 From e2099d3dad679b805c0ea85e09ab562c19827d90 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Mon, 13 Jul 2009 20:39:58 +0300 Subject: [PATCH 3/4] tree name changed --- .bzr-mysql/default.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index 557df1b1ffe..f79c1cd6319 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.0-bugteam" +tree_name = "mysql-5.0" From 9ff932336e3d42273742a4b363d2b4e05d54f6d2 Mon Sep 17 00:00:00 2001 From: Joerg Bruehe Date: Thu, 30 Jul 2009 16:12:26 +0200 Subject: [PATCH 4/4] Our autoconf function "MYSQL_STACK_DIRECTION" will not work correctly if the compiler optimizes too clever. This has happaned on HP-UX 11.23 (IA64) at optimization level "+O2", causing bug#42213: Check for "stack overrun" doesn't work, server crashes Fix it by adding a pragma that prevents this optimization. As a result, it should be safe to use "+O2" on this platform (unless there is some other, optimizer-related, bug which is just currently masked because we use resudec optimization). config/ac-macros/misc.m4: Our autoconf function "MYSQL_STACK_DIRECTION" is meant to determine whether the stack grows towards higher or towards lower addresses. It does this by comparing the addresses of a variable (which is local to a recursive function) on different nesting levels. This approach requires that the function is really implemented as a recursive function, with each nested call allocating a new stack frame containing the local variable. If, however, the compiler is optimizing so clever that the recursive function is implemented by a loop, then this test will not produce correct results. This has happened on HP-UX 11.23 (IA64) when HP's compiler was called with optimization "+O2" (not with "+O1"), reported as bug#42213. Rather than starting a race with the compiler and making the function so complicated that this optimization does not happen, the idea is to prevent the optimization by adding a pragma. For HP, this is "#pragma noinline". If we encounter other compilers which also optimize too clever, we may add their pragmas here. It is a debatable issue whether such pragmas should be guarded by conditional compiling or not, the reviewers voted to do it. It seems HP has different compilers, "ANSI C" and "aCC", on the affected platform "__HP_cc" ("ANSI C") is predefined. To be on the safe side, the pragma will also take effect if HP's "aCC" compiler is used, or any other compiler on HP-UX. --- config/ac-macros/misc.m4 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4 index aef1eeaf935..9e575862848 100644 --- a/config/ac-macros/misc.m4 +++ b/config/ac-macros/misc.m4 @@ -583,6 +583,10 @@ fi AC_DEFUN([MYSQL_STACK_DIRECTION], [AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, [AC_TRY_RUN([#include + /* Prevent compiler optimization by HP's compiler, see bug#42213 */ +#if defined(__HP_cc) || defined (__HP_aCC) || defined (__hpux) +#pragma noinline +#endif int find_stack_direction () { static char *addr = 0;