Bug #55707 MTR test sys_vars.secure_file_priv fails when run with --mem option
Submitted: 3 Aug 2010 8:28 Modified: 17 Sep 2010 23:51
Reporter: Olav Sandstå Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.6.99 OS:Any (Solaris, Mac OS X)
Assigned to: Anitha Gopi CPU Architecture:Any

[3 Aug 2010 8:28] Olav Sandstå
Description:
When running the test sys_vars.secure_file_priv with MTR and the --mem option it fails with the following error message:

sys_vars.secure_file_priv                [ fail ]
        Test ended at 2010-08-03 09:18:35

CURRENT_TEST: sys_vars.secure_file_priv
mysqltest: At line 19: command "remove_file" failed with error 1

When running the test without using the --mem option it passes.

How to repeat:
1. Use the source from e.g mysql-next-mr-bugfixing tree.

2. Compile:

    cmake . -DWITH_DEBUG=1 -DWITH_INNOBASE_STORAGE_ENGINE=1
    gmake

3. Run test:

    cd mysql-test
    ./mtr --mem secure_file_priv
[3 Aug 2010 8:39] Valeriy Kravchuk
Verified on Mac OS X:

macbook-pro:mysql-test openxs$  ./mtr --mem secure_file_priv
Logging: ./mtr  --mem secure_file_priv
100803 11:36:19 [Warning] Setting lower_case_table_names=2 because file system for /var/folders/dX/dXCzvuSlHX4Op1g-o1jIWk+++TI/-Tmp-/AU2RSNr73g/ is case insensitive
100803 11:36:19 [Note] Plugin 'FEDERATED' is disabled.
100803 11:36:19 [Note] Plugin 'ndbcluster' is disabled.
MySQL Version 5.6.99
Checking supported features...
 - using ndbcluster when necessary, mysqld supports it
 - SSL connections supported
 - binaries are debug compiled
Collecting tests...
vardir: /Users/openxs/dbs/next-mr/mysql-test/var
Checking leftover processes...
Removing old var directory...
Creating var directory '/Users/openxs/dbs/next-mr/mysql-test/var'...
 - symlinking 'var' to '/tmp/var_auto_nzEw'
Installing system database...
Using server port 54625

==============================================================================

TEST                                      RESULT   TIME (ms)
------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
sys_vars.secure_file_priv                [ fail ]
        Test ended at 2010-08-03 11:36:33

CURRENT_TEST: sys_vars.secure_file_priv
mysqltest: At line 19: command "remove_file" failed with error 1

The result from queries just before the failure was:
< snip >
two
three
four
five
loaded_file
NULL

More results from queries before failure can be found in /Users/openxs/dbs/next-mr/mysql-test/var/log/secure_file_priv.log

 - saving '/Users/openxs/dbs/next-mr/mysql-test/var/log/sys_vars.secure_file_priv/' to '/Users/openxs/dbs/next-mr/mysql-test/var/log/sys_vars.secure_file_priv/'
------------------------------------------------------------
The servers were restarted 0 times
Spent 0.000 of 16 seconds executing testcases

Completed: Failed 1/1 tests, 0.00% were successful.

Failing test(s): sys_vars.secure_file_priv

The log files in var/log may give you some hint of what went wrong.

If you want to report this error, please read first the documentation
at http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html

mysql-test-run: *** ERROR: there were failing test cases
[3 Aug 2010 14:43] Tor Didriksen
adding this should fix it:
--source include/not_var_link.inc
[4 Aug 2010 10:46] Anitha Gopi
Tor is right. The problem is when run with --mem option var is a symlink to/dev/shm/var_auto_A2Ak. When var is a symlink  remove_file and the following sql command fail. 

 mysql> SELECT load_file('/home/anitha/mysql/build/mysql-next-mr/mysql-test/var/mysqld.1/data//../../../bug50373.txt') AS loaded_file;
+-------------+
| loaded_file |
+-------------+
| NULL        |
+-------------+
1 row in set (0.00 sec)

The SELECT works if we specify the absolute path instead of the path relative to datadir

mysql> SELECT load_file('/home/anitha/mysql/build/mysql-next-mr/mysql-test/bug50373.txt') AS loaded_file;
+--------------------------+
| loaded_file              |
+--------------------------+
| one
two
three
four
five
 |
+--------------------------+
1 row in set (0.00 sec)

Don't see why the sql stmt or remove_file should be affected if var is a symlink. The file is getting created in mysql-test directory
[4 Aug 2010 10:48] Anitha Gopi
Also once the test is run with --mem option, the following attempts at running without this option also fails. This is because mtr does not remove var folder if it points to a symlink. This is intentional to allow users to direct output to another folder

Kostja,
Assigning back to you to comment on server behavior.
[4 Aug 2010 11:02] Anitha Gopi
The problem is the file gets created in mysql-test folder and the sql stmt and remove_file gets directed to /dev/shm. The test should use another directory where we are normally not allowed to create files
[11 Aug 2010 7:19] 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/115455

3133 Anitha Gopi	2010-08-11
      BUG #55707 MTR test sys_vars.secure_file_priv fails when run with --mem option
      Use $MYSQL_TEST_DIR to point to mysql-test dir. The test was trying to go up three levels from data dir to get to the test dir. This will not work when run with --mem option.
[18 Aug 2010 5:24] Anitha Gopi
secure_file_priv gets set to mysql-test/var/ dir by default. Hence there will be write permission in this directory even if secure_file_priv is not set to ''. We need to use mysql-test folder or we could use /tmp or any folder other than mysql-test/var
[19 Aug 2010 7:17] Horst Hunger
yes. you're right. so, patch is ready to push without changes.
[30 Aug 2010 8:30] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@sun.com-20100830082732-n2eyijnv86exc5ci) (version source revid:alik@sun.com-20100830082732-n2eyijnv86exc5ci) (merge vers: 5.6.1-m4) (pib:21)
[30 Aug 2010 8:34] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100830082745-n6sh01wlwh3itasv) (version source revid:alik@sun.com-20100830082745-n6sh01wlwh3itasv) (pib:21)