Blame SOURCES/mysql-paths.patch

80384c
Some hard-coded paths make problems when package is built into chroot like
80384c
Software Collections. Removing these hard-coded paths should fix it.
80384c
80384c
Upstream report: https://mariadb.atlassian.net/browse/MDEV-6485
80384c
80384c
489963
diff -up mysql-5.6.37/client/mysql_plugin.c.p10 mysql-5.6.37/client/mysql_plugin.c
489963
--- mysql-5.6.37/client/mysql_plugin.c.p10	2017-06-02 19:42:10.000000000 +0200
489963
+++ mysql-5.6.37/client/mysql_plugin.c	2017-07-20 16:21:30.654348408 +0200
80384c
@@ -90,6 +90,7 @@ static int find_plugin(char *tp_path);
80384c
 static int build_bootstrap_file(char *operation, char *bootstrap);
80384c
 static int dump_bootstrap_file(char *bootstrap_file);
80384c
 static int bootstrap_server(char *server_path, char *bootstrap_file);
80384c
+static int find_file_in_path(const char *name, char *to);
80384c
 
80384c
 
80384c
 int main(int argc,char *argv[])
80384c
@@ -121,7 +122,7 @@ int main(int argc,char *argv[])
80384c
   */
80384c
   if ((error= process_options(argc, argv, operation)) ||
80384c
       (error= check_access()) ||
80384c
-      (error= find_tool("mysqld" FN_EXEEXT, server_path)) ||
80384c
+      (error= find_file_in_path("mysqld" FN_EXEEXT, server_path)) ||
80384c
       (error= find_plugin(tp_path)) ||
80384c
       (error= build_bootstrap_file(operation, bootstrap)))
80384c
     goto exit;
80384c
@@ -324,7 +325,7 @@ static int get_default_values()
80384c
   FILE *file= 0;
80384c
 
80384c
   memset(tool_path, 0, FN_REFLEN);
80384c
-  if ((error= find_tool("my_print_defaults" FN_EXEEXT, tool_path)))
80384c
+  if ((error= find_file_in_path("my_print_defaults" FN_EXEEXT, tool_path)))
80384c
     goto exit;
80384c
   else
80384c
   {
489963
@@ -995,6 +996,55 @@ exit:
80384c
 }
80384c
 
80384c
 
