Bug #16240 datadir after basedir in my.cnf causes datadir to be possibly incorrect

Submitted: 5 Jan 2006 22:33 Modified: 11 Apr 2006 2:11
Reporter: Lachlan Mulcahy Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.18 OS:Any (any)
Assigned to: Ian Greenhoe CPU Architecture:Any

[5 Jan 2006 22:33] Lachlan Mulcahy
Description:
If you specify datadir after basedir in my.cnf then datadir gets overwritten with $basedir/data due to this code in parse_server_arguments():

--basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'`
bindir="$basedir/bin"
datadir="$basedir/data"
sbindir="$basedir/sbin"
libexecdir="$basedir/libexec"
;;
--datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;

How to repeat:
see above

Suggested fix:
Maybe it should check that if datadir has already been set in the my.cnf don't set it again when setting --basedir.
[6 Apr 2006 0:07] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/4530
[6 Apr 2006 14:16] Magnus BlÄudd
The comment for datadir_set needs to be updated. Shouldn't is say "datadir*" instead of "bindir*"

+# bindir_set is used to determine if bindir was set (and so should be
     ^^^^^^^^                                           ^^^^
+# *not* set inside of the --basedir= handler.)
+datadir_set=
+
[6 Apr 2006 17:14] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/4571
[8 Apr 2006 12:19] Jon Stephens
Need the 3-part version number(s) in which the fix will appear. (Otherwise, we don't know which changelog to document the fix in.) Thanks.
[10 Apr 2006 18:12] Ian Greenhoe
Looks like it will be in 5.0.21
[11 Apr 2006 2:11] Paul DuBois
Noted in 5.0.21, 5.1.9 changelogs.

For <command>mysql.server</command>, if the
<option>basedir</option> option was specified after
<option>datadir</option> in an option file, the setting for
<literal>datadir</literal> was ignored and assumed to be
located under <literal>basedir</literal>. (Bug #16240)

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.059 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.