Skip to content

Commit 6a588aa

Browse files
trostenbjornmu
authored andcommitted
Merge branch 'mysql-5.5' into mysql-5.6
(cherry picked from commit b91d851f82ba70bf775422d42c0e853f9116cbb1)
1 parent d65dae2 commit 6a588aa

File tree

4 files changed

+50
-35
lines changed

4 files changed

+50
-35
lines changed

packaging/rpm-oel/mysql.init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ start(){
102102
# alarms, per bug #547485
103103
$exec --datadir="$datadir" --socket="$socketfile" \
104104
--pid-file="$mypidfile" \
105-
--basedir=/usr --user=mysql >/dev/null 2>&1 &
105+
--basedir=/usr --user=mysql >/dev/null &
106106
safe_pid=$!
107107
# Spin for a maximum of N seconds waiting for the server to come up;
108108
# exit the loop immediately if mysqld_safe process disappears.

packaging/rpm-sles/mysql.init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ start () {
153153
rc_failed 6 ; rc_status -v ; rc_exit
154154
fi
155155

156-
$PROG --basedir=/usr --datadir="$datadir" --pid-file="$pidfile" >/dev/null 2>&1 &
156+
$PROG --basedir=/usr --datadir="$datadir" --pid-file="$pidfile" >/dev/null &
157157
if pinger $! ; then
158158
echo -n "Starting service MySQL:"
159159
touch $lockfile

scripts/mysqld_safe.sh

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,17 @@ parse_arguments() {
209209
--core-file-size=*) core_file_size="$val" ;;
210210
--ledir=*) ledir="$val" ;;
211211
--malloc-lib=*) set_malloc_lib "$val" ;;
212-
--mysqld=*) MYSQLD="$val" ;;
212+
--mysqld=*)
213+
if [ -z "$pick_args" ]; then
214+
log_error "--mysqld option can only be used as command line option, found in config file"
215+
exit 1
216+
fi
217+
MYSQLD="$val" ;;
213218
--mysqld-version=*)
219+
if [ -z "$pick_args" ]; then
220+
log_error "--mysqld-version option can only be used as command line option, found in config file"
221+
exit 1
222+
fi
214223
if test -n "$val"
215224
then
216225
MYSQLD="mysqld-$val"
@@ -298,38 +307,22 @@ mysqld_ld_preload_text() {
298307
echo "$text"
299308
}
300309

