Bug #32078 Excessive warnings: One can only use the --user switch if running as root
Submitted: 3 Nov 2007 20:01 Modified: 15 Nov 2007 15:16
Reporter: Ingo Strüwing Email Updates:
Status: Closed Impact on me:
None 
Category:Tests Severity:S7 (Test Cases)
Version:5.1.23 OS:Any
Assigned to: Ingo Strüwing CPU Architecture:Any
Tags: pbwarn

[3 Nov 2007 20:01] Ingo Strüwing
Description:
mysql-test-run: WARNING: Got errors/warnings while running tests, please examine "/home/mydev/testdir-5.1-axmrg-2/mysql-test/var/log/warnings" for details.

===========================
warnings
===========================
master.err: main.1st: 071103 20:10:10 [Warning] One can only use the --user switch if running as root
master.err: main.archive: 071103 20:10:15 [Warning] One can only use the --user switch if running as root
master.err: main.archive_bitfield: 071103 20:10:18 [Warning] One can only use the --user switch if running as root
...

Happens also in pushbuild mysql-5.1

How to repeat:
See pushbuild https://intranet.mysql.com/secure/pushbuild/showdir.pl?dir=mysql-5.1
See push Thu Nov 1 11:16:02 2007 jbruehe
Select a couple of (warnings!)
[13 Nov 2007 8:08] Magnus Blåudd
Edit the function 'mysqld_arguments' in mysql-test-run.pl and change the code that adds the --user=root to look like this.

  # When mysqld is run by a root user(euid is 0), it will fail
  # to start unless we specify what user to run as. If not running
  # as root it will be ignored, see BUG#30630
  my $euid= $>;
  if (!$glob_win32 and $euid == 0 and
      grep(/^--user/, @$extra_opt, @opt_extra_mysqld_opt) == 0) {
    mtr_add_arg($args, "%s--user=root");
  }
[13 Nov 2007 9:26] 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/37643

ChangeSet@1.2615, 2007-11-13 10:25:22+01:00, istruewing@stella.local +1 -0
  Bug#32078 - Excessive warnings: One can only use the --user switch
              if running as root
  
  Every start of a server in the test suite raised that warning.
  
  The cause was an unconditionla add of the --user option to the
  server command line. Only the "root" user (effective user id == 0)
  must use that option.
  
  Added check for effective user id == 0 before adding --user.
  
  Thanks to Magnus Svensson for the patch.
[13 Nov 2007 15:14] Ingo Strüwing
Queued to 6.0-engines, 5.1-engines.
[14 Nov 2007 9:41] Bugs System
Pushed into 6.0.4-alpha
[14 Nov 2007 9:45] Bugs System
Pushed into 5.1.23-rc
[15 Nov 2007 15:16] Paul DuBois
Noted in 5.1.23, 6.0.4 changelogs.

mysql-test-run.pl used the --user option when starting mysqld, which
produces warnings if the current user is not root. Now --user is
added only for root.