c48a49a
Some hard-coded paths make problems when package is built into chroot like
c48a49a
Software Collections. Removing these hard-coded paths should fix it.
c48a49a
c48a49a
Upstream report: https://mariadb.atlassian.net/browse/MDEV-6485
c48a49a
c48a49a
d90e5b1
diff -up mysql-5.6.23/client/mysql_plugin.c.hardpaths mysql-5.6.23/client/mysql_plugin.c
d90e5b1
--- mysql-5.6.23/client/mysql_plugin.c.hardpaths	2015-01-19 14:48:30.000000000 +0100
d90e5b1
+++ mysql-5.6.23/client/mysql_plugin.c	2015-02-23 13:34:21.328484658 +0100
c48a49a
@@ -90,6 +90,7 @@ static int find_plugin(char *tp_path);
c48a49a
 static int build_bootstrap_file(char *operation, char *bootstrap);
c48a49a
 static int dump_bootstrap_file(char *bootstrap_file);
c48a49a
 static int bootstrap_server(char *server_path, char *bootstrap_file);
3ff9598
+static int find_file_in_path(const char *name, char *to);
c48a49a
 
c48a49a
 
c48a49a
 int main(int argc,char *argv[])
c48a49a
@@ -121,7 +122,7 @@ int main(int argc,char *argv[])
c48a49a
   */
c48a49a
   if ((error= process_options(argc, argv, operation)) ||
c48a49a
       (error= check_access()) ||
c48a49a
-      (error= find_tool("mysqld" FN_EXEEXT, server_path)) ||
c48a49a
+      (error= find_file_in_path("mysqld" FN_EXEEXT, server_path)) ||
c48a49a
       (error= find_plugin(tp_path)) ||
c48a49a
       (error= build_bootstrap_file(operation, bootstrap)))
c48a49a
     goto exit;
c48a49a
@@ -324,7 +325,7 @@ static int get_default_values()
c48a49a
   FILE *file= 0;
c48a49a
 
c48a49a
   memset(tool_path, 0, FN_REFLEN);
c48a49a
-  if ((error= find_tool("my_print_defaults" FN_EXEEXT, tool_path)))
c48a49a
+  if ((error= find_file_in_path("my_print_defaults" FN_EXEEXT, tool_path)))
c48a49a
     goto exit;
c48a49a
   else
c48a49a
   {
c48a49a
@@ -989,6 +990,55 @@ exit:
c48a49a
 }
c48a49a
 
c48a49a
 
