| Bug #23125 | [patch] trigger test fails when run as root | ||
|---|---|---|---|
| Submitted: | 10 Oct 2006 9:17 | Modified: | 30 Jan 2007 3:46 |
| Reporter: | Vasil Dimov | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Tests | Severity: | S3 (Non-critical) |
| Version: | 5.0.27-BK | OS: | |
| Assigned to: | Magnus BlÄudd | CPU Architecture: | Any |
| Tags: | Contribution | ||
[10 Oct 2006 9:18]
Vasil Dimov
"Create directory instead of file" patch
Attachment: mysql_test_trigger.diff (text/x-patch), 1.71 KiB.
[10 Oct 2006 9:57]
Valeriy Kravchuk
Thank you for a (known) prolem report (see http://bugs.mysql.com/bug.php?id=21883 as an example) and patch. Let the developers decide is this a proper way to fix that guaranteed test failure when running tests as root (NOT RECOMMENDED, in general).
[10 Oct 2006 10:49]
Vasil Dimov
If it is written somewhere that `make test' should not be run as root - sorry I missed that. While running the server as root is obviously not recommended `make test` is not exactly the same thing. I guess that before starting the actual tests a check for uid 0 should be done and at least a warning be issued to prevent stupid users (like me) from foot-shooting themselves. Sorry for reporing a known issue.
[21 Dec 2006 23:38]
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/17288 ChangeSet@1.2353, 2006-12-22 00:38:34+01:00, msvensson@pilot.mysql.com +5 -0 Bug #23125 [patch] trigger test fails when run as root - Skip tests using chmod when running as root
[30 Jan 2007 3:46]
Paul DuBois
Test suite change. No changelog entry needed.

Description: When run as root the test `trigger' fails. The reason is that the test expects that writing to a file will fail after `chmod 0' on that file. This is not true for the superuser. --- cut --- Logging: ./mysql-test-run trigger Installing Test Databases Removing Stale Files Installing Master Databases running ../sql/mysqld --no-defaults --bootstrap --skip-grant-tables --basedir=. --datadir=./var/master-data --skip-innodb --skip-ndbcluster --skip-bdb --language=../sql/share/english/ --character-sets-dir=../sql/share/charsets/ Installing Slave Databases running ../sql/mysqld --no-defaults --bootstrap --skip-grant-tables --basedir=. --datadir=./var/slave-data --skip-innodb --skip-ndbcluster --skip-bdb --language=../sql/share/english/ --character-sets-dir=../sql/share/charsets/ Manager disabled, skipping manager start. Loading Standard Test Databases Starting Tests TEST RESULT ------------------------------------------------------- trigger [ fail ] Errors are (from /usr/local/devel/mysql/mysql-5.0/mysql-test/var/log/mysqltest-time) : mysqltest: At line 1144: query 'rename table t1 to t2' succeeded - should have failed with errno 1... (the last lines may be the most important ones) Aborting: trigger failed in default mode. To continue, re-run with '--force'. Ending Tests Shutting-down MySQL daemon Master shutdown finished Slave shutdown finished --- cut --- How to repeat: After building, make sure you are root and: cd mysql-test ./mysql-test-run trigger Suggested fix: Create a directory instead of file: --- mysql_test_trigger.diff begins here --- diff -ur mysql-5.0.orig/mysql-test/r/trigger.result mysql-5.0/mysql-test/r/trigger.result --- mysql-5.0.orig/mysql-test/r/trigger.result Mon Oct 9 15:22:07 2006 +++ mysql-5.0/mysql-test/r/trigger.result Tue Oct 10 11:59:22 2006 @@ -969,7 +969,7 @@ test t1_bi test t1 set @a:=new.id test t1_ai test t1 set @b:=new.id rename table t1 to t2; -ERROR HY000: Can't create/write to file './test/t1_ai.TRN~' (Errcode: 13) +ERROR HY000: Can't create/write to file './test/t1_ai.TRN~' (Errcode: 21) insert into t1 values (102); select @a, @b; @a @b diff -ur mysql-5.0.orig/mysql-test/t/trigger.test mysql-5.0/mysql-test/t/trigger.test --- mysql-5.0.orig/mysql-test/t/trigger.test Mon Oct 9 15:22:07 2006 +++ mysql-5.0/mysql-test/t/trigger.test Tue Oct 10 11:58:55 2006 @@ -1138,8 +1138,7 @@ event_object_table, action_statement from information_schema.triggers where event_object_schema = 'test'; # 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~; +system mkdir $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; --error 1 rename table t1 to t2; # 't1' should be still there and triggers should work correctly @@ -1148,8 +1147,7 @@ select trigger_schema, trigger_name, event_object_schema, event_object_table, action_statement from information_schema.triggers where event_object_schema = 'test'; -system chmod 600 $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; -system rm $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; +system rmdir $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~; # Let us check that updates to .TRN files were rolled back too drop trigger t1_bi; drop trigger t1_ai; --- mysql_test_trigger.diff ends here ---