80384c
+#if defined(__WIN__)
80384c
+#define F_OK 0
80384c
+#define PATH_SEP ';'
80384c
+#define PROGRAM_EXTENSION ".exe"
80384c
+#else
80384c
+#define PATH_SEP ':'
80384c
+#endif
80384c
+
80384c
+static int find_file_in_path(const char *name, char *to)
80384c
+{
80384c
+  char *path,*pos,dir[2];
80384c
+  const char *ext="";
80384c
+
80384c
+  if (!(path=getenv("PATH")))
80384c
+    goto notfound;
80384c
+  dir[0]=FN_LIBCHAR; dir[1]=0;
80384c
+#ifdef PROGRAM_EXTENSION
80384c
+  if (!fn_ext(name)[0])
80384c
+    ext=PROGRAM_EXTENSION;
80384c
+#endif
80384c
+
80384c
+  for (pos=path ; (pos=strchr(pos,PATH_SEP)) ; path= ++pos)
80384c
+  {
80384c
+    if (path != pos)
80384c
+    {
80384c
+      strxmov(strnmov(to,path,(uint) (pos-path)),dir,name,ext,NullS);
80384c
+      if (!access(to,F_OK))
80384c
+      {
80384c
+        if (opt_verbose)
80384c
+          printf("# Found tool '%s' as '%s'.\n", name, to);
80384c
+	return 0;
80384c
+      }
80384c
+    }
80384c
+  }
80384c
+#ifdef __WIN__
80384c
+  to[0]=FN_CURLIB;
80384c
+  strxmov(to+1,dir,name,ext,NullS);
80384c
+  if (!access(to,F_OK))			/* Test in current dir */
80384c
+  {
80384c
+    if (opt_verbose)
80384c
+      printf("# Found tool '%s' as '%s'.\n", name, to);
80384c
+    return 0;
80384c
+  }
80384c
+#endif
80384c
+notfound:
80384c
+  fprintf(stderr, "WARNING: Cannot find %s.\n", name);
80384c
+  return 1;				/* File not found */
80384c
+}
80384c
+
80384c
 /**
80384c
   Locate the tool and form tool path.
80384c
 
489963
diff -up mysql-5.6.37/cmake/install_layout.cmake.p10 mysql-5.6.37/cmake/install_layout.cmake
489963
--- mysql-5.6.37/cmake/install_layout.cmake.p10	2017-06-02 19:42:10.000000000 +0200
489963
+++ mysql-5.6.37/cmake/install_layout.cmake	2017-07-20 16:21:30.654348408 +0200
489963
@@ -108,7 +108,7 @@ IF(UNIX)
80384c
     " Choose between ${VALID_INSTALL_LAYOUTS}" )
80384c
   ENDIF()
80384c
 
80384c
-  SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc"
80384c
+  SET(SYSCONFDIR "/etc"
80384c
     CACHE PATH "config directory (for my.cnf)")
80384c
   MARK_AS_ADVANCED(SYSCONFDIR)
80384c
 ENDIF()
489963
@@ -326,6 +326,7 @@ SET(INSTALL_SECURE_FILE_PRIV_EMBEDDEDDIR
80384c
 SET(INSTALL_BINDIR_RPM                  "bin")
80384c
 SET(INSTALL_SBINDIR_RPM                 "sbin")
80384c
 SET(INSTALL_SCRIPTDIR_RPM               "bin")
80384c
+SET(INSTALL_SYSCONFDIR_RPM              "/etc")
80384c
 #
80384c
 IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
80384c
   SET(INSTALL_LIBDIR_RPM                "lib64")
489963
diff -up mysql-5.6.37/mysys_ssl/my_default.cc.p10 mysql-5.6.37/mysys_ssl/my_default.cc
489963
--- mysql-5.6.37/mysys_ssl/my_default.cc.p10	2017-06-02 19:42:10.000000000 +0200
489963
+++ mysql-5.6.37/mysys_ssl/my_default.cc	2017-07-20 16:21:30.655348411 +0200
489963
@@ -1400,12 +1400,12 @@ static const char **init_default_directo
80384c
 
80384c
 #else
80384c
 
80384c
-  errors += add_directory(alloc, "/etc/", dirs);
80384c
-  errors += add_directory(alloc, "/etc/mysql/", dirs);
80384c
-
80384c
 #if defined(DEFAULT_SYSCONFDIR)
80384c
   if (DEFAULT_SYSCONFDIR[0])
80384c
+  {
80384c
     errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);
80384c
+    errors += add_directory(alloc, DEFAULT_SYSCONFDIR "/mysql", dirs);
80384c
+  }
80384c
 #endif /* DEFAULT_SYSCONFDIR */
80384c
 
80384c
 #endif
489963
diff -up mysql-5.6.37/scripts/CMakeLists.txt.p10 mysql-5.6.37/scripts/CMakeLists.txt
489963
--- mysql-5.6.37/scripts/CMakeLists.txt.p10	2017-07-20 16:21:30.648348391 +0200
489963
+++ mysql-5.6.37/scripts/CMakeLists.txt	2017-07-20 16:21:30.655348411 +0200
489963
@@ -250,7 +250,7 @@ INSTALL_SCRIPT(
80384c
   )
80384c
 
80384c
 SET(prefix "${CMAKE_INSTALL_PREFIX}")
80384c
-SET(sysconfdir ${prefix})
80384c
+SET(sysconfdir ${SYSCONFDIR})
80384c
 SET(bindir ${prefix}/${INSTALL_BINDIR})
