Bug #17353 mysqld_safe sets core file size only when run as root
Submitted: 13 Feb 2006 20:38 Modified: 3 Jul 2006 19:36
Reporter: Timothy Smith Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0.19 OS:unix
Assigned to: Ian Greenhoe CPU Architecture:Any

[13 Feb 2006 20:38] Timothy Smith
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"

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:

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"
    ulimit -c $core_file_size
[18 Apr 2006 2: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:

[20 Apr 2006 19:47] Chad MILLER
Looks good to me.
[28 Jun 2006 15:58] Ian Greenhoe
In 5.0.23
[3 Jul 2006 19:36] Paul Dubois
Noted in 5.0.23 changelog.

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