[MDEV-13978] mysqld_safe may incorrectly detect basedir when started as script Created: 2017-10-01  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.1.28, 10.2.10
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Andrii Nikitin (Inactive) Assignee: Nikita Malyavin
Resolution: Unresolved Votes: 1
Labels: None

Issue Links:
Relates
relates to MDEV-14312 Server fails to start when parameter ... Closed

 Description   

I want to debug mysqld_safe and start it as:

bash -x -v mysqld_safe

This typically results in error like below:

2017-10-01 22:07:53 139934377842944 [Note] //sbin/mysqld (mysqld 10.1.28-MariaDB) starting as process 273 ...
2017-10-01 22:07:53 139934377842944 [ERROR] Can't find messagefile '/share/mysql/errmsg.sys'
2017-10-01 22:07:53 139934377842944 [ERROR] Aborting

Suggested fix which works with bash , needs to be verified on other platforms:

$ diff /usr/bin/mysqld_safe.old /usr/bin/mysqld_safe 
520a521,526
> if [ "$(uname)" == Linux ] && [ -n "$BASH_SOURCE" ] ; then 
>   MY_PWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
> else
>   MY_PWD=`dirname $0`
>   MY_PWD=`cd "$MY_PWD"/.. && pwd`
> fi
522,523d527
< MY_PWD=`dirname $0`
< MY_PWD=`cd "$MY_PWD"/.. && pwd`



 Comments   
Comment by Andrii Nikitin (Inactive) [ 2017-10-01 ]

I know direct workaround is to use full path like below:

bash -x -v `which mysqld_safe`

But the problem may happen as well in various scenarios where mysqld_safe is called from other scripts.

Comment by Andrii Nikitin (Inactive) [ 2017-11-09 ]

MDEV-14312 was another case when it is harder to troubleshoot because of this bug.

Comment by Arnaud Adant [ 2017-11-20 ]

I ran into this problem when upgrading to 10.1.29 rpms. The workaround I found is :

lc_messages_dir=/usr/share/mysql

Generated at Thu Feb 08 08:09:52 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.