From 188b8af60c044b1ecbcd5009ea63445ae5725f0a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Apr 2005 01:40:29 +0400 Subject: [PATCH 1/5] Fix for bug #9566 "explicit LOCK TABLE and store procedures result in illegal state". We should not assume that mysql.proc table does not exist if we are unable to open it under LOCK TABLES or in prelocked mode (and remember this fact by setting mysql_proc_table_exists to zero). mysql-test/r/sp.result: Added test for bug #9566 "explicit LOCK TABLE and store procedures result in illegal state" mysql-test/t/sp.test: Added test for bug #9566 "explicit LOCK TABLE and store procedures result in illegal state" sql/sp.cc: db_find_routine_aux(): We should not assume that mysql.proc table does not exist if we are unable to open it under LOCK TABLES or in prelocked mode since this condition may be transient. --- mysql-test/r/sp.result | 10 ++++++++++ mysql-test/t/sp.test | 23 +++++++++++++++++++++++ sql/sp.cc | 13 +++++++++---- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index daad032b854..cb0ae310ceb 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -2779,4 +2779,14 @@ a 3.2000 drop procedure bug8937| delete from t1| +drop procedure if exists bug9566| +create procedure bug9566() +begin +select * from t1; +end| +lock table t1 read| +call bug9566()| +ERROR HY000: Table 'proc' was not locked with LOCK TABLES +unlock tables| +drop procedure bug9566| drop table t1,t2; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index a741a4af7d8..799e88a6615 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -3397,6 +3397,29 @@ call bug8937()| drop procedure bug8937| delete from t1| +# +# BUG#9566: explicit LOCK TABLE and store procedures result in illegal state +# +# We should not think that mysql.proc table does not exist if we are unable +# to open it under LOCK TABLE or in prelocked mode. Probably this test +# should be removed when Monty will allow access to mysql.proc without +# locking it. +# +--disable_warnings +drop procedure if exists bug9566| +--enable_warnings +create procedure bug9566() +begin + select * from t1; +end| +lock table t1 read| +# This should fail because we forgot to lock mysql.proc table explicitly +--error 1100 +call bug9566()| +unlock tables| +# This should succeed +drop procedure bug9566| + # # BUG#NNNN: New bug synopsis diff --git a/sql/sp.cc b/sql/sp.cc index 23d389cd299..1956f32f2c6 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -70,9 +70,8 @@ db_find_routine_aux(THD *thd, int type, sp_name *name, type, name->m_name.length, name->m_name.str)); /* - Speed up things if mysql.proc doesn't exists - mysql_proc_table_exists is set when on creates a stored procedure - or on flush privileges + Speed up things if mysql.proc doesn't exists. mysql_proc_table_exists + is set when we create or read stored procedure or on flush privileges. */ if (!mysql_proc_table_exists && ltype == TL_READ) DBUG_RETURN(SP_OPEN_TABLE_FAILED); @@ -98,7 +97,13 @@ db_find_routine_aux(THD *thd, int type, sp_name *name, if (! (table= open_ltable(thd, &tables, ltype))) { *tablep= NULL; - mysql_proc_table_exists= 0; + /* + Under explicit LOCK TABLES or in prelocked mode we should not + say that mysql.proc table does not exist if we are unable to + open it since this condition may be transient. + */ + if (!(thd->locked_tables || thd->prelocked_mode)) + mysql_proc_table_exists= 0; DBUG_RETURN(SP_OPEN_TABLE_FAILED); } *opened= TRUE; From b2ff4e9ce5cf6ac2811aa41f44020e41e0e4f16e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Apr 2005 11:57:47 +0400 Subject: [PATCH 2/5] Moved test for bug #9566 "explicit LOCK TABLE and store procedures result in illegal state" to sp-error.test. According to Per-Erik all SP related tests which should result in error should go into sp-error.test and not in sp.test, because we want to be able to run sp.test using normal client. mysql-test/r/sp-error.result: Moved test for bug #9566 "explicit LOCK TABLE and store procedures result in illegal state" to sp-error.test. mysql-test/r/sp.result: Moved test for bug #9566 "explicit LOCK TABLE and store procedures result in illegal state" to sp-error.test. mysql-test/t/sp-error.test: Moved test for bug #9566 "explicit LOCK TABLE and store procedures result in illegal state" to sp-error.test. mysql-test/t/sp.test: Moved test for bug #9566 "explicit LOCK TABLE and store procedures result in illegal state" to sp-error.test. --- mysql-test/r/sp-error.result | 10 ++++++++++ mysql-test/r/sp.result | 10 ---------- mysql-test/t/sp-error.test | 23 +++++++++++++++++++++++ mysql-test/t/sp.test | 23 ----------------------- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index c979ee34df0..ff7d71b3384 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -503,4 +503,14 @@ ERROR 0A000: LOCK is not allowed in stored procedures create procedure bug6600() unlock table t1| ERROR 0A000: UNLOCK is not allowed in stored procedures +drop procedure if exists bug9566| +create procedure bug9566() +begin +select * from t1; +end| +lock table t1 read| +call bug9566()| +ERROR HY000: Table 'proc' was not locked with LOCK TABLES +unlock tables| +drop procedure bug9566| drop table t1| diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index cb0ae310ceb..daad032b854 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -2779,14 +2779,4 @@ a 3.2000 drop procedure bug8937| delete from t1| -drop procedure if exists bug9566| -create procedure bug9566() -begin -select * from t1; -end| -lock table t1 read| -call bug9566()| -ERROR HY000: Table 'proc' was not locked with LOCK TABLES -unlock tables| -drop procedure bug9566| drop table t1,t2; diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 621700b732a..51776453730 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -696,6 +696,29 @@ create procedure bug6600() create procedure bug6600() unlock table t1| +# +# BUG#9566: explicit LOCK TABLE and store procedures result in illegal state +# +# We should not think that mysql.proc table does not exist if we are unable +# to open it under LOCK TABLE or in prelocked mode. Probably this test +# should be removed when Monty will allow access to mysql.proc without +# locking it. +# +--disable_warnings +drop procedure if exists bug9566| +--enable_warnings +create procedure bug9566() +begin + select * from t1; +end| +lock table t1 read| +# This should fail because we forgot to lock mysql.proc table explicitly +--error 1100 +call bug9566()| +unlock tables| +# This should succeed +drop procedure bug9566| + # # BUG#NNNN: New bug synopsis diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 799e88a6615..a741a4af7d8 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -3397,29 +3397,6 @@ call bug8937()| drop procedure bug8937| delete from t1| -# -# BUG#9566: explicit LOCK TABLE and store procedures result in illegal state -# -# We should not think that mysql.proc table does not exist if we are unable -# to open it under LOCK TABLE or in prelocked mode. Probably this test -# should be removed when Monty will allow access to mysql.proc without -# locking it. -# ---disable_warnings -drop procedure if exists bug9566| ---enable_warnings -create procedure bug9566() -begin - select * from t1; -end| -lock table t1 read| -# This should fail because we forgot to lock mysql.proc table explicitly ---error 1100 -call bug9566()| -unlock tables| -# This should succeed -drop procedure bug9566| - # # BUG#NNNN: New bug synopsis From d9151b75c365c7c786baeb1f207b6734382e61c4 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Apr 2005 13:20:15 +0300 Subject: [PATCH 3/5] A small fix to Makefile.am --- mysql-test/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index 34b1dd1a1fe..9963074daf5 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -32,7 +32,7 @@ endif benchdir_root= $(prefix) testdir = $(benchdir_root)/mysql-test -EXTRA_SCRIPTS = mysql-test-run.sh mysql-test-run.pl install_test_db.sh +EXTRA_SCRIPTS = mysql-test-run.sh mysql-test-run.pl install_test_db.sh valgrind.supp EXTRA_DIST = $(EXTRA_SCRIPTS) test_SCRIPTS = mysql-test-run install_test_db test_DATA = std_data/client-key.pem std_data/client-cert.pem std_data/cacert.pem @@ -59,7 +59,6 @@ dist-hook: $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(distdir)/std_data $(INSTALL_DATA) $(srcdir)/lib/init_db.sql $(distdir)/lib $(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib - $(INSTALL_DATA) $(srcdir)/*.supp $(distdir)/ install-data-local: $(mkinstalldirs) \ From 99c0dd3bc6f55be3e144129025a87a26c9470957 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Apr 2005 16:14:45 +0500 Subject: [PATCH 4/5] ctype-eucjpms.c: After merge fix. strings/ctype-eucjpms.c: After merge fix. --- strings/ctype-eucjpms.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/strings/ctype-eucjpms.c b/strings/ctype-eucjpms.c index 346b5ecdf6b..ab12446754a 100644 --- a/strings/ctype-eucjpms.c +++ b/strings/ctype-eucjpms.c @@ -8417,7 +8417,10 @@ uint my_well_formed_len_eucjpms(CHARSET_INFO *cs __attribute__((unused)), { ch= *b++; if (b >= (uchar*) end) + { + *error= 1; return chbeg - beg; /* unexpected EOL */ + } } if (ch >= 0xA1 && ch <= 0xFE && From ff700f45c8db2785a9c427d22c757b7f2afde7e8 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Apr 2005 14:39:30 +0200 Subject: [PATCH 5/5] Fix linking problem on bsd53 - See article http://archive.netbsd.se/?ml=freebsd-current&a=2004-07&m=257561 or http://www.geocrawler.com/archives/3/254/2003/3/450/10409564/ configure.in: The libsupc++ library on freebsd with gcc 3.4.2 is dependent on libstdc++, disable it since other solution works fine --- configure.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/configure.in b/configure.in index c7e93c9676a..01f669a0d1b 100644 --- a/configure.in +++ b/configure.in @@ -351,6 +351,15 @@ then if echo $CXX | grep gcc > /dev/null 2>&1 then GCC_VERSION=`gcc -v 2>&1 | grep version | sed -e 's/[[^0-9. ]]//g; s/^ *//g; s/ .*//g'` + case $SYSTEM_TYPE in + *freebsd*) + # The libsupc++ library on freebsd with gcc 3.4.2 is dependent on + # libstdc++, disable it since other solution works fine + GCC_VERSION="NOSUPCPP_$GCC_VERSION" + ;; + *) + ;; + esac echo "Using gcc version '$GCC_VERSION'" case "$GCC_VERSION" in 3.4.*|3.5.*)