Below is the list of changes that have just been committed into a local
5.1 repository of bar. When bar 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.2280 06/04/04 17:07:27 bar@stripped +4 -0
Bug#17870: Table names conflict with Windows device names
mysql-test/t/ctype_filename.test
1.1 06/04/04 17:07:17 bar@stripped +21 -0
New BitKeeper file ``mysql-test/t/ctype_filename.test''
mysql-test/r/ctype_filename.result
1.1 06/04/04 17:07:17 bar@stripped +13 -0
New BitKeeper file ``mysql-test/r/ctype_filename.result''
strings/ctype-utf8.c
1.103 06/04/04 17:07:17 bar@stripped +5 -0
Treat @@@ as end-of-string (i.e. '\0' character).
sql/sql_table.cc
1.324 06/04/04 17:07:17 bar@stripped +64 -3
Pad Windows device names with "@@@".
mysql-test/t/ctype_filename.test
1.0 06/04/04 17:07:17 bar@stripped +0 -0
BitKeeper file /usr/home/bar/mysql-5.1-new.b17870/mysql-test/t/ctype_filename.test
mysql-test/r/ctype_filename.result
1.0 06/04/04 17:07:17 bar@stripped +0 -0
BitKeeper file /usr/home/bar/mysql-5.1-new.b17870/mysql-test/r/ctype_filename.result
# 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: bar
# Host: bar.intranet.mysql.r18.ru
# Root: /usr/home/bar/mysql-5.1-new.b17870
--- 1.323/sql/sql_table.cc 2006-03-31 22:42:00 +05:00
+++ 1.324/sql/sql_table.cc 2006-04-04 17:07:17 +05:00
@@ -70,14 +70,75 @@ uint filename_to_tablename(const char *f
}
+/*
+ 1 - can be the first letter
+ 2 - can be the second letter
+ 4 - can be the third letter
+*/
+static char reserved_map[256]=
+{
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* !"#$%&'()*+,-./ */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0123456789:;<=>? */
+ 0,1,0,1,0,0,0,0,0,0,0,0,7,4,5,2, /* @ABCDEFGHIJKLMNO */
+ 3,0,2,0,4,2,0,0,4,0,0,0,0,0,0,0, /* PQRSTUVWXYZ[\]^_ */
+ 0,1,0,1,0,0,0,0,0,0,0,0,7,4,5,2, /* `abcdefghijklmno */
+ 3,0,2,0,4,2,0,0,4,0,0,0,0,0,0,0, /* pqrstuvwxyz{|}~. */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ................ */
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* ................ */
+};
+
+
+/*
+ Windows device names.
+ Note, we don't check 'CLOCK$' because dollar sign is encoded as @0024,
+ making file name 'CLOCK@0024', which is safe.
+*/
+static const char *reserved_names[]=
+{
+ "CON", "PRN", "AUX", "NUL",
+ "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9",
+ "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9",
+ NullS
+};
+
+
uint tablename_to_filename(const char *from, char *to, uint to_length)
{
- uint errors;
+ uint errors, length;
+ const char **reserved_name;
+
if (from[0] == '#' && !strncmp(from, MYSQL50_TABLE_NAME_PREFIX,
MYSQL50_TABLE_NAME_PREFIX_LENGTH))
return my_snprintf(to, to_length, "%s", from + 9);
- return strconvert(system_charset_info, from,
- &my_charset_filename, to, to_length, &errors);
+ length= strconvert(system_charset_info, from,
+ &my_charset_filename, to, to_length, &errors);
+ if (length >= 3 && length <= 4 &&
+ (reserved_map[(uchar) to[0]] & 1) &&
+ (reserved_map[(uchar) to[1]] & 2) &&
+ (reserved_map[(uchar) to[2]] & 4))
+ {
+ for (reserved_name= reserved_names; *reserved_name; reserved_name++)
+ {
+ if (!my_strcasecmp(&my_charset_latin1, *reserved_name, to))
+ {
+ if (length + 4 < to_length)
+ {
+ memcpy(to + length, "@@@", 4);
+ length+= 3;
+ }
+ break;
+ }
+ }
+ }
+ return length;
}
--- 1.102/strings/ctype-utf8.c 2006-03-23 21:40:47 +04:00
+++ 1.103/strings/ctype-utf8.c 2006-04-04 17:07:17 +05:00
@@ -3943,6 +3943,11 @@ my_mb_wc_filename(CHARSET_INFO *cs __att
*pwc= touni[code];
return 3;
}
+ if (byte1 == '@' && byte2 == '@')
+ {
+ *pwc= 0;
+ return 3;
+ }
}
if (s + 4 > e)
--- New file ---
+++ mysql-test/r/ctype_filename.result 06/04/04 17:07:17
drop table if exists con, aux, nul, lpt1, com1, `clock$`;
create table con (a int);
drop table con;
create table aux (a int);
drop table aux;
create table nul (a int);
drop table nul;
create table lpt1 (a int);
drop table lpt1;
create table com1 (a int);
drop table com1;
create table `clock$` (a int);
drop table `clock$`;
--- New file ---
+++ mysql-test/t/ctype_filename.test 06/04/04 17:07:17
--disable_warnings
drop table if exists con, aux, nul, lpt1, com1, `clock$`;
--enable_warnings
create table con (a int);
drop table con;
create table aux (a int);
drop table aux;
create table nul (a int);
drop table nul;
create table lpt1 (a int);
drop table lpt1;
create table com1 (a int);
drop table com1;
create table `clock$` (a int);
drop table `clock$`;
| Thread |
|---|
| • bk commit into 5.1 tree (bar:1.2280) BUG#17870 | bar | 4 Apr |