From 9d68ccdeb8692b05d9cc0479d8d3757edbc49368 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Sun, 7 Nov 2010 14:25:29 +0200 Subject: Added option BACKUP_ALL to mysqld --myisam-recover to also get a backup of the index file before it's repaired. Removed wrong call to translog_buffer_unlock() that caused 'unlocking not locked mutex' failure in Aria log handler. extra/replace.c: Updated call to my_redel() include/maria.h: Updated prototype for maria_change_to_newfile include/my_sys.h: Updated prototypes Added my_create_backup_name include/myisam.h: Updated prototypes include/myisamchk.h: Added 'backup_time' to st_handler_check_param to be able to generate same name for backuped data and index file mysys/my_redel.c: Added time_t option to my_redel() to be able to generate same backup extensions for many files sql/handler.cc: Added start_time to st_ha_check_opt sql/handler.h: Added start_time to HA_CHECK_OPT sql/mysqld.cc: Added option BACKUP_ALL to --myisam-recover storage/maria/ha_maria.cc: Remember start time for repair storage/maria/ma_check.c: Use remembered start time for backup file names Removed some dead code storage/maria/ma_loghandler.c: Removed wrong call to translog_buffer_unlock() that caused 'unlocking not locked mutex' failure in log handler. storage/maria/maria_chk.c: Removed dead code (O_NEW_INDEX was never set) Report if table was 'crashed on repair' storage/maria/maria_pack.c: Updated parameters to my_redel() storage/myisam/ha_myisam.cc: Added recover option BACKUP_ALL to get a backup of the index file before it's repaired. Print information to log if we make a backup of data as part of repair. storage/myisam/ha_myisam.h: Added HA_RECOVER_FULL_BACKUP storage/myisam/mi_check.c: Use remembered start time for backup file names Added mi_make_backup_of_index() storage/myisam/myisamchk.c: Removed dead code (O_NEW_INDEX was never set) Report if table was 'crashed on repair' storage/myisam/myisampack.c: Updated call to my_redel() --- extra/replace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extra') diff --git a/extra/replace.c b/extra/replace.c index 40bddf6d8fb..47993857a43 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -1085,7 +1085,7 @@ static int convert_file(REPLACE *rep, char * name) my_fclose(in,MYF(0)); my_fclose(out,MYF(0)); if (updated && ! error) - my_redel(org_name,tempname,MYF(MY_WME | MY_LINK_WARNING)); + my_redel(org_name, tempname, 0, MYF(MY_WME | MY_LINK_WARNING)); else my_delete(tempname,MYF(MY_WME)); if (!silent && ! error) -- cgit v1.2.1 From 0de9a4ababac1e7f510558dfd0bece894cf7e69c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Nov 2010 13:24:20 +0100 Subject: MWL#74: Shared libmysqld.so library. Switch makefiles to use libtool to build libmysqld.so, as well as all its dependencies. The previous MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS() declaration is removed, as it does not work well with a libtool build. Instead, plugins that need it can specify an alternate object in MYSQL_PLUGIN_STATIC() that will be used for embedded library. The plugin must then take care itself of compiling the special object for embedded, rebuilding the source files previously listed in MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS() with @plugin_embedded_defs@ in CFLAGS/CXXFLAGS. The extra target @XXX_embedded_static_target@ is available for the special object, this will be empty when --without-embedded-server. All in-tree plugins are changed to build their static targets with libtool. Additional plugins that want to work with libmysqld.so will need to be similarly modified to build with libtool (or otherwise provide an -fPIC object). Dynamically loaded plugins are not affected. The old libraries like libmysys.a, libmyisam.a and similar libraries, which were installed by `make install` though this is of little use, are still built and installed to not break package scripts etc. that expect them. These libraries are kept static to avoid introducing new .so dependencies. The patch also fixes a handfull of duplicate symbol linker errors, where we included some object twice during linking; these for one reason or another did not produce errors before but caused problems on some platforms with this patch (eg. Mac OS X linker is more strict for shared objects). This patch only does what is necessary to build libmysqld.so. There are some more cleanups that are possible now that we are using libtool more fully, which could done in subsequent patches (though we may not bother as we are switching from autotools to CMake anyway): - In libmysql_r/, we should be able to just link libmysys.la etc, instead of symlinking and re-compiling sources into the directory. - In libmysql/, we can similarly avoid symlinking and recompiling sources if we instead build a libmysys_nothread.la library with appropriate CFLAGS and link that. - In sql/, we can build a separate target libmysql_int.la with appropriate CFLAGS for embedded and use that in libmysqld/ instead of symlinking sources. - libmysys.a, libmyisam.a and similar libraries could be installed as .so also to save on code size; or alternatively could be not installed at all. client/Makefile.am: Updated for using libtool config/ac-macros/plugins.m4: Replace MUSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS with mechanism for plugins to specify alternate object for embedded. configure.in: Fix linking duplicate objects related to THREAD_LOBJECTS. dbug/Makefile.am: Updated for using libtool extra/Makefile.am: Fix relative paths. libmysqld/Makefile.am: Build libmysqld.la using libtool libmysqld/examples/Makefile.am: Updated to use libtool mysys/Makefile.am: Updated to use libtool. Fix linking duplicate objects related to THREAD_LOBJECTS. mysys/my_uuid.c: Fix conflicting global mutex name by making it static. regex/Makefile.am: Updated to use libtool sql/Makefile.am: Updated to use libtool sql/item_func.cc: Fix conflicting mutex name. sql/mysql_priv.h: Fix conflicting mutex name sql/mysqld.cc: Fix conflicting mutex name. Add missing call of my_uuid_end(). storage/archive/Makefile.am: Updated to use libtool storage/archive/plug.in: Updated to use libtool storage/blackhole/Makefile.am: Updated to use libtool storage/blackhole/plug.in: Updated to use libtool storage/csv/Makefile.am: Updated to use libtool storage/csv/plug.in: Updated to use libtool storage/example/Makefile.am: Updated to use libtool storage/federated/Makefile.am: Updated to use libtool storage/federated/plug.in: Updated to use libtool storage/federatedx/Makefile.am: Updated to use libtool storage/federatedx/plug.in: Updated to use libtool storage/heap/Makefile.am: Updated to use libtool storage/heap/plug.in: Updated to use libtool storage/innobase/Makefile.am: Updated to use libtool storage/innobase/plug.in.disabled: Updated to use libtool storage/innodb_plugin/Makefile.am: Updated to use libtool storage/maria/CMakeLists.txt: Fix linking duplicate object in maria_dump_log, causes failure on Mac OS X storage/maria/Makefile.am: Updated to use libtool Fix linking duplicate object in maria_dump_log, causes link failure on Mac OS X storage/maria/ma_loghandler.c: Move maria_dump_log code to separate file to fix duplicate object link failures. storage/maria/ma_loghandler.h: Move maria_dump_log code to separate file to fix duplicate object link failures. storage/maria/maria_dump_log.c: Move maria_dump_log code to separate file to fix duplicate object link failures. storage/maria/plug.in: Updated to use libtool storage/myisam/Makefile.am: Updated to use libtool storage/myisam/plug.in: Updated to use libtool storage/myisammrg/Makefile.am: Updated to use libtool storage/myisammrg/plug.in: Updated to use libtool storage/pbxt/plug.in: Updated to use libtool storage/pbxt/src/Makefile.am: Updated to use libtool storage/xtradb/Makefile.am: Updated to use libtool storage/xtradb/plug.in: Updated to use libtool strings/Makefile.am: Updated to use libtool unittest/unit.pl: Don't attempt to run libtool internal files as unit tests. vio/Makefile.am: Updated to use libtool --- extra/Makefile.am | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'extra') diff --git a/extra/Makefile.am b/extra/Makefile.am index 8d6d18f0031..9c66cedc013 100644 --- a/extra/Makefile.am +++ b/extra/Makefile.am @@ -15,8 +15,10 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_srcdir)/sql -LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \ - ../dbug/libdbug.a ../strings/libmystrings.a \ +LDADD = @CLIENT_EXTRA_LDFLAGS@ \ + $(top_builddir)/mysys/libmysys.a \ + $(top_builddir)/strings/libmystrings.a \ + $(top_builddir)/dbug/libdbug.a \ $(ZLIB_LIBS) BUILT_SOURCES= $(top_builddir)/include/mysqld_error.h \ $(top_builddir)/include/sql_state.h \ -- cgit v1.2.1 From 9ab4829bc6d37e0ffacc016ce09351e9bde8cf81 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Sat, 27 Nov 2010 00:37:34 +0200 Subject: Fixed compiler warnings and a compilation failure on windows extra/libevent/event.c: Tried to fix compiler warning on windows extra/libevent/evutil.h: Define __attribute__ for not gcc compilers extra/libevent/kqueue.c: Fixed compiler warnings extra/libevent/signal.c: Tried to fix compiler warning on windows storage/pbxt/src/ha_pbxt.cc: Fixed compiler warning about "variable might be clobbered by longjmp" storage/pbxt/src/table_xt.cc: Fixed compiler warnings (on windows) storage/xtradb/handler/i_s.cc: Fixed compiler warning by invoking the correct store function. --- extra/libevent/event.c | 2 +- extra/libevent/evutil.h | 17 +++++++++++++++++ extra/libevent/kqueue.c | 9 +++++---- extra/libevent/signal.c | 2 +- 4 files changed, 24 insertions(+), 6 deletions(-) (limited to 'extra') diff --git a/extra/libevent/event.c b/extra/libevent/event.c index 2042c2de626..07498c709c8 100644 --- a/extra/libevent/event.c +++ b/extra/libevent/event.c @@ -405,7 +405,7 @@ event_loopexit_cb(int fd __attribute__((unused)), int event_loopexit(struct timeval *tv) { - return (event_once(-1, EV_TIMEOUT, event_loopexit_cb, + return (event_once(-1, EV_TIMEOUT, &event_loopexit_cb, current_base, tv)); } diff --git a/extra/libevent/evutil.h b/extra/libevent/evutil.h index 2cfcacb2e0e..46e4079715d 100644 --- a/extra/libevent/evutil.h +++ b/extra/libevent/evutil.h @@ -171,4 +171,21 @@ ev_int64_t evutil_strtoll(const char *s, char **endptr, int base); } #endif +/* Define __attribute__ for platforms that doesn't suppor it */ + +#ifndef __attribute__ +# if !defined(__GNUC__) +# define __attribute__(A) +# else +# ifndef GCC_VERSION +# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) +# endif +# if GCC_VERSION < 2008 +# define __attribute__(A) +# elif defined(__cplusplus) && GCC_VERSION < 3004 +# define __attribute__(A) +# endif +# endif +#endif + #endif /* _EVUTIL_H_ */ diff --git a/extra/libevent/kqueue.c b/extra/libevent/kqueue.c index eec5a6ab6fb..763236e40ac 100644 --- a/extra/libevent/kqueue.c +++ b/extra/libevent/kqueue.c @@ -95,7 +95,7 @@ const struct eventop kqops = { }; static void * -kq_init(struct event_base *base) +kq_init(struct event_base *base __attribute__((unused))) { int kq; struct kqop *kqueueop; @@ -203,13 +203,14 @@ kq_insert(struct kqop *kqop, struct kevent *kev) } static void -kq_sighandler(int sig) +kq_sighandler(int sig __attribute__((unused))) { /* Do nothing here */ } static int -kq_dispatch(struct event_base *base, void *arg, struct timeval *tv) +kq_dispatch(struct event_base *base __attribute__((unused)), void *arg, + struct timeval *tv) { struct kqop *kqop = arg; struct kevent *changes = kqop->changes; @@ -408,7 +409,7 @@ kq_del(void *arg, struct event *ev) } static void -kq_dealloc(struct event_base *base, void *arg) +kq_dealloc(struct event_base *base __attribute__((unused)), void *arg) { struct kqop *kqop = arg; diff --git a/extra/libevent/signal.c b/extra/libevent/signal.c index 2df4b2e4a64..ce164f2f5ea 100644 --- a/extra/libevent/signal.c +++ b/extra/libevent/signal.c @@ -114,7 +114,7 @@ evsignal_init(struct event_base *base) evutil_make_socket_nonblocking(base->sig.ev_signal_pair[0]); event_set(&base->sig.ev_signal, base->sig.ev_signal_pair[1], - EV_READ | EV_PERSIST, evsignal_cb, &base->sig.ev_signal); + EV_READ | EV_PERSIST, &evsignal_cb, &base->sig.ev_signal); base->sig.ev_signal.ev_base = base; base->sig.ev_signal.ev_flags |= EVLIST_INTERNAL; } -- cgit v1.2.1 From e68ff466534c370b96e96ee3c0b04996ae67ecfd Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Mon, 29 Nov 2010 11:27:52 +0200 Subject: Fixed compiler and gmake warnings - Removed SCCS rule from Makefile.am - Made dummy rule in sql_yacc.yy to get rid of compiler warning about not used label. Don't use maintainer mode with valgrind (as we don't want to initialize all variables) config/ac-macros/maintainer.m4: Don't use maintainer mode with valgrind (as we don't want to initialize all variables) Force initialization of variables when using -Werror (To get rid of compiler warnings) configure.in: Don't use maintainer mode with valgrind (as we don't want to initialize all variables) sql/sql_yacc.yy: Made dummy rule in sql_yacc.yy to get rid of compiler warning about not used label. --- extra/yassl/Makefile.am | 3 --- extra/yassl/src/Makefile.am | 4 ---- extra/yassl/taocrypt/Makefile.am | 3 --- extra/yassl/taocrypt/benchmark/Makefile.am | 3 --- extra/yassl/taocrypt/src/Makefile.am | 4 ---- extra/yassl/taocrypt/test/Makefile.am | 3 --- extra/yassl/testsuite/Makefile.am | 4 ---- 7 files changed, 24 deletions(-) (limited to 'extra') diff --git a/extra/yassl/Makefile.am b/extra/yassl/Makefile.am index ddd57d60a99..43cae0514f9 100644 --- a/extra/yassl/Makefile.am +++ b/extra/yassl/Makefile.am @@ -1,5 +1,2 @@ SUBDIRS = taocrypt src testsuite EXTRA_DIST = CMakeLists.txt - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/extra/yassl/src/Makefile.am b/extra/yassl/src/Makefile.am index d192eb03b49..300cdcd096f 100644 --- a/extra/yassl/src/Makefile.am +++ b/extra/yassl/src/Makefile.am @@ -6,7 +6,3 @@ libyassl_la_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \ template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp EXTRA_DIST = $(wildcard ../include/*.hpp) $(wildcard ../include/openssl/*.h) AM_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX @yassl_thread_cxxflags@ - -# Don't update the files from bitkeeper -%::SCCS/s.% - diff --git a/extra/yassl/taocrypt/Makefile.am b/extra/yassl/taocrypt/Makefile.am index 11fea2064f0..deab5227f7f 100644 --- a/extra/yassl/taocrypt/Makefile.am +++ b/extra/yassl/taocrypt/Makefile.am @@ -1,5 +1,2 @@ SUBDIRS = src test benchmark EXTRA_DIST = CMakeLists.txt $(wildcard mySTL/*.hpp) - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/extra/yassl/taocrypt/benchmark/Makefile.am b/extra/yassl/taocrypt/benchmark/Makefile.am index 1f082f22f40..0171c7366bb 100644 --- a/extra/yassl/taocrypt/benchmark/Makefile.am +++ b/extra/yassl/taocrypt/benchmark/Makefile.am @@ -4,6 +4,3 @@ benchmark_SOURCES = benchmark.cpp benchmark_LDADD = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la benchmark_CXXFLAGS = -DYASSL_PURE_C @yassl_thread_cxxflags@ EXTRA_DIST = benchmark.dsp rsa1024.der dh1024.der dsa1024.der make.bat - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/extra/yassl/taocrypt/src/Makefile.am b/extra/yassl/taocrypt/src/Makefile.am index 6ca969ad686..a8d08b6e9d5 100644 --- a/extra/yassl/taocrypt/src/Makefile.am +++ b/extra/yassl/taocrypt/src/Makefile.am @@ -12,7 +12,3 @@ libtaocrypt_la_CXXFLAGS = @yassl_taocrypt_extra_cxxflags@ -DYASSL_PURE_C \ @yassl_thread_cxxflags@ EXTRA_DIST = $(wildcard ../include/*.hpp) - -# Don't update the files from bitkeeper -%::SCCS/s.% - diff --git a/extra/yassl/taocrypt/test/Makefile.am b/extra/yassl/taocrypt/test/Makefile.am index aa325ff9b75..38f04f1387f 100644 --- a/extra/yassl/taocrypt/test/Makefile.am +++ b/extra/yassl/taocrypt/test/Makefile.am @@ -4,6 +4,3 @@ test_SOURCES = test.cpp test_LDADD = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la test_CXXFLAGS = -DYASSL_PURE_C @yassl_thread_cxxflags@ EXTRA_DIST = make.bat - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/extra/yassl/testsuite/Makefile.am b/extra/yassl/testsuite/Makefile.am index e626b1822ec..d74c972a084 100644 --- a/extra/yassl/testsuite/Makefile.am +++ b/extra/yassl/testsuite/Makefile.am @@ -8,7 +8,3 @@ testsuite_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX -DNO_MAIN_DRIVER @yassl_threa testsuite_LDADD = $(top_builddir)/extra/yassl/src/libyassl.la \ $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la EXTRA_DIST = testsuite.dsp test.hpp input quit make.bat - -# Don't update the files from bitkeeper -%::SCCS/s.% - -- cgit v1.2.1 From 0eae06c43007d7e59275af2d437b3c19537bab46 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 6 Dec 2010 12:52:06 +0100 Subject: Bug#473914: mysql_client_test fail with in debug compilaton on windows x64 Reason: inconsistent compilation, federatedx is compiled without SAFEMALLOC flag, while anything else is compiled with SAFEMALLOC. As a consequence, my_hash_init used inside federatedx initialization does not provide correct caller info parameters (file, line) , so they are initialized with whatever is on stack. When info about allocated memory is output in COM_DEBUG command, the server crashes trying to output string starting at 0xcccccccccccccccc. The fix is to remove SAFEMALLOC preprocessor flags from every CMakeLists.txt, except the top-level one. Also, SAFEMALLOC is not defined by default now, instead there is WITH_DEBUG_FULL CMake option which adds -DSAFEMALLOC to C and C++ flags in debug compilation. This option is off by default, because 1) Debug C runtime already has heap debugging builtin with overwrite and leak detection 2)safemalloc considerably slows down the tests. Note also that - SAFEMALLOC is gone in MySQL5.5 - On Windows, heap related overflows can also be found using free pageheap utility (that is also part of application verifier). This is even more efficient if there are no other layers on top of Windows heap allocator, e.g it is most efficient with release version. --- extra/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) (limited to 'extra') diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index ba90492577d..6cc69d3251e 100755 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -14,8 +14,6 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake") -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") -SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) -- cgit v1.2.1 From 69fe020f01a7eefa9f737291f0da2be56f42a6a0 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 26 Jan 2011 15:17:46 +0200 Subject: Fixed bugs found by buildbot: - Use -Wno-uninitialized if -DFORCE_INIT_OF_VARS is not used, to avoid warnings about not initialized variables. - Fixed compiler warnings - Added a name for each thr_lock to get better error messages (This is needed to find out why 'archive.test' sometimes fails) BUILD/SETUP.sh: Use -Wno-uninitialized if -DFORCE_INIT_OF_VARS is not used, to avoid warnings about not initialized variables. BUILD/build_mccge.sh: Use -Wno-uninitialized if -DFORCE_INIT_OF_VARS is not used, to avoid warnings about not initialized variables. client/mysqltest.cc: Fixed bug in remove_files_wildcards (the orignal code never removed anything) extra/libevent/devpoll.c: Fixed compiler warning include/thr_lock.h: Added a name for each thr_lock to get better error messages. mysql-test/suite/maria/t/maria3.test: Speed up test. mysys/thr_lock.c: Added a name for each thr_lock to get better error messages. Added a second 'check_locks' to find if something goes wrong in 'wake_up_waiters'. sql/lock.cc: Added a name for each thr_lock to get better error messages. storage/xtradb/fil/fil0fil.c: Fixed compiler warning --- extra/libevent/devpoll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extra') diff --git a/extra/libevent/devpoll.c b/extra/libevent/devpoll.c index 82427c9e229..3a3ec7e64a8 100644 --- a/extra/libevent/devpoll.c +++ b/extra/libevent/devpoll.c @@ -185,7 +185,7 @@ devpoll_init(struct event_base *base) } static int -devpoll_recalc(struct event_base *base, void *arg, int max) +devpoll_recalc(struct event_base *base __attribute__((unused)), void *arg, int max) { struct devpollop *devpollop = arg; -- cgit v1.2.1 From 4e17ec5a298b118e7f86df8d470abf06d3d5dbad Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 26 Jan 2011 18:16:39 +0100 Subject: fixes for solaris 10 configure.in: * don't use assembler when building with native linker and --with-embedded. Embedded uses PIC and our assembler sources aren't PIC * workaround for OpenSolaris Bug 6611808 extra/libevent/devpoll.c: compiler warning extra/yassl/src/buffer.cpp: include config.h first to make sure that _FILE_OFFSET_BITS is defined before including system headers extra/yassl/taocrypt/benchmark/benchmark.cpp: include config.h first to make sure that _FILE_OFFSET_BITS is defined before including system headers extra/yassl/taocrypt/test/test.cpp: include config.h first to make sure that _FILE_OFFSET_BITS is defined before including system headers include/my_pthread.h: workaround for OpenSolaris Bug 6611808 --- extra/yassl/src/buffer.cpp | 3 +++ extra/yassl/taocrypt/benchmark/benchmark.cpp | 4 ++++ extra/yassl/taocrypt/test/test.cpp | 4 ++++ 3 files changed, 11 insertions(+) (limited to 'extra') diff --git a/extra/yassl/src/buffer.cpp b/extra/yassl/src/buffer.cpp index 66107dbe0a9..5bd69905772 100644 --- a/extra/yassl/src/buffer.cpp +++ b/extra/yassl/src/buffer.cpp @@ -21,6 +21,9 @@ * with SSL types and sockets */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include // memcpy #include "runtime.hpp" diff --git a/extra/yassl/taocrypt/benchmark/benchmark.cpp b/extra/yassl/taocrypt/benchmark/benchmark.cpp index bb725a90187..1d38b080d0d 100644 --- a/extra/yassl/taocrypt/benchmark/benchmark.cpp +++ b/extra/yassl/taocrypt/benchmark/benchmark.cpp @@ -1,6 +1,10 @@ // benchmark.cpp // TaoCrypt benchmark +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include diff --git a/extra/yassl/taocrypt/test/test.cpp b/extra/yassl/taocrypt/test/test.cpp index 0af278404ab..09836a2ef56 100644 --- a/extra/yassl/taocrypt/test/test.cpp +++ b/extra/yassl/taocrypt/test/test.cpp @@ -1,6 +1,10 @@ // test.cpp // test taocrypt functionality +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include -- cgit v1.2.1 From b19e99865ccf3e946ebe59bf09add8e0452904ac Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sat, 29 Jan 2011 18:51:12 +0100 Subject: MWL#55 : cherrypick MySQL 5.5 CMake/build improvements in order to be able to build MSI based installer --- extra/CMakeLists.txt | 18 +++++++----------- extra/libevent/CMakeLists.txt | 12 ++++++++++-- 2 files changed, 17 insertions(+), 13 deletions(-) (limited to 'extra') diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index 6cc69d3251e..f87dc1d0831 100755 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -22,19 +22,19 @@ TARGET_LINK_LIBRARIES(comp_err debug dbug mysys strings zlib wsock32) GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION) -ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_error.h +ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/include/mysqld_error.h COMMAND ${COMP_ERR_EXE} --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets - --out-dir=${PROJECT_SOURCE_DIR}/sql/share/ - --header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h - --name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h - --state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h + --out-dir=${CMAKE_BINARY_DIR}/sql/share/ + --header_file=${CMAKE_BINARY_DIR}/include/mysqld_error.h + --name_file=${CMAKE_BINARY_DIR}/include/mysqld_ername.h + --state_file=${CMAKE_BINARY_DIR}/include/sql_state.h --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt) ADD_CUSTOM_TARGET(GenError ALL - DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h) + DEPENDS ${CMAKE_BINARY_DIR}/include/mysqld_error.h) ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) TARGET_LINK_LIBRARIES(my_print_defaults strings mysys debug dbug taocrypt wsock32) @@ -48,8 +48,4 @@ TARGET_LINK_LIBRARIES(resolveip strings mysys debug dbug wsock32) ADD_EXECUTABLE(replace replace.c) TARGET_LINK_LIBRARIES(replace strings mysys debug dbug wsock32) -IF(EMBED_MANIFESTS) - MYSQL_EMBED_MANIFEST("myTest" "asInvoker") -ENDIF(EMBED_MANIFESTS) - -INSTALL(TARGETS comp_err my_print_defaults perror resolveip replace DESTINATION bin COMPONENT runtime) +MYSQL_INSTALL_TARGETS(comp_err my_print_defaults perror resolveip replace DESTINATION bin COMPONENT Server) diff --git a/extra/libevent/CMakeLists.txt b/extra/libevent/CMakeLists.txt index 83a6cf0f220..6be15641d3e 100644 --- a/extra/libevent/CMakeLists.txt +++ b/extra/libevent/CMakeLists.txt @@ -2,7 +2,9 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/extra/libevent ${CMAKE_SOURCE_DIR}/extra/libevent/compat ${CMAKE_SOURCE_DIR}/extra/libevent/WIN32-Code - ${CMAKE_SOURCE_DIR}/include) + ${CMAKE_BINARY_DIR}/extra/libevent + ${CMAKE_SOURCE_DIR}/include +) IF(MSVC) ADD_DEFINITIONS("-DWIN32 -DHAVE_CONFIG_H") @@ -28,8 +30,14 @@ SET(LIBEVENT_SOURCES min_heap.h strlcpy-internal.h ) +IF(WIN32) + # Workaround source distribution bug, remove preconfigured event-config + IF(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) + FILE(REMOVE ${CMAKE_SOURCE_DIR}/extra/libevent/event-config.h) + ENDIF() + CONFIGURE_FILE(WIN32-Code/config.h ${CMAKE_BINARY_DIR}/extra/libevent/event-config.h COPYONLY) +ENDIF() -CONFIGURE_FILE(WIN32-Code/config.h ${CMAKE_SOURCE_DIR}/extra/libevent/event-config.h COPYONLY) IF(NOT SOURCE_SUBLIBS) ADD_LIBRARY(libevent ${LIBEVENT_SOURCES}) ENDIF(NOT SOURCE_SUBLIBS) -- cgit v1.2.1 From 9fe6801a98f8519cb712e124b536ffb695ad1088 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 25 Feb 2011 20:35:25 +0200 Subject: Fixed compiler warnings cmd-line-utils/readline/complete.c: Don't ignore value from fwrite() cmd-line-utils/readline/terminal.c: Don't ignore value from fwrite() extra/yassl/taocrypt/include/file.hpp: Changed prototype to be able to return value from fwrite() extra/yassl/taocrypt/src/file.cpp: Return value from fwrite for put() storage/xtradb/ut/ut0ut.c: Added casts to remove warnings for not critical usage of fwrite() --- extra/yassl/taocrypt/include/file.hpp | 2 +- extra/yassl/taocrypt/src/file.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'extra') diff --git a/extra/yassl/taocrypt/include/file.hpp b/extra/yassl/taocrypt/include/file.hpp index 0f85b46fdb2..e22040f60f0 100644 --- a/extra/yassl/taocrypt/include/file.hpp +++ b/extra/yassl/taocrypt/include/file.hpp @@ -110,7 +110,7 @@ public: word32 size(bool use_current = false); private: - void put(Source&); + size_t put(Source&); FileSink(const FileSink&); // hide FileSink& operator=(const FileSink&); // hide diff --git a/extra/yassl/taocrypt/src/file.cpp b/extra/yassl/taocrypt/src/file.cpp index 0498038a04b..88ead8e550e 100644 --- a/extra/yassl/taocrypt/src/file.cpp +++ b/extra/yassl/taocrypt/src/file.cpp @@ -98,9 +98,9 @@ FileSink::~FileSink() // fill source from file sink -void FileSink::put(Source& source) +size_t FileSink::put(Source& source) { - fwrite(source.get_buffer(), 1, source.size(), file_); + return fwrite(source.get_buffer(), 1, source.size(), file_); } -- cgit v1.2.1 From 58a0e492b5071f0a12f5eb769d524c157c58c249 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 1 Mar 2011 18:03:38 +0100 Subject: typo (in the yassl error message) fixed --- extra/yassl/src/yassl_error.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extra') diff --git a/extra/yassl/src/yassl_error.cpp b/extra/yassl/src/yassl_error.cpp index cea2ddb553e..4bd38445a6b 100644 --- a/extra/yassl/src/yassl_error.cpp +++ b/extra/yassl/src/yassl_error.cpp @@ -128,7 +128,7 @@ void SetErrorString(unsigned long error, char* buffer) break; case badVersion_error : - strncpy(buffer, "protocl version mismatch", max); + strncpy(buffer, "protocol version mismatch", max); break; case compress_error : -- cgit v1.2.1 From 0fae0335d46c5f1757b59926be60a41eb0224837 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 18 Mar 2011 17:03:43 +0200 Subject: Ensure that all clients reads the appropriate 'client', client-mariadb and 'mariadb' sections from my.cnf The mysqld server and all clients now reads the new client-server section Fixed that mysqldumpslow supports new slow log formats and new mysqld --slow- options client/mysql.cc: Read also client-server and client-mariadb sections. client/mysql_upgrade.c: Read also client-server and client-mariadb sections. client/mysqladmin.cc: Read also client-server and client-mariadb sections. client/mysqlbinlog.cc: Read also client-server and client-mariadb sections. client/mysqlcheck.c: Read also client-server and client-mariadb sections. client/mysqldump.c: Read also client-server and client-mariadb sections. client/mysqlimport.c: Read also client-server and client-mariadb sections. client/mysqlshow.c: Read also client-server and client-mariadb sections. client/mysqltest.cc: Read also client-server and client-mariadb sections. extra/my_print_defaults.c: Updated help text scripts/mysql_fix_privilege_tables.sh: Read also sections client client-server client-mariadb scripts/mysql_install_db.pl.in: Also allow --data=* option Read also groups mariadb, server and client-server. scripts/mysql_install_db.sh: Also allow --data=* option Read also groups mariadb, server and client-server. Added --lose-skip-pbxt to bootstrap scripts/mysql_secure_installation.sh: Read also groups client-server and client-mariadb scripts/mysqld_multi.sh: Read also group mariadb scripts/mysqld_safe.sh: Read also groups mariadb server and client-server scripts/mysqldumpslow.sh: Fixed to support new slow log formats Added sorting on -ae (aggregated number of retreived rows) and e (retrieved rows) Read also group 'mariadb' If there is many instances of same option, use last one. Get slow log file from options log-slow-queries=filename or query-log-file=filename Added support for future --log-basename option sql-common/client.c: Read also groups 'client-server' and 'client-mariadb' tests/mysql_client_test.c: Read also groups 'client-server' and 'client-mariadb' tests/thread_test.c: Read also groups 'client-server' and 'client-mariadb' --- extra/my_print_defaults.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extra') diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 847738951dd..3f0f2e00ed5 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -104,7 +104,7 @@ static void usage(my_bool version) my_print_help(my_long_options); my_print_default_files(config_file); my_print_variables(my_long_options); - printf("\nExample usage:\n%s --defaults-file=example.cnf client mysql\n", my_progname); + printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname); } #include -- cgit v1.2.1 From 22a8654a6f8ec5a977c51f95b5c5e1489854912b Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 28 Mar 2011 01:05:34 +0200 Subject: CMake fixes for buildbot/MSI package building and signing: - FIND_PROGRAM (signtool) will now get a hint about location of signtool.exe (Windows SDK) - Targets "package" or "msi" will now fail, l if signing is requested but does not work (e.g invalid certificate) - During install, do not re-sign binaries, if they are already signed. - Preserve mysqld_error.h timestamp whenever possible. This helps avoiding situations where the whole server is rebuilt, whenever comp_err.exe changes (for example after code signing, or also after a minor fix in mysys) - Fix Wix error in UpgradeVersion, if patch part of the version is 0. --- extra/CMakeLists.txt | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'extra') diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index f87dc1d0831..15194556a6b 100755 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -22,19 +22,25 @@ TARGET_LINK_LIBRARIES(comp_err debug dbug mysys strings zlib wsock32) GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION) -ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/include/mysqld_error.h - COMMAND ${COMP_ERR_EXE} - --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets - --out-dir=${CMAKE_BINARY_DIR}/sql/share/ - --header_file=${CMAKE_BINARY_DIR}/include/mysqld_error.h - --name_file=${CMAKE_BINARY_DIR}/include/mysqld_ername.h - --state_file=${CMAKE_BINARY_DIR}/include/sql_state.h - --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt - DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt) +# Generate mysqld_error.h +# Try not to change its timestamp if not necessary(as touching +# mysqld_error.h results in rebuild of the almost whole server) +# To preserve timestamp, first generate a temp header file, then copy it +# to mysqld_error.h using cmake -E copy_if_different +ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp + COMMAND ${COMP_ERR_EXE} + --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets + --out-dir=${CMAKE_BINARY_DIR}/sql/share/ + --header_file=${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp + --name_file=${CMAKE_BINARY_DIR}/include/mysqld_ername.h + --state_file=${CMAKE_BINARY_DIR}/include/sql_state.h + --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp ${CMAKE_BINARY_DIR}/include/mysqld_error.h + DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt) ADD_CUSTOM_TARGET(GenError ALL - DEPENDS ${CMAKE_BINARY_DIR}/include/mysqld_error.h) + DEPENDS ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp) ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) TARGET_LINK_LIBRARIES(my_print_defaults strings mysys debug dbug taocrypt wsock32) -- cgit v1.2.1 From 19f0d6b2d9930f83688943b8f98a8b7397584df9 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sun, 15 May 2011 13:38:18 +0200 Subject: Small CMake fixes : - add version info for the client library, dynamic plugins and some utilities - do not recompile client library sources 3 times (for mysqlclient , mysqlclient_notls and libmysql) One time is sufficient, so get rid of mysqlclient_notls, and link static client library to the shared. - remove incremental linking flag --- extra/CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'extra') diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index 15194556a6b..adb357cf790 100755 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -32,26 +32,26 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets --out-dir=${CMAKE_BINARY_DIR}/sql/share/ --header_file=${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp - --name_file=${CMAKE_BINARY_DIR}/include/mysqld_ername.h - --state_file=${CMAKE_BINARY_DIR}/include/sql_state.h + --name_file=${CMAKE_BINARY_DIR}/include/mysqld_ername.h.tmp + --state_file=${CMAKE_BINARY_DIR}/include/sql_state.h.tmp --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp ${CMAKE_BINARY_DIR}/include/mysqld_error.h + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/mysqld_ername.h.tmp ${CMAKE_BINARY_DIR}/include/mysqld_ername.h + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/sql_state.h.tmp ${CMAKE_BINARY_DIR}/include/sql_state.h DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt) ADD_CUSTOM_TARGET(GenError ALL DEPENDS ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp) -ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) +MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) TARGET_LINK_LIBRARIES(my_print_defaults strings mysys debug dbug taocrypt wsock32) -ADD_EXECUTABLE(perror perror.c) +MYSQL_ADD_EXECUTABLE(perror perror.c) TARGET_LINK_LIBRARIES(perror strings mysys debug dbug wsock32) -ADD_EXECUTABLE(resolveip resolveip.c) +MYSQL_ADD_EXECUTABLE(resolveip resolveip.c) TARGET_LINK_LIBRARIES(resolveip strings mysys debug dbug wsock32) -ADD_EXECUTABLE(replace replace.c) +MYSQL_ADD_EXECUTABLE(replace replace.c COMPONENT Server) TARGET_LINK_LIBRARIES(replace strings mysys debug dbug wsock32) - -MYSQL_INSTALL_TARGETS(comp_err my_print_defaults perror resolveip replace DESTINATION bin COMPONENT Server) -- cgit v1.2.1 From f610296d98917908d49dc70d5075ea02ff68243d Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Sat, 21 May 2011 00:46:18 +0300 Subject: Changed MariaDB error numbers to start from 1900 to not conflict with MySQL error numbers extra/comp_err.c: Allow one to have multiple start-error-numbers in the same error.txt file. Generate 'empty' error strings for the missing error numbers in the errmsg.sys file mysql-test/r/bigint.result: Update results to use new error numbers mysql-test/r/dyncol.result: Update results to use new error numbers mysql-test/r/func_math.result: Update results to use new error numbers mysql-test/r/func_str.result: Update results to use new error numbers mysql-test/r/plugin.result: Update results to use new error numbers mysql-test/r/table_options.result: Update results to use new error numbers mysql-test/r/type_newdecimal.result: Update results to use new error numbers mysql-test/r/warnings.result: Update results to use new error numbers mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result: Update results to use new error numbers mysql-test/suite/vcol/r/vcol_ins_upd_myisam.result: Update results to use new error numbers mysql-test/suite/vcol/r/vcol_misc.result: Update results to use new error numbers sql/derror.cc: Ensure we don't read a errmsg.sys with a missing required error message; This change was needed as errmsg.sys may now contain empty error messages between the MySQL and MariaDB error messages. If error message file didn't exist and we have not read one in the past, don't continue. Give better error message if the errmsg.sys header has changed. sql/share/errmsg.txt: Create new section, starting from 1900, for MariaDB error messages --- extra/comp_err.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 73 insertions(+), 11 deletions(-) (limited to 'extra') diff --git a/extra/comp_err.c b/extra/comp_err.c index adce6a6f5bd..11c36bb7f85 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -34,6 +34,7 @@ #define HEADER_LENGTH 32 /* Length of header in errmsg.sys */ #define DEFAULT_CHARSET_DIR "../sql/share/charsets" #define ER_PREFIX "ER_" +#define ER_PREFIX2 "MARIA_ER_" #define WARN_PREFIX "WARN_" static char *OUTFILE= (char*) "errmsg.sys"; static char *HEADERFILE= (char*) "mysqld_error.h"; @@ -57,7 +58,7 @@ const char *empty_string= ""; /* For empty states */ */ const char *default_language= "eng"; -int er_offset= 1000; +uint er_offset= 1000; my_bool info_flag= 0; /* Storage of one error message row (for one language) */ @@ -85,7 +86,7 @@ struct languages struct errors { const char *er_name; /* Name of the error (ER_HASHCK) */ - int d_code; /* Error code number */ + uint d_code; /* Error code number */ const char *sql_code1; /* sql state */ const char *sql_code2; /* ODBC state */ struct errors *next_error; /* Pointer to next error */ @@ -127,6 +128,7 @@ static struct my_option my_long_options[]= }; +static struct errors *generate_empty_message(uint dcode); static struct languages *parse_charset_string(char *str); static struct errors *parse_error_string(char *ptr, int er_count); static struct message *parse_message_string(struct message *new_message, @@ -203,6 +205,7 @@ static int create_header_files(struct errors *error_head) uint er_last; FILE *er_definef, *sql_statef, *er_namef; struct errors *tmp_error; + uint current_d_code; DBUG_ENTER("create_header_files"); LINT_INIT(er_last); @@ -228,13 +231,22 @@ static int create_header_files(struct errors *error_head) fprintf(er_definef, "#define ER_ERROR_FIRST %d\n", error_head->d_code); + current_d_code= error_head->d_code -1; for (tmp_error= error_head; tmp_error; tmp_error= tmp_error->next_error) { /* generating mysqld_error.h fprintf() will automatically add \r on windows */ - fprintf(er_definef, "#define %s %d\n", tmp_error->er_name, + + if (!tmp_error->er_name) + continue; /* Placeholder for gap */ + + if (tmp_error->d_code > current_d_code + 1) + fprintf(er_definef, "\n/* New section */\n\n"); + current_d_code= tmp_error->d_code; + + fprintf(er_definef, "#define %s %u\n", tmp_error->er_name, tmp_error->d_code); er_last= tmp_error->d_code; @@ -403,7 +415,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error, char *str, buff[1000]; struct errors *current_error= 0, **tail_error= top_error; struct message current_message; - int rcount= 0; + uint rcount= 0; + my_bool er_offset_found= 0; DBUG_ENTER("parse_input_file"); *top_error= 0; @@ -424,11 +437,32 @@ static int parse_input_file(const char *file_name, struct errors **top_error, } if (is_prefix(str, "start-error-number")) { - if (!(er_offset= parse_error_offset(str))) + uint tmp_er_offset; + if (!(tmp_er_offset= parse_error_offset(str))) { fprintf(stderr, "Failed to parse the error offset string!\n"); DBUG_RETURN(0); } + if (!er_offset_found) + { + er_offset_found= 1; + er_offset= tmp_er_offset; + } + else + { + /* Create empty error messages between er_offset and tmp_err_offset */ + if (tmp_er_offset < er_offset + rcount) + { + fprintf(stderr, "new start-error-number %u is smaller than current error message: %u\n", tmp_er_offset, er_offset + rcount); + DBUG_RETURN(0); + } + for ( ; er_offset + rcount < tmp_er_offset ; rcount++) + { + current_error= generate_empty_message(er_offset + rcount); + *tail_error= current_error; + tail_error= ¤t_error->next_error; + } + } continue; } if (is_prefix(str, "default-language")) @@ -475,7 +509,8 @@ static int parse_input_file(const char *file_name, struct errors **top_error, DBUG_RETURN(0); continue; } - if (is_prefix(str, ER_PREFIX) || is_prefix(str, WARN_PREFIX)) + if (is_prefix(str, ER_PREFIX) || is_prefix(str, WARN_PREFIX) || + is_prefix(str, ER_PREFIX2)) { if (!(current_error= parse_error_string(str, rcount))) { @@ -490,12 +525,12 @@ static int parse_input_file(const char *file_name, struct errors **top_error, continue; } if (*str == '#' || *str == '\n') - continue; /* skip comment or empty lines */ + continue; /* skip comment or empty lines */ fprintf(stderr, "Wrong input file format. Stop!\nLine: %s\n", str); DBUG_RETURN(0); } - *tail_error= 0; /* Mark end of list */ + *tail_error= 0; /* Mark end of list */ my_fclose(file, MYF(0)); DBUG_RETURN(rcount); @@ -604,7 +639,6 @@ static struct message *find_message(struct errors *err, const char *lang, DBUG_RETURN(tmp); if (!strcmp(tmp->lang_short_name, default_language)) { - DBUG_ASSERT(tmp->text[0] != 0); return_val= tmp; } } @@ -824,6 +858,32 @@ static struct message *parse_message_string(struct message *new_message, } +static struct errors *generate_empty_message(uint d_code) +{ + struct errors *new_error; + struct message message; + + /* create a new element */ + if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error), + MYF(MY_WME)))) + return(0); + if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 1)) + return(0); /* OOM: Fatal error */ + + new_error->d_code= d_code; + new_error->sql_code1= empty_string; + new_error->sql_code2= empty_string; + + if (!(message.lang_short_name= my_strdup(default_language, MYF(MY_WME))) || + !(message.text= my_strdup("", MYF(MY_WME)))) + return(0); + + /* Can't fail as msg is preallocated */ + (void) insert_dynamic(&new_error->msg, (uchar*) &message); + return(new_error); +} + + /* Parsing the string with error name and codes; returns the pointer to the errors struct @@ -836,7 +896,9 @@ static struct errors *parse_error_string(char *str, int er_count) DBUG_PRINT("enter", ("str: %s", str)); /* create a new element */ - new_error= (struct errors *) my_malloc(sizeof(*new_error), MYF(MY_WME)); + if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error), + MYF(MY_WME)))) + DBUG_RETURN(0); if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 0)) DBUG_RETURN(0); /* OOM: Fatal error */ @@ -966,7 +1028,7 @@ static struct languages *parse_charset_string(char *str) static void print_version(void) { DBUG_ENTER("print_version"); - printf("%s (Compile errormessage) Ver %s\n", my_progname, "2.0"); + printf("%s (Compile errormessage) Ver %s\n", my_progname, "3.0"); DBUG_VOID_RETURN; } -- cgit v1.2.1 From 4749f34bf0c4456ad4bfe8c0f15d0b266052ba6f Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sat, 21 May 2011 22:23:14 +0200 Subject: Fix comp_errr crash ( fprintf crashes wheb uninitialized string is passed) --- extra/comp_err.c | 1 + 1 file changed, 1 insertion(+) (limited to 'extra') diff --git a/extra/comp_err.c b/extra/comp_err.c index 11c36bb7f85..24ec8974d03 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -870,6 +870,7 @@ static struct errors *generate_empty_message(uint d_code) if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 1)) return(0); /* OOM: Fatal error */ + new_error->er_name= NULL; new_error->d_code= d_code; new_error->sql_code1= empty_string; new_error->sql_code2= empty_string; -- cgit v1.2.1