mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
Merge polly.local:/home/kaa/src/maint/bug28895/my51-bug28895
into polly.local:/home/kaa/src/maint/mysql-5.1-maint
This commit is contained in:
commit
120dae4c21
5 changed files with 27 additions and 8 deletions
3
mysql-test/r/long_tmpdir.result
Normal file
3
mysql-test/r/long_tmpdir.result
Normal file
|
@ -0,0 +1,3 @@
|
|||
create view v1 as select table_name from information_schema.tables;
|
||||
drop view v1;
|
||||
End of 5.0 tests
|
1
mysql-test/t/long_tmpdir-master.opt
Normal file
1
mysql-test/t/long_tmpdir-master.opt
Normal file
|
@ -0,0 +1 @@
|
|||
--tmpdir=$MYSQLTEST_VARDIR/tmp/long_temporary_directory_path_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
|
3
mysql-test/t/long_tmpdir-master.sh
Normal file
3
mysql-test/t/long_tmpdir-master.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
d="$MYSQLTEST_VARDIR/tmp/long_temporary_directory_path_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789"
|
||||
test -d "$d" || mkdir "$d"
|
||||
rm -f "$d"/*
|
9
mysql-test/t/long_tmpdir.test
Normal file
9
mysql-test/t/long_tmpdir.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
#
|
||||
# Bug #29015: Stack overflow in processing temporary table name when tmpdir path
|
||||
# is long
|
||||
#
|
||||
|
||||
create view v1 as select table_name from information_schema.tables;
|
||||
drop view v1;
|
||||
|
||||
--echo End of 5.0 tests
|
|
@ -9415,7 +9415,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||
bool using_unique_constraint= 0;
|
||||
bool use_packed_rows= 0;
|
||||
bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS);
|
||||
char *tmpname,path[FN_REFLEN];
|
||||
char *tmpname, *tmppath, path[FN_REFLEN], table_name[NAME_LEN+1];
|
||||
uchar *pos, *group_buff, *bitmaps;
|
||||
uchar *null_flags;
|
||||
Field **reg_field, **from_field, **default_field;
|
||||
|
@ -9439,12 +9439,12 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||
temp_pool_slot = bitmap_lock_set_next(&temp_pool);
|
||||
|
||||
if (temp_pool_slot != MY_BIT_NONE) // we got a slot
|
||||
sprintf(path, "%s_%lx_%i", tmp_file_prefix,
|
||||
current_pid, temp_pool_slot);
|
||||
sprintf(table_name, "%s_%lx_%i", tmp_file_prefix,
|
||||
current_pid, temp_pool_slot);
|
||||
else
|
||||
{
|
||||
/* if we run out of slots or we are not using tempool */
|
||||
sprintf(path,"%s%lx_%lx_%x", tmp_file_prefix,current_pid,
|
||||
sprintf(table_name, "%s%lx_%lx_%x", tmp_file_prefix,current_pid,
|
||||
thd->thread_id, thd->tmp_table++);
|
||||
}
|
||||
|
||||
|
@ -9452,7 +9452,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||
No need to change table name to lower case as we are only creating
|
||||
MyISAM or HEAP tables here
|
||||
*/
|
||||
fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME);
|
||||
fn_format(path, table_name, mysql_tmpdir, "",
|
||||
MY_REPLACE_EXT|MY_UNPACK_FILENAME);
|
||||
|
||||
if (group)
|
||||
{
|
||||
|
@ -9498,7 +9499,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||
sizeof(*key_part_info)*(param->group_parts+1),
|
||||
¶m->start_recinfo,
|
||||
sizeof(*param->recinfo)*(field_count*2+4),
|
||||
&tmpname, (uint) strlen(path)+1,
|
||||
&tmppath, (uint) strlen(path)+1,
|
||||
&tmpname, (uint) strlen(table_name)+1,
|
||||
&group_buff, (group && ! using_unique_constraint ?
|
||||
param->group_length : 0),
|
||||
&bitmaps, bitmap_buffer_size(field_count)*2,
|
||||
|
@ -9517,7 +9519,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||
DBUG_RETURN(NULL); /* purecov: inspected */
|
||||
}
|
||||
param->items_to_copy= copy_func;
|
||||
strmov(tmpname,path);
|
||||
strmov(tmppath, path);
|
||||
strmov(tmpname, table_name);
|
||||
/* make table according to fields */
|
||||
|
||||
bzero((char*) table,sizeof(*table));
|
||||
|
@ -9542,7 +9545,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||
table->keys_in_use_for_query.init();
|
||||
|
||||
table->s= share;
|
||||
init_tmp_table_share(share, "", 0, tmpname, tmpname);
|
||||
init_tmp_table_share(share, "", 0, tmpname, tmppath);
|
||||
share->blob_field= blob_field;
|
||||
share->blob_ptr_size= mi_portable_sizeof_char_ptr;
|
||||
share->db_low_byte_first=1; // True for HEAP and MyISAM
|
||||
|
|
Loading…
Add table
Reference in a new issue