Bug #59085 parts.partition_special_myisam fails
Submitted: 21 Dec 2010 10:07 Modified: 30 Mar 2011 16:45
Reporter: Alexander Nozdrin Email Updates:
Status: Closed Impact on me:
None 
Category:Tests: Server Severity:S7 (Test Cases)
Version:5.5, 5.6, mysql-trunk OS:Any
Assigned to: Kristofer Pettersson CPU Architecture:Any
Tags: pb2, test failure

[21 Dec 2010 10:07] Alexander Nozdrin
Description:
parts.partition_special_myisam [ fail ]
        Test ended at 2010-12-17 19:25:26

CURRENT_TEST: parts.partition_special_myisam
mysqltest: At line 81: query 'reap' failed: 1085: The file '/export/home3/pb2/build/sb_2-None-1292599296.94/mysql-trunk-security-gcov/mysql-test/var/mysqld.1/data/test/load.in' must be in the database directory or be readable by all

How to repeat:
Check out security branches.
[4 Jan 2011 11:01] Kristofer Pettersson
A broken if-statement was mended and this caused previously unused
restrictions to kick in:

    // if we are not in slave thread, the file must be:
    if (!thd->slave_thread &&
	      !((stat_info.st_mode & S_IROTH) == S_IROTH &&  // readable by
others
	        (stat_info.st_mode & S_IFLNK) != S_IFLNK && // and not a
symlink
	        ((stat_info.st_mode & S_IFREG) == S_IFREG ||
	         (stat_info.st_mode & S_IFIFO) == S_IFIFO)))
    {
	    my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), name);
	    DBUG_RETURN(TRUE);
    }

The question is now, do we accept these new restrictions or do we
remove them?
[4 Jan 2011 11:14] Kristofer Pettersson
For this particular test case the flags are:
S_IROTH: true, S_IFLNK: true, S_IFREG: true, S_FIFO: false
[4 Jan 2011 11:50] Kristofer Pettersson
Correction: The flags are:
S_IROTH= false, S_IFLNK= false, S_IFREG= true, S_FIFO= false

The issue is that the file isn't readable by others. We can't change it to require the opposite which would make more sense since most test cases will break.

Removing this restriction seems to be the most sensible thing to do.
[4 Jan 2011 13:01] Kristofer Pettersson
Suggested patch committed against the security branch where the regression occurred:

=== modified file 'sql/sql_load.cc'
--- sql/sql_load.cc	2010-12-17 13:28:40 +0000
+++ sql/sql_load.cc	2011-01-04 12:06:48 +0000
@@ -402,10 +402,9 @@
 
     // if we are not in slave thread, the file must be:
     if (!thd->slave_thread &&
-	      !((stat_info.st_mode & S_IROTH) == S_IROTH &&  // readable by others
-	        (stat_info.st_mode & S_IFLNK) != S_IFLNK && // and not a symlink
-	        ((stat_info.st_mode & S_IFREG) == S_IFREG ||
-	         (stat_info.st_mode & S_IFIFO) == S_IFIFO)))
+        !((stat_info.st_mode & S_IFLNK) != S_IFLNK &&  // and not a symlink
+          ((stat_info.st_mode & S_IFREG) == S_IFREG || // a regular file
+           (stat_info.st_mode & S_IFIFO) == S_IFIFO))) // or a named pipe
     {
 	    my_error(ER_TEXTFILE_NOT_READABLE, MYF(0), name);
 	    DBUG_RETURN(TRUE);
[10 Feb 2011 4:15] Anitha Gopi
Seen on trunk after 5.5 was merged to trunk, revision 3617

http://pb2.norway.sun.com/?template=mysql_show_test_failure&search=yes&push_id=2009314&tes...
[10 Feb 2011 10:54] Bugs System
Pushed into mysql-trunk 5.6.2 (revid:mattias.jonsson@oracle.com-20110210105239-7d185yns47br33yn) (version source revid:mattias.jonsson@oracle.com-20110210105239-7d185yns47br33yn) (merge vers: 5.6.2) (pib:24)
[10 Feb 2011 10:55] Bugs System
Pushed into mysql-5.5 5.5.10 (revid:mattias.jonsson@oracle.com-20110210105053-dpvxd2g978xag4sh) (version source revid:mattias.jonsson@oracle.com-20110210105053-dpvxd2g978xag4sh) (merge vers: 5.5.10) (pib:24)
[30 Mar 2011 16:45] Paul DuBois
Noted in 5.5.10, 5.6.2 changelogs.

There was an erroneous restriction on file attributes for LOAD DATA INFILE.