]> TLD Linux GIT Repositories - packages/mysql.git/blob - no_relative_paths.patch
- keep common dirs for mysqlrouter in mysql-common, fix /var/{lib,log} dirs
[packages/mysql.git] / no_relative_paths.patch
1 diff -urNpa mysql-8.2.0.orig/sql/mysqld.cc mysql-8.2.0/sql/mysqld.cc
2 --- mysql-8.2.0.orig/sql/mysqld.cc      2023-12-30 12:55:09.027295242 +0100
3 +++ mysql-8.2.0/sql/mysqld.cc   2023-12-30 13:03:21.431172893 +0100
4 @@ -1967,7 +1967,6 @@ static void add_terminator(vector<my_opt
5  extern "C" bool mysqld_get_one_option(int, const struct my_option *, char *);
6  static void set_server_version(void);
7  static int init_thread_environment();
8 -static const char *get_relative_path(const char *path);
9  static int fix_paths(void);
10  static int test_if_case_insensitive(const char *dir_name);
11  static void end_ssl();
12 @@ -7880,7 +7879,7 @@ static char *get_icu_data_directory_in_b
13  // Look for MYSQL_ICU_DATADIR which depends on INSTALL_PRIV_LIBDIR
14  static char *get_icu_data_directory_in_install_dir(char *to) {
15    char buff[FN_REFLEN];
16 -  const char *mysql_icu_datadir = get_relative_path(MYSQL_ICU_DATADIR);
17 +  const char *mysql_icu_datadir = MYSQL_ICU_DATADIR;
18    if (test_if_hard_path(mysql_icu_datadir))
19      strmake(buff, mysql_icu_datadir, sizeof(buff) - 1);
20    else
21 @@ -8987,7 +8986,7 @@ class Plugin_and_data_dir_option_parser
22      memset(dir, 0, FN_REFLEN);
23  
24      convert_dirname(local_plugindir_buffer,
25 -                    plugindir ? plugindir : get_relative_path(PLUGINDIR),
26 +                    plugindir ? plugindir : PLUGINDIR,
27                      NullS);
28      (void)my_load_path(local_plugindir_buffer, local_plugindir_buffer,
29                         mysql_home);
30 @@ -9077,7 +9076,7 @@ int mysqld_main(int argc, char **argv)
31    }
32  
33    /* Set data dir directory paths */
34 -  strmake(mysql_real_data_home, get_relative_path(MYSQL_DATADIR),
35 +  strmake(mysql_real_data_home, MYSQL_DATADIR,
36            sizeof(mysql_real_data_home) - 1);
37  
38    /* Must be initialized early for comparison of options name */
39 @@ -13040,15 +13039,6 @@ static void set_server_version(void) {
40  #endif
41  }
42  
43 -static const char *get_relative_path(const char *path) {
44 -  if (test_if_hard_path(path) && is_prefix(path, DEFAULT_MYSQL_HOME) &&
45 -      strcmp(DEFAULT_MYSQL_HOME, FN_ROOTDIR)) {
46 -    path += strlen(DEFAULT_MYSQL_HOME);
47 -    while (is_directory_separator(*path)) path++;
48 -  }
49 -  return path;
50 -}
51 -
52  /**
53    Test a file path to determine if the path is compatible with the secure file
54    path restriction.
55 @@ -13273,7 +13263,7 @@ static int fix_paths(void) {
56  
57    convert_dirname(
58        opt_plugin_dir,
59 -      opt_plugin_dir_ptr ? opt_plugin_dir_ptr : get_relative_path(PLUGINDIR),
60 +      opt_plugin_dir_ptr ? opt_plugin_dir_ptr : PLUGINDIR,
61        NullS);
62    (void)my_load_path(opt_plugin_dir, opt_plugin_dir, mysql_home);
63    opt_plugin_dir_ptr = opt_plugin_dir;
64 @@ -13284,7 +13274,7 @@ static int fix_paths(void) {
65        FN_LIBCHAR)
66      --mysql_unpacked_real_data_home_len;
67  
68 -  const char *sharedir = get_relative_path(SHAREDIR);
69 +  const char *sharedir = SHAREDIR;
70    if (test_if_hard_path(sharedir))
71      strmake(buff, sharedir, sizeof(buff) - 1); /* purecov: tested */
72    else