List:Commits« Previous MessageNext Message »
From:Jonathan Perkin Date:October 1 2009 1:59pm
Subject:bzr commit into mysql-5.1-bugteam branch (jperkin:3146) Bug#45113
View as plain text  
#At file:///home/sketch/bzr/mysql-bug45113/ based on revid:davi.arnaut@stripped

 3146 Jonathan Perkin	2009-10-01
      bug#45113: mysql_config returns incorrect path if built with prefix != execprefix
      
      Catch the corner case where prefix != exec-prefix and exec-prefix happens
      to have an include directory (e.g. from another package) by searching
      specifically for mysql.h.
      
      Add a note explaining that this will still fail if running from a different
      DESTDIR and the compiled-in file exists.

    modified:
      scripts/mysql_config.sh
=== modified file 'scripts/mysql_config.sh'

=== modified file 'scripts/mysql_config.sh'
--- a/scripts/mysql_config.sh	2008-11-10 21:12:15 +0000
+++ b/scripts/mysql_config.sh	2009-10-01 13:51:50 +0000
@@ -37,19 +37,37 @@
 }
 
 #
-# If we can find the given directory relatively to where mysql_config is
-# we should use this instead of the incompiled one.
-# This is to ensure that this script also works with the binary MySQL
-# version
+# If we can find the given file or directory relatively to where mysql_config
+# is we should use that instead of the compiled-in one.  This is to ensure
+# that this script also works with the binary MySQL version.
+#
+# Note that this does not work correctly if prefix and exec-prefix are
+# different, as there is no way to determine prefix relative to where the
+# script is being run from.  In this case it will always pick up the
+# compiled-in one if it exists on the file system.
+#
 
 fix_path ()
 {
+  if [ "$1" = "-f" ] ;
+  then
+    shift
+    search_file=$1
+    shift
+  fi
   var=$1
   shift
-  for filename
+  for dirname
   do
-    path=$basedir/$filename
-    if [ -d "$path" ] ;
+    path=$basedir/$dirname
+    if [ -n "$search_file" ] ;
+    then
+      if [ -f "$path/$search_file" ] ;
+      then
+        eval "$var"=$path
+        return
+      fi
+    elif [ -d "$path" ] ;
     then
       eval "$var"=$path
       return
@@ -89,8 +107,10 @@
 
 plugindir='@pkgplugindir@'
 
+# Search specifically for mysql.h to avoid picking up an include directory
+# which may reside in exec-prefix.
 pkgincludedir='@pkgincludedir@'
-fix_path pkgincludedir include/mysql include
+fix_path -f mysql.h pkgincludedir include/mysql include
 
 version='@VERSION@'
 socket='@MYSQL_UNIX_ADDR@'


Attachment: [text/bzr-bundle] bzr/jperkin@sun.com-20091001135150-w6r2xyl2p58hs49q.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (jperkin:3146) Bug#45113Jonathan Perkin1 Oct