From: Date: August 23 2005 7:56pm Subject: bk commit into 4.1 tree (jimw:1.2371) BUG#12325 List-Archive: http://lists.mysql.com/internals/28710 X-Bug: 12325 Message-Id: <20050823175651.E305FA84E1@rama.trainedmonkey.com> Below is the list of changes that have just been committed into a local 4.1 repository of jimw. When jimw does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2371 05/08/23 10:56:47 jimw@stripped +1 -0 Fix handling of filenames that start the same as reserved filenames on Windows. (Bug #12325) mysys/my_access.c 1.6 05/08/23 10:56:44 jimw@stripped +13 -3 Fix filename restriction on Windows to not prevent names that start the same as forbidden names, such as nu.frm. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: jimw # Host: rama.(none) # Root: /home/jimw/my/mysql-4.1-12325 --- 1.5/mysys/my_access.c 2005-06-27 06:46:33 -07:00 +++ 1.6/mysys/my_access.c 2005-08-23 10:56:44 -07:00 @@ -59,7 +59,8 @@ /* List of file names that causes problem on windows - NOTE that one can also not have file names of type CON.TXT + NOTE that one can also not have file names of type NUL.TXT but + that NULL.TXT is okay */ static const char *reserved_names[]= @@ -70,6 +71,7 @@ NullS }; +#define MIN_RESERVED_NAME_LENGTH 3 #define MAX_RESERVED_NAME_LENGTH 6 /* @@ -93,14 +95,22 @@ path+= dirname_length(path); /* To start of filename */ if (!(end= strchr(path, FN_EXTCHAR))) end= strend(path); - if (path == end || (uint) (end - path) > MAX_RESERVED_NAME_LENGTH) + if (path == end || (uint) (end - path) > MAX_RESERVED_NAME_LENGTH || + (uint) (end - path) < MIN_RESERVED_NAME_LENGTH) DBUG_RETURN(0); /* Simplify inner loop */ for (reserved_name= reserved_names; *reserved_name; reserved_name++) { const char *reserved= *reserved_name; /* never empty */ const char *name= path; - + + /* + If the name (sans extension) isn't the same length as the reserved + word, there's nothing to worry about. + */ + if ((uint) (end - path) != strlen(reserved)) + break; + do { if (*reserved != my_toupper(&my_charset_latin1, *name))