80384c
 SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
80384c
 SET(scriptdir ${prefix}/${INSTALL_BINDIR})
489963
diff -up mysql-5.6.37/scripts/mysqlaccess.sh.p10 mysql-5.6.37/scripts/mysqlaccess.sh
489963
--- mysql-5.6.37/scripts/mysqlaccess.sh.p10	2017-06-02 19:42:10.000000000 +0200
489963
+++ mysql-5.6.37/scripts/mysqlaccess.sh	2017-07-20 16:21:49.109399123 +0200
489963
@@ -481,10 +481,6 @@ MySQLaccess::Report::Print_Header();
489963
      print "Configuration file '$script_conf' is found in '@sysconfdir@/'\n";
80384c
      require "@sysconfdir@/$script_conf";
80384c
   }
80384c
-  elsif (-f "/etc/$script_conf") {
489963
-     print "Configuration file '$script_conf' is found in '/etc/'\n";
80384c
-     require "/etc/$script_conf";
80384c
-  }
489963
   elsif (-f "./$script_conf") {
489963
      print "\nERROR! Configuration file '$script_conf' is found in the current ";
489963
      print "directory.\nThe permissible locations for this file are either ";
489963
@@ -958,7 +954,6 @@ sub MergeConfigFile {
80384c
 sub MergeConfigFiles {
80384c
     my ($name,$pass,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = getpwuid $<;
80384c
     MergeConfigFile("@sysconfdir@/my.cnf");
80384c
-    MergeConfigFile("/etc/my.cnf");
80384c
     MergeConfigFile("$dir/.my.cnf");
80384c
 }
80384c
 
489963
diff -up mysql-5.6.37/scripts/mysqld_multi.sh.p10 mysql-5.6.37/scripts/mysqld_multi.sh
489963
--- mysql-5.6.37/scripts/mysqld_multi.sh.p10	2017-06-02 19:42:10.000000000 +0200
489963
+++ mysql-5.6.37/scripts/mysqld_multi.sh	2017-07-20 16:21:30.656348413 +0200
80384c
@@ -573,9 +573,7 @@ sub list_defaults_files
80384c
 
80384c
   my %seen;  # Don't list the same file more than once
80384c
   return grep { defined $_ and not $seen{$_}++ and -f $_ and -r $_ }
80384c
-              ('/etc/my.cnf',
80384c
-               '/etc/mysql/my.cnf',
80384c
-               '@sysconfdir@/my.cnf',
80384c
+              ('@sysconfdir@/my.cnf',
80384c
                ($ENV{MYSQL_HOME} ? "$ENV{MYSQL_HOME}/my.cnf" : undef),
80384c
                $opt{'extra-file'},
80384c
                ($ENV{HOME} ? "$ENV{HOME}/.my.cnf" : undef));
489963
diff -up mysql-5.6.37/scripts/mysql_install_db.pl.in.p10 mysql-5.6.37/scripts/mysql_install_db.pl.in
489963
--- mysql-5.6.37/scripts/mysql_install_db.pl.in.p10	2017-07-20 16:21:30.650348397 +0200
489963
+++ mysql-5.6.37/scripts/mysql_install_db.pl.in	2017-07-20 16:21:30.656348413 +0200
80384c
@@ -922,7 +922,7 @@ if ( open(PIPE, "| $mysqld_install_cmd_l
80384c
 	      "The new default config file was created as $copy_cfg_file,",
80384c
 	      "please compare it with your file and take the changes you need.");
80384c
     }
80384c
-    foreach my $cfg ( "/etc/my.$cnfext", "/etc/mysql/my.$cnfext" )
80384c
+    foreach my $cfg ( "@SYSCONFDIR@/my.$cnfext", "@SYSCONFDIR@/mysql/my.$cnfext" )
80384c
     {
80384c
       check_sys_cfg_file ($opt, $cfg);
80384c
     }