301-
302-
mysql_config=
303-
get_mysql_config() {
304-
if [ -z "$mysql_config" ]; then
305-
mysql_config=`echo "$0" | sed 's,/[^/][^/]*$,/mysql_config,'`
306-
if [ ! -x "$mysql_config" ]; then
307-
log_error "Can not run mysql_config $@ from '$mysql_config'"
308-
exit 1
309-
fi
310-
fi
311-
312-
"$mysql_config" "$@"
313-
}
314-
315-
316310
# set_malloc_lib LIB
317311
# - If LIB is empty, do nothing and return
318-
# - If LIB is 'tcmalloc', look for tcmalloc shared library in /usr/lib
319-
# then pkglibdir. tcmalloc is part of the Google perftools project.
312+
# - If LIB is 'tcmalloc', look for tcmalloc shared library in $malloc_dirs.
313+
# tcmalloc is part of the Google perftools project.
320314
# - If LIB is an absolute path, assume it is a malloc shared library
321315
#
322316
# Put LIB in mysqld_ld_preload, which will be added to LD_PRELOAD when
323317
# running mysqld. See ld.so for details.
324318
set_malloc_lib() {
319+
# This list is kept intentionally simple.
320+
malloc_dirs="/usr/lib /usr/lib64 /usr/lib/i386-linux-gnu /usr/lib/x86_64-linux-gnu"
325321
malloc_lib="$1"
326322

327323
if [ "$malloc_lib" = tcmalloc ]; then
328-
pkglibdir=`get_mysql_config --variable=pkglibdir`
329324
malloc_lib=
330-
# This list is kept intentionally simple. Simply set --malloc-lib
331-
# to a full path if another location is desired.
332-
for libdir in /usr/lib "$pkglibdir" "$pkglibdir/mysql"; do
325+
for libdir in $(echo $malloc_dirs); do
333326
for flavor in _minimal '' _and_profiler _debug; do
334327
tmp="$libdir/libtcmalloc$flavor.so"
335328
#log_notice "DEBUG: Checking for malloc lib '$tmp'"
@@ -340,7 +333,7 @@ set_malloc_lib() {
340333
done
341334

342335
if [ -z "$malloc_lib" ]; then
343-
log_error "no shared library for --malloc-lib=tcmalloc found in /usr/lib or $pkglibdir"
336+
log_error "no shared library for --malloc-lib=tcmalloc found in $malloc_dirs"
344337
exit 1
345338
fi
346339
fi
@@ -351,9 +344,21 @@ set_malloc_lib() {
351344
case "$malloc_lib" in
352345
/*)
353346
if [ ! -r "$malloc_lib" ]; then
354-
log_error "--malloc-lib '$malloc_lib' can not be read and will not be used"
347+
log_error "--malloc-lib can not be read and will not be used"
355348
exit 1
356349
fi
350+
351+
# Restrict to a the list in $malloc_dirs above
352+
case "$(dirname "$malloc_lib")" in
353+
/usr/lib) ;;
354+
/usr/lib64) ;;
355+
/usr/lib/i386-linux-gnu) ;;
356+
/usr/lib/x86_64-linux-gnu) ;;
357+
*)
358+
log_error "--malloc-lib must be located in one of the directories: $malloc_dirs"
359+
exit 1
360+
;;
361+
esac
357362
;;
358363
*)
359364
log_error "--malloc-lib must be an absolute path or 'tcmalloc'; " \
@@ -569,7 +574,7 @@ then
569574
log_notice "Logging to '$err_log'."
570575
logging=file
571576

572-
if [ ! -f "$err_log" ]; then # if error log already exists,
577+
if [ ! -f "$err_log" -a ! -h "$err_log" ]; then # if error log already exists,
573578
touch "$err_log" # we just append. otherwise,
574579
chmod "$fmode" "$err_log" # fix the permissions here!
575580
fi
@@ -594,7 +599,7 @@ then
594599
USER_OPTION="--user=$user"
595600
fi
596601
# Change the err log to the right user, if it is in use
597-
if [ $want_syslog -eq 0 ]; then
602+
if [ $want_syslog -eq 0 -a ! -h "$err_log" ]; then
598603
touch "$err_log"
599604
chown $user "$err_log"
600605
fi
@@ -614,9 +619,11 @@ safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}}
614619
mysql_unix_port_dir=`dirname $safe_mysql_unix_port`
615620
if [ ! -d $mysql_unix_port_dir ]
616621
then
617-
mkdir $mysql_unix_port_dir
618-
chown $user $mysql_unix_port_dir
619-
chmod 755 $mysql_unix_port_dir
622+
if [ ! -h $mysql_unix_port_dir ]; then
623+
mkdir $mysql_unix_port_dir
624+
chown $user $mysql_unix_port_dir
625+
chmod 755 $mysql_unix_port_dir
626+
fi
620627
fi
621628

622629
# If the user doesn't specify a binary, we assume name "mysqld"
@@ -728,7 +735,9 @@ then
728735
exit 1
729736
fi
730737
fi
731-
rm -f "$pid_file"
738+
if [ ! -h "$pid_file" ]; then
739+
rm -f "$pid_file"
740+
fi
732741
if test -f "$pid_file"
733742
then
734743
log_error "Fatal error: Can't remove the pid file:
@@ -779,13 +788,19 @@ have_sleep=1
779788

780789
while true
781790
do
782-
rm -f $safe_mysql_unix_port "$pid_file" # Some extra safety
791+
# Some extra safety
792+
if [ ! -h "$safe_mysql_unix_port" ]; then
793+
rm -f "$safe_mysql_unix_port"
794+
fi
795+
if [ ! -h "$pid_file" ]; then
796+
rm -f "$pid_file"
797+
fi
783798

784799
start_time=`date +%M%S`
785800

786801
eval_log_error "$cmd"
787802

788-
if [ $want_syslog -eq 0 -a ! -f "$err_log" ]; then
803+
if [ $want_syslog -eq 0 -a ! -f "$err_log" -a ! -h "$err_log" ]; then
789804
touch "$err_log" # hypothetical: log was renamed but not
790805
chown $user "$err_log" # flushed yet. we'd recreate it with
791806
chmod "$fmode" "$err_log" # wrong owner next time we log, so set

support-files/mysql.server.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ case "$mode" in
280280
then
281281
# Give extra arguments to mysqld with the my.cnf file. This script
282282
# may be overwritten at next upgrade.
283-
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
283+
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null &
284284
wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
285285

286286
# Make lock for RedHat / SuSE

0 commit comments

Comments
 (0)