Bug #17353 mysqld_safe sets core file size only when run as root
Submitted: 13 Feb 2006 21:38 Modified: 3 Jul 2006 21:36
Reporter: Tim Smith
Status: Closed
Category:Client Severity:S3 (Non-critical)
Version:5.0.19 OS:unix
Assigned to: Bugs System Target Version:

[13 Feb 2006 21:38] Tim Smith
Description:
On many operating systems, a process won't dump core after setuid() has been called.  So
it is necessary to run mysqld with --user=root, or to log in as user 'mysql', in order to
get a core dump during a crash.  For obvious reasons, logging in as 'mysq'l is the
preferred method.

In this case, it's nice to have the --core-file-size option for mysqld_safe work.  But it
is wrapped inside this conditional:

if test -w / -o "$USER" = "root"
then
...

This is similar to the open files limit, but not identical.  It's common to have ulimit -c
= 0, but to have no hard limit.  So nonprivileged users can change the core file size.

It's less common for the normal user to be able to increase the open files limit, so
perhaps it makes sense to ignore that option unless mysqld_safe is run as root.

How to repeat:

[mysqld_safe]
core-file-size = unlimited

Try running mysqld_safe as a non-privileged user, and it won't run the ulimit -c command.

Suggested fix:

Move the following code outside of that if conditional:

  if test -n "$core_file_size"
  then
    ulimit -c $core_file_size
  fi
[18 Apr 2006 4:58] 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/5041
[20 Apr 2006 21:47] Chad MILLER
Looks good to me.
[28 Jun 2006 17:58] Ian Greenhoe
In 5.0.23
[3 Jul 2006 21:36] Paul DuBois
Noted in 5.0.23 changelog.

The --core-file-size option for mysqld_safe was effective only
for root.