Bug #21883 Test "trigger" must fail in a RPM build on SuSE (x86, x86_64)
Submitted: 28 Aug 2006 18:05 Modified: 22 Dec 2007 3:19
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:5.0 OS:Linux (SuSE, x86 + x86_64, RPM)
Assigned to: Magnus BlÄudd CPU Architecture:Any

[28 Aug 2006 18:05] Joerg Bruehe
Description:
Test "trigger" fails (only !) in the RPM builds on hosts "melody" + "sles9-x86" with this symptom:

=====
trigger                        [ fail ]

Errors are (from /PATH/mysqltest-time) :
mysqltest: At line 1056: query 'rename table t1 to t2' succeeded - should have failed with errno 1...
(the last lines may be the most important ones)
Result from queries before failure can be found in r/trigger.log
=====

Looking at "trigger.test", I find (lines 1052 - 1056):
=====
# Trick which makes update of second .TRN file impossible
system echo dummy >$MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~;
system chmod 000 $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~;
--error 1
rename table t1 to t2;
=====

So the (only) reason for this "rename" to fail is that the server does not have the necessary access privileges to the involved files ...
... but exactly the RPM builds for SuSE (except for ia64) run as "root", so the server has all access privileges.

Conclusion:
Any privilege-based way to prevent server (or client) actions will not work as intended in SuSE RPM builds for x86 or x86_64,
unless the RPM build mechanism is changed.

How to repeat:
Do such a RPM build.

Suggested fix:
It might be possible to switch the user within the RPM build process,
but that is not yet analyzed.
[30 Aug 2006 7:55] Joerg Bruehe
I have set bug#21435 to "Not a bug", with a technical explanation.
It is a *bad idea* (tm) to run a server as "root" (assuming it can be avoided).

I will remove the "Solaris" entry from the platform list here:
This test failure will occur on any Unix platform if the server runs as "root".

As regards the documentation:
I have not checked what it says about the user who starts the MySQL server,
but IMO it should contain a recommendation not to use "root" for this,
and it sure may contain words like "the test suite assumes it is all run by a non-root user".

This here is a different aspect:
It is not the failing test, it is the use of a wrong approach in building, for which the test failure is just a symptom.
(Note the category "packaging" - this is no server failure!)

Explicitly:
We may need to be "root" when starting the RPM build the SuSE way, but we should see to fall back onto a "normal" user once the environment has been changed.
[22 Dec 2007 3:19] Kent Boortz
A line "--source include/not_as_root.inc" was added
to the test case.

No documentation is needed.