From ba94666e32acf16b2cc4cacb3ca50d973c4dc1eb Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 May 2007 12:13:49 +0200 Subject: [PATCH] Bug#27396 Wrong check for root priveledge - Check that filemode was set to 0000 mysql-test/mysql-test-run.pl: Checking for "running as root" should also read the filemode to see it was properly set to 0000 --- mysql-test/mysql-test-run.pl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4e122b43143..d6ffc637202 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2119,16 +2119,23 @@ sub check_running_as_root () { close FILE; } - chmod(oct("0755"), $test_file); - unlink($test_file); + # Some filesystems( for example CIFS) allows reading a file + # although mode was set to 0000, but in that case a stat on + # the file will not return 0000 + my $file_mode= (stat($test_file))[2] & 07777; $ENV{'MYSQL_TEST_ROOT'}= "NO"; - if ($result eq "MySQL") + mtr_verbose("result: $result, file_mode: $file_mode"); + if ($result eq "MySQL" && $file_mode == 0) { mtr_warning("running this script as _root_ will cause some " . "tests to be skipped"); $ENV{'MYSQL_TEST_ROOT'}= "YES"; } + + chmod(oct("0755"), $test_file); + unlink($test_file); + }