From 1da5382a9fa37ffd9ebdf30b74b0a515af879a64 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 19 May 2005 16:02:14 -0500 Subject: [PATCH 1/5] BUG# 10687 - MERGE engine fails under Windows This patch was submitted by Ingo and it appears to work correctly. sql/ha_myisammrg.cc: use FN_LIBCHAR instead of / so buff works correctly on Windows strings/my_vsnprintf.c: add support for %c to my_vsnprintf --- sql/ha_myisammrg.cc | 5 +++-- strings/my_vsnprintf.c | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 7a5d4fcf0a1..1bf2f8a31ad 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -406,8 +406,8 @@ int ha_myisammrg::create(const char *name, register TABLE *form, This means that it might not be possible to move the DATADIR of an embedded server without changing the paths in the .MRG file. */ - uint length= my_snprintf(buff, FN_REFLEN, "%s/%s/%s", mysql_data_home, - tables->db, tables->real_name); + uint length= my_snprintf(buff, FN_REFLEN, "%s%c%s/%s", mysql_data_home, + FN_LIBCHAR, tables->db, tables->real_name); /* If a MyISAM table is in the same directory as the MERGE table, we use the table name without a path. This means that the @@ -422,6 +422,7 @@ int ha_myisammrg::create(const char *name, register TABLE *form, } else table_name=(*tbl)->path; + DBUG_PRINT("info",("MyISAM table_name: '%s'", table_name)); *pos++= table_name; } *pos=0; diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 268f7d18f2a..d92b291321b 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -28,7 +28,8 @@ %#[l]u %#[l]x %#.#s Note first # is ignored - + %c + RETURN length of result string */ @@ -120,6 +121,11 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) to+= res_length; continue; } + else if (*fmt == 'c') + { + *(to++)= (char) va_arg(ap, int); + continue; + } /* We come here on '%%', unknown code or too long parameter */ if (to == end) break; From 6b964f0f102efb51c761091a4ee8f715604fb78a Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 May 2005 11:53:16 -0500 Subject: [PATCH 2/5] BUG# 10687: MERGE Engine fails on Windows This is a replacement for the original patch given by Ingo. This one comes from Monty. The problem is that merge files now use unix style pathnames on all platforms. The merge file open code was not properly converting those pathnames back to non-unix when necessary. myisammrg/myrg_open.c: use fn_format to convert pathnames if the files in the merge file have a pathname mysys/my_getwd.c: add a test for '/' in the code that determines if a string inlucdes a pathname --- myisammrg/myrg_open.c | 4 +++- mysys/my_getwd.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/myisammrg/myrg_open.c b/myisammrg/myrg_open.c index 0dc2f4f9768..f9cdc2bb205 100644 --- a/myisammrg/myrg_open.c +++ b/myisammrg/myrg_open.c @@ -67,7 +67,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) while ((length=my_b_gets(&file,buff,FN_REFLEN-1))) { if ((end=buff+length)[-1] == '\n') - end[-1]='\0'; + *--end='\0'; if (!buff[0]) continue; /* Skip empty lines */ if (buff[0] == '#') @@ -86,6 +86,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) sizeof(name_buff)-1-dir_length)); VOID(cleanup_dirname(buff,name_buff)); } + else + fn_format(buff, buff, "", "", 0); if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0)))) goto err; if (!m_info) /* First file */ diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index 89f949eca27..14d68168acd 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -208,7 +208,7 @@ int test_if_hard_path(register const char *dir_name) my_bool has_path(const char *name) { - return test(strchr(name, FN_LIBCHAR)) + return test(strchr(name, FN_LIBCHAR)) || test(strchr(name,'/')) #ifdef FN_DEVCHAR || test(strchr(name, FN_DEVCHAR)) #endif From 3ca4caef3fa58fd48c1f14777e08f617e434a049 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 May 2005 18:53:53 +0200 Subject: [PATCH 3/5] Build fixes for icc, compile _without_ "-no-gnu" include/my_global.h: icc does not define __ICC when emulating gcc. Use __INTEL_COMPILER to check for icc. ndb/src/cw/cpcd/Process.cpp: Remove rlimit64 ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp: Remove dirent64 --- include/my_global.h | 2 +- ndb/src/cw/cpcd/Process.cpp | 5 +---- ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp | 4 ---- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index 62c6a5d1e4a..f059d603976 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -44,7 +44,7 @@ #endif /* __CYGWIN__ */ /* Determine when to use "#pragma interface" */ -#if !defined(__CYGWIN__) && !defined(__ICC) && defined(__GNUC__) && (__GNUC__ < 3) +#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3) #define USE_PRAGMA_INTERFACE #endif diff --git a/ndb/src/cw/cpcd/Process.cpp b/ndb/src/cw/cpcd/Process.cpp index cfffec7d0ce..431c96e3320 100644 --- a/ndb/src/cw/cpcd/Process.cpp +++ b/ndb/src/cw/cpcd/Process.cpp @@ -223,11 +223,8 @@ set_ulimit(const BaseString & pair){ if(!(list[1].trim() == "unlimited")){ value = atoi(list[1].c_str()); } -#if defined(__INTEL_COMPILER) - struct rlimit64 rlp; -#else + struct rlimit rlp; -#endif #define _RLIMIT_FIX(x) { res = getrlimit(x,&rlp); if(!res){ rlp.rlim_cur = value; res = setrlimit(x, &rlp); }} if(list[0].trim() == "c"){ diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index b3fc6e04d6c..f76440a462a 100644 --- a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -799,11 +799,7 @@ AsyncFile::rmrfReq(Request * request, char * path, bool removePath){ request->error = errno; return; } -#if defined(__INTEL_COMPILER) - struct dirent64 * dp; -#else struct dirent * dp; -#endif while ((dp = readdir(dirp)) != NULL){ if ((strcmp(".", dp->d_name) != 0) && (strcmp("..", dp->d_name) != 0)) { BaseString::snprintf(path_add, (size_t)path_max_copy, "%s%s", From 36b3f0a0529ab92fdedcbdefa7d1686b61f90429 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 May 2005 12:05:15 -0500 Subject: [PATCH 4/5] BUG# 10687: Merge engine fails under Windows This cset is to roll out the cset applied earlier from Ingo. This bug has been fixed with a different cset. sql/ha_myisammrg.cc: removed the patch applied earlier strings/my_vsnprintf.c: removed the patch applied earlier. The patch was to add %c ability. Monty has already done this. --- sql/ha_myisammrg.cc | 4 ++-- strings/my_vsnprintf.c | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 1bf2f8a31ad..9270361980f 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -406,8 +406,8 @@ int ha_myisammrg::create(const char *name, register TABLE *form, This means that it might not be possible to move the DATADIR of an embedded server without changing the paths in the .MRG file. */ - uint length= my_snprintf(buff, FN_REFLEN, "%s%c%s/%s", mysql_data_home, - FN_LIBCHAR, tables->db, tables->real_name); + uint length= my_snprintf(buff, FN_REFLEN, "%s%s/%s", mysql_data_home, + tables->db, tables->real_name); /* If a MyISAM table is in the same directory as the MERGE table, we use the table name without a path. This means that the diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index d92b291321b..d0e529288f7 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -28,7 +28,6 @@ %#[l]u %#[l]x %#.#s Note first # is ignored - %c RETURN length of result string @@ -121,11 +120,6 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) to+= res_length; continue; } - else if (*fmt == 'c') - { - *(to++)= (char) va_arg(ap, int); - continue; - } /* We come here on '%%', unknown code or too long parameter */ if (to == end) break; From 67c5514b908a6adfb0cd91dfe6dc9d0b0e21e1c1 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 May 2005 12:31:22 -0500 Subject: [PATCH 5/5] BUG#10687 - Merge engine fails under Windows This final cset is to fix a syntax problem in ha_myisammrg.cc where a / was left out of a format string. It also adds a check in has_path to avoid a possible redundant comparison. ha_myisammrg.cc: Replaced missing / in format string my_getwd.c: Added test to see if FN_LIBCHAR != '/' before doing comparison to avoid redundant comparison mysys/my_getwd.c: Added test to see if FN_LIBCHAR != '/' before doing comparison to avoid redundant comparison sql/ha_myisammrg.cc: Replaced missing / in format string --- mysys/my_getwd.c | 5 ++++- sql/ha_myisammrg.cc | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index 14d68168acd..5663ceaa60e 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -208,7 +208,10 @@ int test_if_hard_path(register const char *dir_name) my_bool has_path(const char *name) { - return test(strchr(name, FN_LIBCHAR)) || test(strchr(name,'/')) + return test(strchr(name, FN_LIBCHAR)) +#if FN_LIBCHAR != '/' + || test(strchr(name,'/')) +#endif #ifdef FN_DEVCHAR || test(strchr(name, FN_DEVCHAR)) #endif diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index 9270361980f..0b160d72aab 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -406,7 +406,7 @@ int ha_myisammrg::create(const char *name, register TABLE *form, This means that it might not be possible to move the DATADIR of an embedded server without changing the paths in the .MRG file. */ - uint length= my_snprintf(buff, FN_REFLEN, "%s%s/%s", mysql_data_home, + uint length= my_snprintf(buff, FN_REFLEN, "%s/%s/%s", mysql_data_home, tables->db, tables->real_name); /* If a MyISAM table is in the same directory as the MERGE table,