~ubuntu-branches/ubuntu/quantal/mysql-5.5/quantal-updates

« back to all changes in this revision

Viewing changes to scripts/mysqld_safe.sh

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2013-01-16 10:11:37 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20130116101137-w2lant30o21mzi0b
Tags: 5.5.29-0ubuntu0.12.10.1
* SECURITY UPDATE: Update to 5.5.29 to fix security issues (LP: #1100264)
  - http://www.oracle.com/technetwork/topics/security/cpujan2013-1515902.html
* debian/patches/CVE-2012-5611.patch: removed, included upstream.
* debian/patches/38_scripts__mysqld_safe.sh__signals.patch: refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
syslog_tag_mysqld=mysqld
30
30
syslog_tag_mysqld_safe=mysqld_safe
31
31
 
32
 
umask 007
 
32
# MySQL-specific environment variable. First off, it's not really a umask,
 
33
# it's the desired mode. Second, it follows umask(2), not umask(3) in that
 
34
# octal needs to be explicit. Our shell might be a proper sh without printf,
 
35
# multiple-base arithmetic, and binary arithmetic, so this will get ugly.
 
36
# We reject decimal values to keep things at least half-sane.
 
37
umask 007                               # fallback
 
38
UMASK="${UMASK-0640}"
 
39
fmode=`echo "$UMASK" | sed -e 's/[^0246]//g'`
 
40
octalp=`echo "$fmode"|cut -c1`
 
41
fmlen=`echo "$fmode"|wc -c|sed -e 's/ //g'`
 
42
if [ "x$octalp" != "x0" -o "x$UMASK" != "x$fmode" -o "x$fmlen" != "x5" ]
 
43
then
 
44
  fmode=0640
 
45
  echo "UMASK must be a 3-digit mode with an additional leading 0 to indicate octal." >&2
 
46
  echo "The first digit will be corrected to 6, the others may be 0, 2, 4, or 6." >&2
 
47
fi
 
48
fmode=`echo "$fmode"|cut -c3-4`
 
49
fmode="6$fmode"
 
50
if [ "x$UMASK" != "x0$fmode" ]
 
51
then
 
52
  echo "UMASK corrected from $UMASK to 0$fmode ..."
 
53
fi
33
54
 
34
55
defaults=
35
56
case "$1" in
411
432
  DATADIR=@localstatedir@
412
433
fi
413
434
 
414
 
#
415
 
# Try to find the plugin directory
416
 
#
417
 
 
418
 
# Use user-supplied argument
419
 
if [ -n "${PLUGIN_DIR}" ]; then
420
 
  plugin_dir="${PLUGIN_DIR}"
421
 
else
422
 
  # Try to find plugin dir relative to basedir
423
 
  for dir in lib/mysql/plugin lib/plugin
424
 
  do
425
 
    if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then
426
 
      plugin_dir="${MY_BASEDIR_VERSION}/${dir}"
427
 
      break
428
 
    fi
429
 
  done
430
 
  # Give up and use compiled-in default
431
 
  if [ -z "${plugin_dir}" ]; then
432
 
    plugin_dir='@pkgplugindir@'
433
 
  fi
434
 
fi
435
 
plugin_dir="${plugin_dir}${PLUGIN_VARIANT}"
436
 
 
437
435
if test -z "$MYSQL_HOME"
438
436
then 
439
437
  if test -r "$MY_BASEDIR_VERSION/my.cnf" && test -r "$DATADIR/my.cnf"
494
492
parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld`
495
493
parse_arguments PICK-ARGS-FROM-ARGV "$@"
496
494
 
 
495
 
 
496
#
 
497
# Try to find the plugin directory
 
498
#
 
499
 
 
500
# Use user-supplied argument
 
501
if [ -n "${PLUGIN_DIR}" ]; then
 
502
  plugin_dir="${PLUGIN_DIR}"
 
503
else
 
504
  # Try to find plugin dir relative to basedir
 
505
  for dir in lib/mysql/plugin lib/plugin
 
506
  do
 
507
    if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then
 
508
      plugin_dir="${MY_BASEDIR_VERSION}/${dir}"
 
509
      break
 
510
    fi
 
511
  done
 
512
  # Give up and use compiled-in default
 
513
  if [ -z "${plugin_dir}" ]; then
 
514
    plugin_dir='@pkgplugindir@'
 
515
  fi
 
516
fi
 
517
plugin_dir="${plugin_dir}${PLUGIN_VARIANT}"
 
518
 
 
519
 
497
520
# Determine what logging facility to use
498
521
 
499
522
# Ensure that 'logger' exists, if it's requested
543
566
  # Log to err_log file
544
567
  log_notice "Logging to '$err_log'."
545
568
  logging=file
 
569
 
 
570
  if [ ! -e "$err_log" ]; then                  # if error log already exists,
 
571
    touch "$err_log"                            # we just append. otherwise,
 
572
    chmod "$fmode" "$err_log"                   # fix the permissions here!
 
573
  fi
 
574
 
546
575
else
547
576
  if [ -n "$syslog_tag" ]
548
577
  then
761
790
 
762
791
  eval_log_error "$cmd"
763
792
 
 
793
  if [ $want_syslog -eq 0 -a ! -e "$err_log" ]; then
 
794
    touch "$err_log"                    # hypothetical: log was renamed but not
 
795
    chown $user "$err_log"              # flushed yet. we'd recreate it with
 
796
    chmod "$fmode" "$err_log"           # wrong owner next time we log, so set
 
797
  fi                                    # it up correctly while we can!
 
798
 
764
799
  end_time=`date +%M%S`
765
800
 
766
801
  if test ! -f "$pid_file"              # This is removed if normal shutdown