mysql8.4/community-mysql-paths.patch

190 lines
6.8 KiB
Diff
Raw Normal View History

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