c48a49a
+#if defined(__WIN__)
c48a49a
+#define F_OK 0
c48a49a
+#define PATH_SEP ';'
c48a49a
+#define PROGRAM_EXTENSION ".exe"
c48a49a
+#else
c48a49a
+#define PATH_SEP ':'
c48a49a
+#endif
c48a49a
+
3ff9598
+static int find_file_in_path(const char *name, char *to)
c48a49a
+{
c48a49a
+  char *path,*pos,dir[2];
c48a49a
+  const char *ext="";
c48a49a
+
c48a49a
+  if (!(path=getenv("PATH")))
c48a49a
+    goto notfound;
c48a49a
+  dir[0]=FN_LIBCHAR; dir[1]=0;
c48a49a
+#ifdef PROGRAM_EXTENSION
c48a49a
+  if (!fn_ext(name)[0])
c48a49a
+    ext=PROGRAM_EXTENSION;
c48a49a
+#endif
c48a49a
+
c48a49a
+  for (pos=path ; (pos=strchr(pos,PATH_SEP)) ; path= ++pos)
c48a49a
+  {
c48a49a
+    if (path != pos)
c48a49a
+    {
c48a49a
+      strxmov(strnmov(to,path,(uint) (pos-path)),dir,name,ext,NullS);
c48a49a
+      if (!access(to,F_OK))
c48a49a
+      {
c48a49a
+        if (opt_verbose)
c48a49a
+          printf("# Found tool '%s' as '%s'.\n", name, to);
c48a49a
+	return 0;
c48a49a
+      }
c48a49a
+    }
c48a49a
+  }
c48a49a
+#ifdef __WIN__
c48a49a
+  to[0]=FN_CURLIB;
c48a49a
+  strxmov(to+1,dir,name,ext,NullS);
c48a49a
+  if (!access(to,F_OK))			/* Test in current dir */
c48a49a
+  {
c48a49a
+    if (opt_verbose)
c48a49a
+      printf("# Found tool '%s' as '%s'.\n", name, to);
c48a49a
+    return 0;
c48a49a
+  }
c48a49a
+#endif
c48a49a
+notfound:
c48a49a
+  fprintf(stderr, "WARNING: Cannot find %s.\n", name);
c48a49a
+  return 1;				/* File not found */
c48a49a
+}
c48a49a
+
c48a49a
 /**
c48a49a
   Locate the tool and form tool path.
c48a49a
 
d90e5b1
diff -up mysql-5.6.23/cmake/install_layout.cmake.hardpaths mysql-5.6.23/cmake/install_layout.cmake
d90e5b1
--- mysql-5.6.23/cmake/install_layout.cmake.hardpaths	2015-01-19 14:48:32.000000000 +0100
d90e5b1
+++ mysql-5.6.23/cmake/install_layout.cmake	2015-02-23 13:34:21.330484657 +0100
d90e5b1
@@ -94,7 +94,7 @@ IF(UNIX)
d90e5b1
     " Choose between ${VALID_INSTALL_LAYOUTS}" )
d90e5b1
   ENDIF()
d90e5b1
 
d90e5b1
-  SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc"
d90e5b1
+  SET(SYSCONFDIR "/etc"
d90e5b1
     CACHE PATH "config directory (for my.cnf)")
d90e5b1
   MARK_AS_ADVANCED(SYSCONFDIR)
d90e5b1
 ENDIF()
d90e5b1
@@ -145,6 +145,7 @@ SET(INSTALL_PLUGINTESTDIR_STANDALONE
d90e5b1
 SET(INSTALL_BINDIR_RPM                  "bin")
d90e5b1
 SET(INSTALL_SBINDIR_RPM                 "sbin")
d90e5b1
 SET(INSTALL_SCRIPTDIR_RPM               "bin")
d90e5b1
+SET(INSTALL_SYSCONFDIR_RPM              "/etc")
d90e5b1
 #
d90e5b1
 IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
d90e5b1
   SET(INSTALL_LIBDIR_RPM                "lib64")
d90e5b1
diff -up mysql-5.6.23/mysys_ssl/my_default.cc.hardpaths mysql-5.6.23/mysys_ssl/my_default.cc
d90e5b1
--- mysql-5.6.23/mysys_ssl/my_default.cc.hardpaths	2015-01-19 14:48:32.000000000 +0100
d90e5b1
+++ mysql-5.6.23/mysys_ssl/my_default.cc	2015-02-23 13:34:21.329484658 +0100
c48a49a
@@ -1389,12 +1389,12 @@ static const char **init_default_directo
c48a49a
 
c48a49a
 #else
c48a49a
 
c48a49a
-  errors += add_directory(alloc, "/etc/", dirs);
c48a49a
-  errors += add_directory(alloc, "/etc/mysql/", dirs);
c48a49a
-
c48a49a
 #if defined(DEFAULT_SYSCONFDIR)
c48a49a
   if (DEFAULT_SYSCONFDIR[0])
c48a49a
+  {
c48a49a
     errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);
c48a49a
+    errors += add_directory(alloc, DEFAULT_SYSCONFDIR "/mysql", dirs);
c48a49a
+  }
c48a49a
 #endif /* DEFAULT_SYSCONFDIR */
c48a49a
 
c48a49a
 #endif
d90e5b1
diff -up mysql-5.6.23/scripts/CMakeLists.txt.hardpaths mysql-5.6.23/scripts/CMakeLists.txt
d90e5b1
--- mysql-5.6.23/scripts/CMakeLists.txt.hardpaths	2015-02-23 13:34:21.325484657 +0100
d90e5b1
+++ mysql-5.6.23/scripts/CMakeLists.txt	2015-02-23 13:34:21.330484657 +0100
d90e5b1
@@ -219,7 +219,7 @@ INSTALL_SCRIPT(
d90e5b1
   )
d90e5b1
 
d90e5b1
 SET(prefix "${CMAKE_INSTALL_PREFIX}")
