[MDEV-6655] [PATCH] mysqld_multi default log location in wrong directory Created: 2014-08-28  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.13
Fix Version/s: 10.4, 10.5, 10.6, 10.11

Type: Bug Priority: Minor
Reporter: Hartmut Holzgraefe Assignee: Andrew Hutchings
Resolution: Unresolved Votes: 0
Labels: patch, upstream
Environment:

Linux (but should not be OS specific)



 Description   

From my original bug report http://bugs.mysql.com/73750

Description:
If no datadir is set via option files or command line the log location defaults to:

  [...]
  if (!defined($logdir))
  {
    $logdir= "/usr/share/mysql" if (-d "/usr/share/mysql" && -w "/usr/share/mysql");
  }
  [...]

(or whatever the "share" path is for the current installation) in the init_log() function inside the script

This is a very unexpected location, and AFAICT in violation with the linux file system standard (and Unix practice in general) as /usr should be considered read-only for everything but software installation actions (so that a read-only /usr file system can be shared between multiple installations)

How to repeat:
Check source of installed mysqld_multi script or just use mysqld_multi with --no-defaults or the exampe my.cnf given in the script itself, then see that you have a "mysqld_multi.log" file in the same directory that the error message translations, charset information, and files like mysql_system_tables.sql are in
(usually /usr/share/mysql or /usr/local/mysql/share ...) ... at least if the user executing mysqld_multi had sufficient permissions to write there ...

Suggested fix:
The default log location should be the default datadir, not pkgdatadir ...



 Comments   
Comment by Hartmut Holzgraefe [ 2014-08-28 ]

Suggested fix:

=== modified file 'scripts/mysqld_multi.sh'
--- scripts/mysqld_multi.sh	2014-08-03 15:13:56 +0000
+++ scripts/mysqld_multi.sh	2014-08-28 08:59:17 +0000
@@ -246,7 +246,7 @@
   }
   if (!defined($logdir))
   {
 -    $logdir= "@datadir@" if (-d "@datadir@" && -w "@datadir@");
 +    $logdir= "@localstatedir@" if (-d "@localstatedir@" && -w "@localstatedir@");
   }
   if (!defined($logdir))
   {

Comment by Andrew Hutchings [ 2022-08-31 ]

Added a couple of comments on the PR, once these are solved we can look at merging it.

Generated at Thu Feb 08 07:13:36 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.