From 5c04a99e2afda8c6fddb2572cd6f9e975aa52238 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 28 Sep 2007 22:35:48 +0200 Subject: [PATCH 01/12] ctype-simple.c: Avoid undefined value when negating (bug#30069) strings/ctype-simple.c: Avoid undefined value when negating (bug#30069) --- strings/ctype-simple.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index ccdfb5936b7..0355803daa8 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -802,7 +802,7 @@ int my_long10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), { if (val < 0) { - val= -val; + val= -(unsigned long int)val; *dst++= '-'; len--; sign= 1; @@ -838,7 +838,7 @@ int my_longlong10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), { if (val < 0) { - val = -val; + val = -(ulonglong)val; *dst++= '-'; len--; sign= 1; From 6224001c4f8f74d740ff17dbf9b214605d3a0f03 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 31 Oct 2007 17:40:29 +0100 Subject: [PATCH 02/12] Fix for Bug#29290 type_datetime.test failure in 5.1 mysql-test/t/type_datetime.test: - If we are too close to midnight sleep till we reach at least midnight + 1 second. - Replace error numbers with error names. --- mysql-test/t/type_datetime.test | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index 20733a14d46..1b893fd376e 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -155,13 +155,13 @@ set @@sql_mode='ansi,traditional'; insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38'); insert into t1 set dt='2007-03-23 13:49:38',da=dt; # Test error handling ---error 1292 +--error ER_TRUNCATED_WRONG_VALUE insert into t1 values ('2007-03-32','2007-03-23 13:49:38'); select * from t1; drop table t1; ---error 1067 +--error ER_INVALID_DEFAULT create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '1962-03-03'); ---error 1067 +--error ER_INVALID_DEFAULT create table t1 (t time default '916:00:00 a'); set @@sql_mode= @org_mode; @@ -169,6 +169,19 @@ set @@sql_mode= @org_mode; # # Bug#27590: Wrong DATE/DATETIME comparison. # +## The following sub test will fail (difference to expected result) if the +## select curdate() < now(), f1 < now(), cast(f1 as date) < now() from t1; +## runs exact at midnight ('00:00:00'). +## ( Bug#29290 type_datetime.test failure in 5.1 ) +## Therefore we sleep a bit if we are too close to midnight. +## The complete test itself needs around 1 second. +## Therefore a time_distance to midnight of 5 seconds should be sufficient. +if (`SELECT CURTIME() > SEC_TO_TIME(24 * 3600 - 5)`) +{ + # We are here when CURTIME() is between '23:59:56' and '23:59:59'. + # So a sleep time of 5 seconds brings us between '00:00:01' and '00:00:04'. + --real_sleep 5 +} create table t1 (f1 date, f2 datetime, f3 timestamp); insert into t1(f1) values(curdate()); select curdate() < now(), f1 < now(), cast(f1 as date) < now() from t1; From 5ee36c1d971d2f151c615ab2c14f704c7f8cca09 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 2 Nov 2007 12:29:13 +0100 Subject: [PATCH 03/12] mysql.info, INSTALL-BINARY, INSTALL-SOURCE, ReadMe.txt, Docs/Makefile.am: Let place holders for real documentation have text that makes sense to the user (Bug#25205) BitKeeper/deleted/.del-generate-text-files.pl: Delete: Docs/Support/generate-text-files.pl Docs/INSTALL-BINARY: BitKeeper file /home/kent/bk/bug25205/mysql-4.0/Docs/INSTALL-BINARY INSTALL-SOURCE: BitKeeper file /home/kent/bk/bug25205/mysql-4.0/INSTALL-SOURCE support-files/MacOSX/ReadMe.txt: BitKeeper file /home/kent/bk/bug25205/mysql-4.0/support-files/MacOSX/ReadMe.txt Docs/mysql.info: More of a end-user text Docs/Makefile.am: Don't generate text files from the documentation --- Docs/INSTALL-BINARY | 8 ++++++ Docs/Makefile.am | 29 ++----------------- Docs/Support/generate-text-files.pl | 43 ----------------------------- Docs/mysql.info | 29 ++----------------- INSTALL-SOURCE | 8 ++++++ support-files/MacOSX/ReadMe.txt | 8 ++++++ 6 files changed, 30 insertions(+), 95 deletions(-) create mode 100644 Docs/INSTALL-BINARY delete mode 100755 Docs/Support/generate-text-files.pl create mode 100644 INSTALL-SOURCE create mode 100644 support-files/MacOSX/ReadMe.txt diff --git a/Docs/INSTALL-BINARY b/Docs/INSTALL-BINARY new file mode 100644 index 00000000000..54d10028dc3 --- /dev/null +++ b/Docs/INSTALL-BINARY @@ -0,0 +1,8 @@ + +You can find information about how to install binary distributions at + + http://dev.mysql.com/doc/refman/4.1/en/quick-standard-installation.html + +The MySQL Reference Manual is also available in various formats on +http://dev.mysql.com/doc; if you're interested in the DocBook XML +sources go to http://svn.mysql.com. diff --git a/Docs/Makefile.am b/Docs/Makefile.am index 6a1ee131d1a..31bc14af4ab 100644 --- a/Docs/Makefile.am +++ b/Docs/Makefile.am @@ -14,38 +14,15 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -noinst_SCRIPTS = Support/generate-text-files.pl - -EXTRA_DIST = $(noinst_SCRIPTS) mysql.info INSTALL-BINARY - -all: txt_files - -txt_files: ../INSTALL-SOURCE \ - INSTALL-BINARY ../support-files/MacOSX/ReadMe.txt +EXTRA_DIST = mysql.info INSTALL-BINARY # make sure that "make install" installs the info page, too # automake only seems to take care of this automatically, # if we're building the info page from texi directly. -install-data-hook: mysql.info +install-data-hook: $(EXTRA_DIST) $(mkinstalldirs) $(DESTDIR)$(infodir) $(INSTALL_DATA) $(srcdir)/mysql.info $(DESTDIR)$(infodir) - -CLEAN_FILES: $(txt_files) - touch $(txt_files) - -GT = $(srcdir)/Support/generate-text-files.pl - -../INSTALL-SOURCE: mysql.info $(GT) - perl -w $(GT) mysql.info "installing-source" "windows-source-build" > $@ - -# We put the description for the binary installation here so that -# people who download source wont have to see it. It is moved up to -# the toplevel by the script that makes the binary tar files. -INSTALL-BINARY: mysql.info $(GT) - perl -w $(GT) mysql.info "installing-binary" "installing-source" > $@ - -../support-files/MacOSX/ReadMe.txt: mysql.info $(GT) - perl -w $(GT) mysql.info "mac-os-x-installation" "netware-installation" > $@ + $(INSTALL_DATA) $(srcdir)/INSTALL-BINARY $(DESTDIR)$(infodir) # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/Docs/Support/generate-text-files.pl b/Docs/Support/generate-text-files.pl deleted file mode 100755 index 0829525f679..00000000000 --- a/Docs/Support/generate-text-files.pl +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/perl -w -*- perl -*- -# Generate text files from top directory from the manual. - -$from = shift(@ARGV); -$fnode = shift(@ARGV); -$tnode = shift(@ARGV); - -open(IN, "$from") || die "Cannot open $from: $!"; - -$in = 0; - -while () -{ - if ($in) - { - if (/Node: $tnode,/ || /\[index/) - { - $in = 0; - } - elsif (/^File: mysql.info/ || (/^/)) - { - # Just Skip node beginnings - } - else - { - print; - } - } - else - { - if (/Node: $fnode,/) - { - $in = 1; - # Skip first empty line - ; - } - } -} - -close(IN); - -die "Could not find node \"$tnode\"" if ($in == 1); -exit 0; diff --git a/Docs/mysql.info b/Docs/mysql.info index 5846d7aadf6..b2c411e51ab 100644 --- a/Docs/mysql.info +++ b/Docs/mysql.info @@ -1,27 +1,4 @@ -This is mysql.info, produced by makeinfo version 4.8 from manual.texi. -START-INFO-DIR-ENTRY -* mysql: (mysql). MySQL documentation. -END-INFO-DIR-ENTRY - - -File: mysql.info, Node: Top, Next: (dir), Prev: (dir), Up: (dir) - -This is an empty placeholder file for the MySQL manual. - -The MySQL manual is now maintained in a separate BitKeeper source tree! -Please see `http://www.mysql.com/doc/en/Installing_source_tree.html' -for more info on how to work with BitKeeper. - -This file will be replaced with the current `mysql.info' when building -the official source distribution. - -You can find a specific manual for any older version of MySQL in the -binary or source distribution for that version. - - - -Tag Table: -Node: Top166 - -End Tag Table +The MySQL Reference Manual is available in various formats on +http://dev.mysql.com/doc; if you're interested in the DocBook XML +sources go to http://svn.mysql.com. diff --git a/INSTALL-SOURCE b/INSTALL-SOURCE new file mode 100644 index 00000000000..5c54869f1bf --- /dev/null +++ b/INSTALL-SOURCE @@ -0,0 +1,8 @@ + +You can find information about how to install from a source distributions at + + http://dev.mysql.com/doc/refman/4.1/en/installing-source.html + +The MySQL Reference Manual is also available in various formats on +http://dev.mysql.com/doc; if you're interested in the DocBook XML +sources go to http://svn.mysql.com. diff --git a/support-files/MacOSX/ReadMe.txt b/support-files/MacOSX/ReadMe.txt new file mode 100644 index 00000000000..8e721448c8d --- /dev/null +++ b/support-files/MacOSX/ReadMe.txt @@ -0,0 +1,8 @@ + +You can find information about how to install on Mac OS X at + + http://dev.mysql.com/doc/refman/4.1/en/mac-os-x-installation.html + +The MySQL Reference Manual is also available in various formats on +http://dev.mysql.com/doc; if you're interested in the DocBook XML +sources go to http://svn.mysql.com. From 8f0409413450531f295671c01386293d3919e9ac Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 2 Nov 2007 12:36:44 +0100 Subject: [PATCH 04/12] INSTALL-WIN-SOURCE: BitKeeper file /home/kent/bk/bug25205/mysql-4.1-build/INSTALL-WIN-SOURCE INSTALL-WIN-SOURCE: BitKeeper file /home/kent/bk/bug25205/mysql-4.1-build/INSTALL-WIN-SOURCE --- INSTALL-WIN-SOURCE | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 INSTALL-WIN-SOURCE diff --git a/INSTALL-WIN-SOURCE b/INSTALL-WIN-SOURCE new file mode 100644 index 00000000000..60eb2ff0cfc --- /dev/null +++ b/INSTALL-WIN-SOURCE @@ -0,0 +1,9 @@ + +You can find information about how to install from a Windows source +distributions at + + http://dev.mysql.com/doc/refman/4.1/en/windows-source-build.html + +The MySQL Reference Manual is also available in various formats on +http://dev.mysql.com/doc; if you're interested in the DocBook XML +sources go to http://svn.mysql.com. From c8a757dbded0e4e6e41782b87b5d56456be07a44 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 2 Nov 2007 12:59:45 +0100 Subject: [PATCH 05/12] Makefile.am: Added manual.chm to EXTRA_DIST Removed install of INSTALL-BINARY, handled by install scripts. ReadMe.txt, INSTALL-WIN-SOURCE, INSTALL-BINARY, INSTALL-SOURCE: Updated links to version 5.0 of the manual Docs/INSTALL-BINARY: Updated links to version 5.0 of the manual INSTALL-SOURCE: Updated links to version 5.0 of the manual INSTALL-WIN-SOURCE: Updated links to version 5.0 of the manual support-files/MacOSX/ReadMe.txt: Updated links to version 5.0 of the manual Docs/Makefile.am: Added manual.chm to EXTRA_DIST Removed install of INSTALL-BINARY, handled by install scripts. --- Docs/INSTALL-BINARY | 2 +- Docs/Makefile.am | 6 ++---- INSTALL-SOURCE | 2 +- INSTALL-WIN-SOURCE | 2 +- support-files/MacOSX/ReadMe.txt | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Docs/INSTALL-BINARY b/Docs/INSTALL-BINARY index 54d10028dc3..ba7e72af94d 100644 --- a/Docs/INSTALL-BINARY +++ b/Docs/INSTALL-BINARY @@ -1,7 +1,7 @@ You can find information about how to install binary distributions at - http://dev.mysql.com/doc/refman/4.1/en/quick-standard-installation.html + http://dev.mysql.com/doc/refman/5.0/en/quick-standard-installation.html The MySQL Reference Manual is also available in various formats on http://dev.mysql.com/doc; if you're interested in the DocBook XML diff --git a/Docs/Makefile.am b/Docs/Makefile.am index 95a04862406..d161836aaca 100644 --- a/Docs/Makefile.am +++ b/Docs/Makefile.am @@ -13,19 +13,17 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -EXTRA_DIST = mysql.info INSTALL-BINARY +EXTRA_DIST = manual.chm mysql.info INSTALL-BINARY # make sure that "make install" installs the info page, too # automake only seems to take care of this automatically, # if we're building the info page from texi directly. -install-data-hook: $(srcdir)/mysql.info $(srcdir)/INSTALL-BINARY +install-data-hook: $(srcdir)/mysql.info $(mkinstalldirs) $(DESTDIR)$(infodir) $(INSTALL_DATA) $(srcdir)/mysql.info $(DESTDIR)$(infodir) - $(INSTALL_DATA) $(srcdir)/INSTALL-BINARY $(DESTDIR)$(infodir) uninstall-local: @RM@ -f $(DESTDIR)$(infodir)/mysql.info - @RM@ -f $(DESTDIR)$(infodir)/INSTALL-BINARY # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/INSTALL-SOURCE b/INSTALL-SOURCE index 5c54869f1bf..3d9d7d41114 100644 --- a/INSTALL-SOURCE +++ b/INSTALL-SOURCE @@ -1,7 +1,7 @@ You can find information about how to install from a source distributions at - http://dev.mysql.com/doc/refman/4.1/en/installing-source.html + http://dev.mysql.com/doc/refman/5.0/en/installing-source.html The MySQL Reference Manual is also available in various formats on http://dev.mysql.com/doc; if you're interested in the DocBook XML diff --git a/INSTALL-WIN-SOURCE b/INSTALL-WIN-SOURCE index 60eb2ff0cfc..2478e2cf609 100644 --- a/INSTALL-WIN-SOURCE +++ b/INSTALL-WIN-SOURCE @@ -2,7 +2,7 @@ You can find information about how to install from a Windows source distributions at - http://dev.mysql.com/doc/refman/4.1/en/windows-source-build.html + http://dev.mysql.com/doc/refman/5.0/en/windows-source-build.html The MySQL Reference Manual is also available in various formats on http://dev.mysql.com/doc; if you're interested in the DocBook XML diff --git a/support-files/MacOSX/ReadMe.txt b/support-files/MacOSX/ReadMe.txt index 8e721448c8d..485dbaeaa37 100644 --- a/support-files/MacOSX/ReadMe.txt +++ b/support-files/MacOSX/ReadMe.txt @@ -1,7 +1,7 @@ You can find information about how to install on Mac OS X at - http://dev.mysql.com/doc/refman/4.1/en/mac-os-x-installation.html + http://dev.mysql.com/doc/refman/5.0/en/mac-os-x-installation.html The MySQL Reference Manual is also available in various formats on http://dev.mysql.com/doc; if you're interested in the DocBook XML From d6c83016665f8fce25895a283031d8e4c160b536 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 2 Nov 2007 13:12:19 +0100 Subject: [PATCH 06/12] Makefile.am: Don't install INSTALL-BINARY, handled by build scripts Docs/Makefile.am: Don't install INSTALL-BINARY, handled by build scripts --- Docs/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Docs/Makefile.am b/Docs/Makefile.am index 31bc14af4ab..3b5aced4001 100644 --- a/Docs/Makefile.am +++ b/Docs/Makefile.am @@ -19,10 +19,9 @@ EXTRA_DIST = mysql.info INSTALL-BINARY # make sure that "make install" installs the info page, too # automake only seems to take care of this automatically, # if we're building the info page from texi directly. -install-data-hook: $(EXTRA_DIST) +install-data-hook: mysql.info $(mkinstalldirs) $(DESTDIR)$(infodir) $(INSTALL_DATA) $(srcdir)/mysql.info $(DESTDIR)$(infodir) - $(INSTALL_DATA) $(srcdir)/INSTALL-BINARY $(DESTDIR)$(infodir) # Don't update the files from bitkeeper %::SCCS/s.% From ae53002e6e0cccd8d4b17f24a00c6ec98d63d4c1 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 2 Nov 2007 13:16:23 +0100 Subject: [PATCH 07/12] Makefile.am: Removed place holder for 'manual.chm' .del-manual.chm: Delete: Docs/manual.chm BitKeeper/deleted/.del-manual.chm: Delete: Docs/manual.chm Docs/Makefile.am: Removed place holder for 'manual.chm' --- Docs/Makefile.am | 2 +- Docs/manual.chm | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 Docs/manual.chm diff --git a/Docs/Makefile.am b/Docs/Makefile.am index d161836aaca..dac256f8fd6 100644 --- a/Docs/Makefile.am +++ b/Docs/Makefile.am @@ -13,7 +13,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -EXTRA_DIST = manual.chm mysql.info INSTALL-BINARY +EXTRA_DIST = mysql.info INSTALL-BINARY # make sure that "make install" installs the info page, too # automake only seems to take care of this automatically, diff --git a/Docs/manual.chm b/Docs/manual.chm deleted file mode 100644 index 28c3e1b5a86..00000000000 --- a/Docs/manual.chm +++ /dev/null @@ -1,14 +0,0 @@ - -********************************************************* - -This is a dummy placeholder file for "manual.chm" in the -MySQL source trees. - -Note, that the documentation has been moved into a separate -BitKeeper source tree named "mysqldoc" - do not attempt to edit this -file! All changes to it should be done in the mysqldoc tree. - -This dummy file is being replaced with the actual file from the -mysqldoc tree when building the official source distribution. - -********************************************************* From ffb12753d84ac2f114c5c5f18d11ff9f4ac4d6db Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 2 Nov 2007 15:16:45 -0400 Subject: [PATCH 08/12] Bug#31319 CMake build does not check for minimum required version - Add check --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7b546ab72c..27b2bf9b70e 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR) + PROJECT(MySql) # This reads user configuration, generated by configure.js. From 7bb73945459e71bdd8fa1297dc3fd313306235cc Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 5 Nov 2007 17:48:11 +0100 Subject: [PATCH 09/12] Provide better feedback to the user when unable to find MySQL files usually caused by a bad basedir setting. support-files/mysql.server.sh: Be more verbose in error message. --- support-files/mysql.server.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index c68d30daafb..0a87b04c992 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -311,7 +311,7 @@ case "$mode" in fi exit $return_value else - log_failure_msg "Couldn't find MySQL manager or server" + log_failure_msg "Couldn't find MySQL manager ($manager) or server ($bindir/mysqld_safe)" fi ;; From 707f42a6b988d94630f3e43dad410311f40ac4f8 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 7 Nov 2007 15:23:50 -0700 Subject: [PATCH 10/12] Bug #20748: Configuration files should not be read more than once A user could not override system-wide settings in their ~/.my.cnf, because the DEFAULT_SYSCONFDIR was being searched last. Also, in some configurations (especially when the --sysconfdir compile-time option is set to /etc or /etc/mysql), the system-wide my.cnf file was read multiple times, causing confusion and potential problems. Rearrange default directories to conform to the manual and logic. Move --sysconfdir= (DEFAULT_SYSCONFDIR) from the last default directory to the middle of the list. $HOME/.my.cnf should be last, so the user is able to override the system-wide settings. Change init_default_directories() to remove duplicates from the list. include/my_sys.h: Add array_append_string_unique(), from mf_arr_appstr.c libmysql/Makefile.shared: Add new mf_arr_appstr.lo object mysys/CMakeLists.txt: Add new mf_arr_appstr.c source. mysys/Makefile.am: Add new mf_arr_appstr.c source. mysys/default.c: Change order in which defaults files are added to default_directories, in order to conform to the manual (and to common sense). This fixes a particularly bad problem on Unix, where ~/.my.cnf was read before /usr/local/etc/my.cnf. Also, don't add duplicate entries; move the existing entry to the end of the list instead. Here is a comparison of the order of defaults files, BEFORE and AFTER this patch. On Windows: BEFORE: C:\, GetWindowsDirectory(), GetSystemWindowsDirectory(), $MYSQL_HOME, defaults-extra-file, INSTALLDIR AFTER: GetSystemWindowsDirectory(), GetWindowsDirectory(), C:\, INSTALLDIR, $MYSQL_HOME, defaults-extra-file GetSystemWindowsDirectory() is moved before GetWindowsDirectory() because the former is shared by all Terminal Services users, while the latter is private for each user. On Netware (no change): BEFORE: sys:/etc/, $MYSQL_HOME, defaults-extra-file AFTER: sys:/etc, $MYSQL_HOME, defaults-extra-file On OS/2: BEFORE: $ETC, /etc, $MYSQL_HOME, defaults-extra-file AFTER: /etc, $ETC, $MYSQL_HOME, defaults-extra-file On everything else (general Unix): BEFORE: /etc, $MYSQL_HOME, defaults-extra-file, ~/, --sysconfdir AFTER: /etc/, --sysconfdir, $MYSQL_HOME, defaults-extra-file, ~/ The BEFORE code added --sysconfdir on all systems, but only the Unix build system actually defined a value for it. mysys/mf_arr_appstr.c: BitKeeper file /home/tsmith/m/bk/build/50-b20748/mysys/mf_arr_appstr.c --- include/my_sys.h | 2 + libmysql/Makefile.shared | 2 +- mysys/CMakeLists.txt | 2 +- mysys/Makefile.am | 2 +- mysys/default.c | 192 ++++++++++++++++++++++++++------------- mysys/mf_arr_appstr.c | 61 +++++++++++++ 6 files changed, 195 insertions(+), 66 deletions(-) create mode 100644 mysys/mf_arr_appstr.c diff --git a/include/my_sys.h b/include/my_sys.h index 7df2718c7b1..8c0d620984c 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -691,6 +691,8 @@ extern WF_PACK *wf_comp(my_string str); extern int wf_test(struct wild_file_pack *wf_pack,const char *name); extern void wf_end(struct wild_file_pack *buffer); extern size_s strip_sp(my_string str); +extern my_bool array_append_string_unique(const char *str, + const char **array, size_t size); extern void get_date(my_string to,int timeflag,time_t use_time); extern void soundex(CHARSET_INFO *, my_string out_pntr, my_string in_pntr,pbool remove_garbage); extern int init_record_cache(RECORD_CACHE *info,uint cachesize,File file, diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index dc6d658fcdf..7839c117432 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -59,7 +59,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ mf_pack.lo my_messnc.lo mf_dirname.lo mf_fn_ext.lo\ mf_wcomp.lo typelib.lo safemalloc.lo my_alloc.lo \ mf_format.lo mf_path.lo mf_unixpath.lo my_fopen.lo \ - my_symlink.lo my_fstream.lo \ + my_symlink.lo my_fstream.lo mf_arr_appstr.lo \ mf_loadpath.lo my_pthread.lo my_thr_init.lo \ thr_mutex.lo mulalloc.lo string.lo \ default.lo default_modify.lo \ diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 8aaf0b5f00f..cd3e7afd6a5 100755 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -26,7 +26,7 @@ ADD_LIBRARY(mysys array.c charset-def.c charset.c checksum.c default.c default_m errors.c hash.c list.c md5.c mf_brkhant.c mf_cache.c mf_dirname.c mf_fn_ext.c mf_format.c mf_getdate.c mf_iocache.c mf_iocache2.c mf_keycache.c mf_keycaches.c mf_loadpath.c mf_pack.c mf_path.c mf_qsort.c mf_qsort2.c - mf_radix.c mf_same.c mf_sort.c mf_soundex.c mf_strip.c mf_tempdir.c + mf_radix.c mf_same.c mf_sort.c mf_soundex.c mf_strip.c mf_arr_appstr.c mf_tempdir.c mf_tempfile.c mf_unixpath.c mf_wcomp.c mf_wfile.c mulalloc.c my_access.c my_aes.c my_alarm.c my_alloc.c my_append.c my_bit.c my_bitmap.c my_chsize.c my_clock.c my_compress.c my_conio.c my_copy.c my_crc32.c my_create.c my_delete.c diff --git a/mysys/Makefile.am b/mysys/Makefile.am index a835492e670..8c6bf5f7006 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -38,7 +38,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ my_error.c errors.c my_div.c my_messnc.c \ mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \ my_symlink.c my_symlink2.c \ - mf_pack.c mf_unixpath.c mf_strip.c \ + mf_pack.c mf_unixpath.c mf_strip.c mf_arr_appstr.c \ mf_wcomp.c mf_wfile.c my_gethwaddr.c \ mf_qsort.c mf_qsort2.c mf_sort.c \ ptr_cmp.c mf_radix.c queues.c \ diff --git a/mysys/default.c b/mysys/default.c index aff38b6af0b..74d016ce53c 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -47,7 +47,7 @@ char *my_defaults_extra_file=0; /* Which directories are searched for options (and in which order) */ -#define MAX_DEFAULT_DIRS 7 +#define MAX_DEFAULT_DIRS 6 const char *default_directories[MAX_DEFAULT_DIRS + 1]; #ifdef __WIN__ @@ -83,7 +83,22 @@ static int search_default_file_with_ext(Process_option_func func, void *func_ctx, const char *dir, const char *ext, const char *config_file, int recursion_level); -static void init_default_directories(); + + + +/** + Create the list of default directories. + + @details + On all systems, if a directory is already in the list, it will be moved + to the end of the list. This avoids reading defaults files multiple times, + while ensuring the correct precedence. + + @return void +*/ + +static void (*init_default_directories)(); + static char *remove_end_comment(char *ptr); @@ -913,6 +928,25 @@ void print_defaults(const char *conf_file, const char **groups) #include +#define ADD_DIRECTORY(DIR) \ + do { \ + my_bool rc= \ + array_append_string_unique((DIR), default_directories, \ + array_elements(default_directories)); \ + DBUG_ASSERT(rc == FALSE); /* Success */ \ + } while (0) + + +#define ADD_COMMON_DIRECTORIES() \ + do { \ + char *env; \ + if ((env= getenv(STRINGIFY_ARG(DEFAULT_HOME_ENV)))) \ + ADD_DIRECTORY(env); \ + /* Placeholder for --defaults-extra-file= */ \ + ADD_DIRECTORY(""); \ + } while (0) + + #ifdef __WIN__ /* This wrapper for GetSystemWindowsDirectory() will dynamically bind to the @@ -947,73 +981,33 @@ static uint my_get_system_windows_directory(char *buffer, uint size) } return count; } -#endif -/* - Create the list of default directories. +/** + Initialize default directories for Microsoft Windows - On Microsoft Windows, this is: - 1. C:/ + @details + 1. GetSystemWindowsDirectory() 2. GetWindowsDirectory() - 3. GetSystemWindowsDirectory() - 4. getenv(DEFAULT_HOME_ENV) - 5. Directory above where the executable is located - 6. "" - 7. --sysconfdir= + 3. C:/ + 4. Directory above where the executable is located + 5. getenv(DEFAULT_HOME_ENV) + 6. --defaults-extra-file= (run-time option) +*/ - On Novell NetWare, this is: - 1. sys:/etc/ - 2. getenv(DEFAULT_HOME_ENV) - 3. "" - 4. --sysconfdir= - - On OS/2, this is: - 1. getenv(ETC) - 2. /etc/ - 3. getenv(DEFAULT_HOME_ENV) - 4. "" - 5. "~/" - 6. --sysconfdir= - - Everywhere else, this is: - 1. /etc/ - 2. getenv(DEFAULT_HOME_ENV) - 3. "" - 4. "~/" - 5. --sysconfdir= - - */ - -static void init_default_directories() +static void init_default_directories_win() { - const char *env, **ptr= default_directories; + bzero(default_directories, sizeof(default_directories)); -#ifdef __WIN__ - *ptr++= "C:/"; + if (my_get_system_windows_directory(shared_system_dir, + sizeof(shared_system_dir))) + ADD_DIRECTORY(&shared_system_dir); if (GetWindowsDirectory(system_dir,sizeof(system_dir))) - *ptr++= (char*)&system_dir; - if (my_get_system_windows_directory(shared_system_dir, - sizeof(shared_system_dir)) && - strcmp(system_dir, shared_system_dir)) - *ptr++= (char *)&shared_system_dir; + ADD_DIRECTORY(&system_dir); + + ADD_DIRECTORY("C:/"); -#elif defined(__NETWARE__) - *ptr++= "sys:/etc/"; -#else -#if defined(__EMX__) || defined(OS2) - if ((env= getenv("ETC"))) - *ptr++= env; -#endif - *ptr++= "/etc/"; -#endif - if ((env= getenv(STRINGIFY_ARG(DEFAULT_HOME_ENV)))) - *ptr++= env; - *ptr++= ""; /* Place for defaults_extra_file */ -#if !defined(__WIN__) && !defined(__NETWARE__) - *ptr++= "~/";; -#elif defined(__WIN__) if (GetModuleFileName(NULL, config_dir, sizeof(config_dir))) { char *last= NULL, *end= strend(config_dir); @@ -1043,12 +1037,84 @@ static void init_default_directories() last= end; } } - *ptr++= (char *)&config_dir; + ADD_DIRECTORY(&config_dir); } -#endif + + ADD_COMMON_DIRECTORIES(); +} + +static void (*init_default_directories)()= init_default_directories_win; + +#elif defined(__NETWARE__) + +/** + Initialize default directories for Novell Netware + + @details + 1. sys:/etc/ + 2. getenv(DEFAULT_HOME_ENV) + 3. --defaults-extra-file= (run-time option) +*/ + +static void init_default_directories_netware() +{ + bzero(default_directories, sizeof(default_directories)); + ADD_DIRECTORY("sys:/etc/"); + ADD_COMMON_DIRECTORIES(); +} + +static void (*init_default_directories)()= init_default_directories_netware; + +#elif defined(__EMX__) || defined(OS2) + +/** + Initialize default directories for OS/2 + + @details + 1. /etc/ + 2. getenv(ETC) + 3. getenv(DEFAULT_HOME_ENV) + 4. --defaults-extra-file= (run-time option) +*/ + +static void init_default_directories_os2() +{ + const char *env; + + bzero(default_directories, sizeof(default_directories)); + ADD_DIRECTORY("/etc/"); + if ((env= getenv("ETC"))) + ADD_DIRECTORY(env); + ADD_COMMON_DIRECTORIES(); +} + +static void (*init_default_directories)()= init_default_directories_os2; + +#else + +/** + Initialize default directories for Unix + + @details + 1. /etc/ + 2. --sysconfdir= (compile-time option) + 3. getenv(DEFAULT_HOME_ENV) + 4. --defaults-extra-file= (run-time option) + 5. "~/" +*/ + +static void init_default_directories_unix() +{ + bzero(default_directories, sizeof(default_directories)); + ADD_DIRECTORY("/etc/"); #ifdef DEFAULT_SYSCONFDIR if (DEFAULT_SYSCONFDIR != "") - *ptr++= DEFAULT_SYSCONFDIR; + ADD_DIRECTORY(DEFAULT_SYSCONFDIR); #endif - *ptr= 0; /* end marker */ + ADD_COMMON_DIRECTORIES(); + ADD_DIRECTORY("~/"); } + +static void (*init_default_directories)()= init_default_directories_unix; + +#endif diff --git a/mysys/mf_arr_appstr.c b/mysys/mf_arr_appstr.c new file mode 100644 index 00000000000..1edbea9df4a --- /dev/null +++ b/mysys/mf_arr_appstr.c @@ -0,0 +1,61 @@ +/* Copyright (C) 2007 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysys_priv.h" +#include /* strcmp() */ + + +/** + Append str to array, or move to the end if it already exists + + @param str String to be appended + @param array The array, terminated by a NULL element, all unused elements + pre-initialized to NULL + @param size Size of the array; array must be terminated by a NULL + pointer, so can hold size - 1 elements + + @retval FALSE Success + @retval TRUE Failure, array is full +*/ + +my_bool array_append_string_unique(const char *str, + const char **array, size_t size) +{ + const char **p; + /* end points at the terminating NULL element */ + const char **end= array + size - 1; + DBUG_ASSERT(*end == NULL); + + for (p= array; *p; ++p) + { + if (strcmp(*p, str) == 0) + break; + } + if (p >= end) + return TRUE; /* Array is full */ + + DBUG_ASSERT(*p == NULL || strcmp(*p, str) == 0); + + while (*(p + 1)) + { + *p= *(p + 1); + ++p; + } + + DBUG_ASSERT(p < end); + *p= str; + + return FALSE; /* Success */ +} From dae9042bc6b5de886cc31b912a50c681966a065c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 9 Nov 2007 18:27:20 -0700 Subject: [PATCH 11/12] Fix Windows build problems. libmysql/CMakeLists.txt: Add new mysys/mf_arr_appstr.c source file mysys/default.c: Fix some bad code that caused warnings on Windows --- libmysql/CMakeLists.txt | 2 +- mysys/default.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 59e70d68a6d..0e332d77259 100755 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -74,7 +74,7 @@ SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c ../mysys/hash.c ../mysys/my_sleep.c ../mysys/default_modify.c get_password.c ../strings/int2str.c ../strings/is_prefix.c libmysql.c ../mysys/list.c ../strings/llstr.c - ../strings/longlong2str.c manager.c ../mysys/mf_cache.c + ../strings/longlong2str.c manager.c ../mysys/mf_arr_appstr.c ../mysys/mf_cache.c ../mysys/mf_dirname.c ../mysys/mf_fn_ext.c ../mysys/mf_format.c ../mysys/mf_iocache.c ../mysys/mf_iocache2.c ../mysys/mf_loadpath.c ../mysys/mf_pack.c ../mysys/mf_path.c ../mysys/mf_tempfile.c ../mysys/mf_unixpath.c diff --git a/mysys/default.c b/mysys/default.c index 74d016ce53c..a24f6583004 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -997,14 +997,14 @@ static uint my_get_system_windows_directory(char *buffer, uint size) static void init_default_directories_win() { - bzero(default_directories, sizeof(default_directories)); + bzero((char *) default_directories, sizeof(default_directories)); if (my_get_system_windows_directory(shared_system_dir, sizeof(shared_system_dir))) - ADD_DIRECTORY(&shared_system_dir); + ADD_DIRECTORY(shared_system_dir); if (GetWindowsDirectory(system_dir,sizeof(system_dir))) - ADD_DIRECTORY(&system_dir); + ADD_DIRECTORY(system_dir); ADD_DIRECTORY("C:/"); @@ -1037,7 +1037,7 @@ static void init_default_directories_win() last= end; } } - ADD_DIRECTORY(&config_dir); + ADD_DIRECTORY(config_dir); } ADD_COMMON_DIRECTORIES(); @@ -1058,7 +1058,7 @@ static void (*init_default_directories)()= init_default_directories_win; static void init_default_directories_netware() { - bzero(default_directories, sizeof(default_directories)); + bzero((char *) default_directories, sizeof(default_directories)); ADD_DIRECTORY("sys:/etc/"); ADD_COMMON_DIRECTORIES(); } @@ -1081,7 +1081,7 @@ static void init_default_directories_os2() { const char *env; - bzero(default_directories, sizeof(default_directories)); + bzero((char *) default_directories, sizeof(default_directories)); ADD_DIRECTORY("/etc/"); if ((env= getenv("ETC"))) ADD_DIRECTORY(env); @@ -1105,7 +1105,7 @@ static void (*init_default_directories)()= init_default_directories_os2; static void init_default_directories_unix() { - bzero(default_directories, sizeof(default_directories)); + bzero((char *) default_directories, sizeof(default_directories)); ADD_DIRECTORY("/etc/"); #ifdef DEFAULT_SYSCONFDIR if (DEFAULT_SYSCONFDIR != "") From 568f624406fb6771f5815bbe6184de6909270488 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Nov 2007 12:52:03 +0100 Subject: [PATCH 12/12] bigint.test, bigint.result: Test case for Bug#30069 mysql-test/r/bigint.result: Test case for Bug#30069 mysql-test/t/bigint.test: Test case for Bug#30069 --- mysql-test/r/bigint.result | 6 ++++++ mysql-test/t/bigint.test | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index e9a457c9dfa..a73342e1f7d 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -135,3 +135,9 @@ t2.value64=t1.value64; value64 value32 value64 value32 9223372036854775807 2 9223372036854775807 4 drop table t1, t2; +create table t1 (sint64 bigint not null); +insert into t1 values (-9223372036854775808); +select * from t1; +sint64 +-9223372036854775808 +drop table t1; diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 8a238d33e08..e5cd70209ea 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -107,4 +107,13 @@ t2.value64=t1.value64; drop table t1, t2; +# Test for BUG#30069, can't handle bigint -9223372036854775808 on +# x86_64, with some GCC versions and optimizations. + +create table t1 (sint64 bigint not null); +insert into t1 values (-9223372036854775808); +select * from t1; + +drop table t1; + # End of 4.1 tests