d90e5b1
-SET(sysconfdir ${prefix})
d90e5b1
+SET(sysconfdir ${SYSCONFDIR})
d90e5b1
 SET(bindir ${prefix}/${INSTALL_BINDIR})
d90e5b1
 SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
d90e5b1
 SET(scriptdir ${prefix}/${INSTALL_BINDIR})
d90e5b1
diff -up mysql-5.6.23/scripts/mysqlaccess.sh.hardpaths mysql-5.6.23/scripts/mysqlaccess.sh
d90e5b1
--- mysql-5.6.23/scripts/mysqlaccess.sh.hardpaths	2015-01-19 14:48:32.000000000 +0100
d90e5b1
+++ mysql-5.6.23/scripts/mysqlaccess.sh	2015-02-23 13:34:21.329484658 +0100
c48a49a
@@ -483,9 +483,6 @@ MySQLaccess::Report::Print_Header();
c48a49a
   elsif (-f "@sysconfdir@/$script_conf") {
c48a49a
      require "@sysconfdir@/$script_conf";
c48a49a
   }
c48a49a
-  elsif (-f "/etc/$script_conf") {
c48a49a
-     require "/etc/$script_conf";
c48a49a
-  }
c48a49a
 
c48a49a
 # ****************************
c48a49a
 # Read in all parameters
c48a49a
@@ -951,7 +948,6 @@ sub MergeConfigFile {
c48a49a
 sub MergeConfigFiles {
c48a49a
     my ($name,$pass,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = getpwuid $<;
c48a49a
     MergeConfigFile("@sysconfdir@/my.cnf");
c48a49a
-    MergeConfigFile("/etc/my.cnf");
c48a49a
     MergeConfigFile("$dir/.my.cnf");
c48a49a
 }
c48a49a
 
d90e5b1
diff -up mysql-5.6.23/scripts/mysqld_multi.sh.hardpaths mysql-5.6.23/scripts/mysqld_multi.sh
d90e5b1
--- mysql-5.6.23/scripts/mysqld_multi.sh.hardpaths	2015-01-19 14:48:32.000000000 +0100
d90e5b1
+++ mysql-5.6.23/scripts/mysqld_multi.sh	2015-02-23 13:34:21.329484658 +0100
c48a49a
@@ -573,9 +573,7 @@ sub list_defaults_files
c48a49a
 
c48a49a
   my %seen;  # Don't list the same file more than once
c48a49a
   return grep { defined $_ and not $seen{$_}++ and -f $_ and -r $_ }
c48a49a
-              ('/etc/my.cnf',
c48a49a
-               '/etc/mysql/my.cnf',
c48a49a
-               '@sysconfdir@/my.cnf',
c48a49a
+              ('@sysconfdir@/my.cnf',
c48a49a
                ($ENV{MYSQL_HOME} ? "$ENV{MYSQL_HOME}/my.cnf" : undef),
c48a49a
                $opt{'extra-file'},
c48a49a
                ($ENV{HOME} ? "$ENV{HOME}/.my.cnf" : undef));
d90e5b1
diff -up mysql-5.6.23/scripts/mysql_install_db.pl.in.hardpaths mysql-5.6.23/scripts/mysql_install_db.pl.in
d90e5b1
--- mysql-5.6.23/scripts/mysql_install_db.pl.in.hardpaths	2015-02-23 13:34:37.995485386 +0100
d90e5b1
+++ mysql-5.6.23/scripts/mysql_install_db.pl.in	2015-02-23 13:35:15.505487028 +0100
d90e5b1
@@ -922,7 +922,7 @@ if ( open(PIPE, "| $mysqld_install_cmd_l
d90e5b1
 	      "The new default config file was created as $copy_cfg_file,",
d90e5b1
 	      "please compare it with your file and take the changes you need.");
d90e5b1
     }
d90e5b1
-    foreach my $cfg ( "/etc/my.$cnfext", "/etc/mysql/my.$cnfext" )
d90e5b1
+    foreach my $cfg ( "@SYSCONFDIR@/my.$cnfext", "@SYSCONFDIR@/mysql/my.$cnfext" )
d90e5b1
     {
d90e5b1
       check_sys_cfg_file ($opt, $cfg);
d90e5b1
     }