1. 01 Dec, 2010 1 commit
    • Mats Kindahl's avatar
      BUG#58246: INSTALL PLUGIN not secure & crashable · fc9f3efa
      Mats Kindahl authored
      When installing plugins, there is a missing check
      for slash (/) in the path on Windows. Note that on
      Windows, both / and \ can be used to separate
      directories.
      
      This patch fixes the issue by:
      - Adding a FN_DIRSEP symbol for all platforms
        consisting of a string of legal directory
        separators.
      - Adding a charset-aware version of strcspn().
      - Adding a check_valid_path() function that uses
        my_strcspn() to check if any FN_DIRSEP character
        is in the supplied string.
      - Using the check_valid_path() function in
        sql_plugin.cc and sql_udf.cc (which means
        replacing the existing test there).
      
      include/config-netware.h:
        Adding FN_DIRSEP
        ******
        Adding FN_DIRSEP
      include/config-win.h:
        Adding FN_DIRSEP
        ******
        Adding FN_DIRSEP
      include/m_ctype.h:
        Adding my_strspn() and my_strcspn().
        
        ******
        Adding my_strspn() and my_strcspn().
      include/my_global.h:
        Adding FN_DIRSEP
        ******
        Adding FN_DIRSEP
      mysql-test/t/plugin_not_embedded.test:
        Adding test that file names containing / is
        disallowed on *all* platforms.
        ******
        Adding test that file names containing / is
        disallowed on *all* platforms.
      sql/sql_plugin.cc:
        Introducing check_if_path() function for
        checking if filename is a path to include
        / on Windows.
        ******
        Introducing check_if_path() function for
        checking if filename is a path to include
        / on Windows.
      sql/sql_udf.cc:
        Switching to use check_if_path() function.
        ******
        Switching to use check_if_path() function.
      strings/my_strchr.c:
        Adding my_strspn() and my_strcspn().
        ******
        Adding my_strspn() and my_strcspn().
      fc9f3efa
  2. 10 Nov, 2010 1 commit
    • Davi Arnaut's avatar
      Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure · cd1c6e22
      Davi Arnaut authored
      Bug#57995: Compiler flag change build error on OSX 10.4: my_getncpus.c
      Bug#57996: Compiler flag change build error on OSX 10.5 : bind.c
      Bug#57994: Compiler flag change build error : my_redel.c
      Bug#57993: Compiler flag change build error on FreeBsd 7.0 : regexec.c
      Bug#57992: Compiler flag change build error on FreeBsd : mf_keycache.c
      Bug#57997: Compiler flag change build error on OSX 10.6: debug_sync.cc
      
      Fix assorted compiler generated warnings.
      
      cmd-line-utils/readline/bind.c:
        Bug#57996: Compiler flag change build error on OSX 10.5 : bind.c
        
        Initialize variable to work around a false positive warning.
      include/m_string.h:
        Bug#57994: Compiler flag change build error : my_redel.c
        
        The expansion of stpcpy (in glibc) causes warnings if the
        return value of strmov is not being used. Since stpcpy is
        a GNU extension and the expansion ends up using a built-in
        provided by GCC, use the compiler provided built-in directly
        when possible.
      include/my_compiler.h:
        Define a dummy MY_GNUC_PREREQ when not compiling with GCC.
      libmysql/libmysql.c:
        Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure
        
        Variable might not be used in some cases. So, tag it as unused.
      mysys/mf_keycache.c:
        Bug#57992: Compiler flag change build error on FreeBsd : mf_keycache.c
        
        Use UNINIT_VAR to work around a false positive warning.
      mysys/my_getncpus.c:
        Bug#57995: Compiler flag change build error on OSX 10.4: my_getncpus.c
        
        Declare variable in the same block where it is used.
      regex/regexec.c:
        Bug#57993: Compiler flag change build error on FreeBsd 7.0 : regexec.c
        
        Work around a compiler bug which causes the cast to not be enforced.
      sql/debug_sync.cc:
        Bug#57997: Compiler flag change build error on OSX 10.6: debug_sync.cc
        
        Use UNINIT_VAR to work around a false positive warning.
      sql/handler.cc:
        Use UNINIT_VAR to work around a false positive warning.
      sql/slave.cc:
        Use UNINIT_VAR to work around a false positive warning.
      sql/sql_partition.cc:
        Use UNINIT_VAR to work around a false positive warning.
      storage/myisam/ft_nlq_search.c:
        Use UNINIT_VAR to work around a false positive warning.
      storage/myisam/mi_create.c:
        Use UNINIT_VAR to work around a false positive warning.
      storage/myisammrg/myrg_open.c:
        Use UNINIT_VAR to work around a false positive warning.
      tests/mysql_client_test.c:
        Change function to take a pointer to const, no need for a cast.
      cd1c6e22
  3. 15 Nov, 2010 3 commits
    • Mattias Jonsson's avatar
      merge · 6780abfc
      Mattias Jonsson authored
      6780abfc
    • Mattias Jonsson's avatar
      merge · 3df98a28
      Mattias Jonsson authored
      3df98a28
    • Mattias Jonsson's avatar
      Bug#58197: main.variables-big fails on windows · 47b514ff
      Mattias Jonsson authored
      The test result differs on windows, since
      it writes out 'localhost:<port>' instead of
      only 'localhost', since it uses tcp/ip instead
      of unix sockets on windows.
      
      Fixed by replacing that column.
      
      Also requires --big-test from some long running tests
      and added a weekly run of all test requiring --big-test.
      
      mysql-test/collections/default.weekly:
        Added a run of big-test (already exists in 5.5).
      mysql-test/r/variables-big.result:
        Updated results
      mysql-test/suite/parts/t/part_supported_sql_func_innodb.test:
        requiring --big-test since the test takes long time
      mysql-test/suite/parts/t/partition_alter1_1_2_innodb.test:
        requiring --big-test since the test takes long time
      mysql-test/suite/parts/t/partition_alter1_2_innodb.test:
        requiring --big-test since the test takes long time
      mysql-test/suite/parts/t/partition_alter4_innodb.test:
        requiring --big-test since the test takes long time
      mysql-test/t/disabled.def:
        Disabled two tests since they fail and was already
        reported as bugs (but was never run since they requires
        --big-test flag).
      mysql-test/t/variables-big.test:
        Replacing column 3 in process list since it
        is not the same on windows as in unix.
      47b514ff
  4. 11 Nov, 2010 3 commits
    • Mattias Jonsson's avatar
      Bug#57890: Assertion failed: next_insert_id == 0 · e0a8c254
      Mattias Jonsson authored
                 with on duplicate key update
      
      There was a missed corner case in the partitioning
      handler, which caused the next_insert_id to be changed
      in the second level handlers (i.e the hander of a partition),
      which caused this debug assertion.
      
      The solution was to always ensure that only the partitioning
      level generates auto_increment values, since if it was done
      within a partition, it may fail to match the partition
      function.
      
      mysql-test/suite/parts/inc/partition_auto_increment.inc:
        Added tests
      mysql-test/suite/parts/r/partition_auto_increment_blackhole.result:
        updated results
      mysql-test/suite/parts/r/partition_auto_increment_innodb.result:
        updated results
      mysql-test/suite/parts/r/partition_auto_increment_memory.result:
        updated results
      mysql-test/suite/parts/r/partition_auto_increment_myisam.result:
        updated results
      sql/ha_partition.cc:
        In <engine>::write_row the auto_inc value is generated
        through handler::update_auto_increment (which calls <engine>::get_auto_increment() if needed).
        If:
        * INSERT_ID was set to 0
        * it was updated to 0 by 'INSERT ... ON DUPLICATE KEY UPDATE' and changed partitions for the row
        Then it would try to generate a auto_increment value in the
        <engine for a specific partition>::write_row, which will
        trigger the assert.
        
        So the solution is to prevent this by,
        in ha_partition::write_row set auto_inc_field_not_null and
        add MODE_NO_AUTO_VALUE_ON_ZERO
        in ha_partition::update_row (when changing partition) temporary
        set table->next_number_field to NULL which calling the
        partitions ::write_row().
      e0a8c254
    • Sergey Vojtovich's avatar
      13bc5b3f
    • Dmitry Shulga's avatar
      Fixed bug#54375 - Error in stored procedure leaves connection · 871f3635
      Dmitry Shulga authored
      in different default schema.
      
      In strict mode, when data truncation or conversion happens,
      THD::killed is set to THD::KILL_BAD_DATA.
      
      This is abuse of KILL mechanism to guarantee that execution
      of statement is aborted.
      
      The stored procedures execution, on the other hand,
      upon detection that a connection was killed, would
      terminate immediately, without trying to restore the caller's
      context, in particular, restore the caller's current schema.
      
      The fix is, when terminating a stored procedure execution,
      to only bypass cleanup if the entire connection was killed,
      not in case of other forms of KILL.
      
      
      mysql-test/r/sp-bugs.result:
        Added result for a test case for bug#54375.
      mysql-test/t/sp-bugs.test:
        Added test case for bug#54375.
      sql/sp_head.cc:
        sp_head::execute modified: restore saved current db if
        connection is not killed.
      871f3635
  5. 10 Nov, 2010 2 commits
    • Dmitry Shulga's avatar
      Fixed bug#56619 - Assertion failed during · 4b0fe887
      Dmitry Shulga authored
      ALTER TABLE RENAME, DISABLE KEYS.
      
      The code of ALTER TABLE RENAME, DISABLE KEYS could
      issue a commit while holding LOCK_open mutex.
      This is a regression introduced by the fix for
      Bug 54453.
      This failed an assert guarding us against a potential
      deadlock with connections trying to execute
      FLUSH TABLES WITH READ LOCK.
      
      The fix is to move acquisition of LOCK_open outside
      the section that issues ha_autocommit_or_rollback().
      LOCK_open is taken to protect against concurrent
      operations with .frms and the table definition
      cache, and doesn't need to cover the call to commit.
      
      A test case added to innodb_mysql.test.
      
      The patch is to be null-merged to 5.5, which
      already has 54453 null-merged to it.
      
      mysql-test/suite/innodb/r/innodb_mysql.result:
        Added test results for test for bug#56619.
      mysql-test/suite/innodb/t/innodb_mysql.test:
        Added test for bug#56619.
      sql/sql_table.cc:
        mysql_alter_table() modified: moved acquisition of LOCK_open
        after call to ha_autocommit_or_rollback.
      4b0fe887
    • Dmitry Shulga's avatar
      Fixed Bug#57386 - main.execution_constants segfault on MIPS64EL. · 2c16c7e9
      Dmitry Shulga authored
      sql/item_func.cc:
        Item_func::fix_fields modified: increased minimal required stack
        size in call to check_stack_overrun().
      2c16c7e9
  6. 09 Nov, 2010 2 commits
    • Davi Arnaut's avatar
      Bug#57210: remove pstack · 1b88853a
      Davi Arnaut authored
      Quoting from the bug report:
      
      The pstack library has been included in MySQL since version
      4.0.0. It's useless and should be removed.
      
      Details: According to its own documentation, pstack only works
      on Linux on x86 in 32 bit mode and requires LinuxThreads and a
      statically linked binary. It doesn't really support any Linux
      from 2003 or later and doesn't work on any other OS.
      
      The --enable-pstack option is thus deprecated and has no effect.
      1b88853a
    • Bjorn Munch's avatar
      merge from 5.1-mtr · 6eaa3c07
      Bjorn Munch authored
      6eaa3c07
  7. 08 Nov, 2010 4 commits
  8. 07 Nov, 2010 1 commit
    • Dmitry Shulga's avatar
      A fix and a test case for Bug#47924 -main.log_tables times out · 8f237f58
      Dmitry Shulga authored
      sporadically.
      
      The cause of the sporadic time out was a leaking protection
      against the global read lock, taken by the RENAME statement,
      and not released in case of an error occurred during RENAME.
      The leaking protection counter would lead to the value of
      protect_against_global_read never dropping to 0.
      Consequently FLUSH TABLES in all connections, including the
      one that leaked the protection, could not proceed.
       
      The fix is to ensure that all branchesin RENAME code properly
      release GRL protection.
      
      mysql-test/r/log_tables.result:
        Added results for test for bug#47924.
      mysql-test/t/log_tables.test:
        Added test for bug#47924.
      sql/sql_rename.cc:
        mysql_rename_tables() modified: replaced return from function
        to goto to clean up code block in case of error.
      8f237f58
  9. 05 Nov, 2010 2 commits
    • Bjorn Munch's avatar
      Bug #57840 MTR: parallel execution breaks with smart ordering of test cases · 866cec61
      Bjorn Munch authored
      There were actually more problems in this area:
        Slaves (if any) were unconditionally restarted, this appears unnecessary.
        Sort criteria were suboptimal, included the test name.
      Added logic to "reserve" a sequence of tests with same config for one thread
      Got rid of sort_criteria hash, put it into the test case itself
      Adds little sanity check that expected worker picks up test
      Fixed some tests that may fail if starting on running server
      Some of these fail only if *same* test is repeated.
      Finally, special sorting of tests that do --force-restart
      866cec61
    • Guilhem Bichot's avatar
      BUG#57933 "add -Wdeclaration-after-statement to gcc builds"; · f6ae96d4
      Guilhem Bichot authored
      first part, for autotools build.
      
      config/ac-macros/maintainer.m4:
        Add the flag. With it, and as we use -Werror, we nicely get
        "error: ISO C90 forbids mixed declarations and code" if
        a declaration follows a statement in C code.
        Note that g++ refuses this flag.
      f6ae96d4
  10. 03 Nov, 2010 3 commits
  11. 02 Nov, 2010 1 commit
  12. 01 Nov, 2010 1 commit
  13. 31 Oct, 2010 1 commit
    • Gleb Shchepa's avatar
      Bug #52160: crash and inconsistent results when grouping · 20d70497
      Gleb Shchepa authored
                  by a function and column
      
      The bugreport reveals two different bugs about grouping
      on a function:
      
      1) grouping by the TIME_TO_SEC function result caused
         a server crash or wrong results and
      2) grouping by the function returning a blob caused
         an unexpected "Duplicate entry" error and wrong
         result.
      
      Details for the 1st bug:
      
      TIME_TO_SEC() returns NULL if its argument is invalid (empty
      string for example). Thus its nullability depends not only
      on the nullability of its arguments but also on their values.
      Fixed by (overoptimistically) setting TIME_TO_SEC() to be
      nullable despite the nullability of its arguments.
      
      Details for the 2nd bug:
      
      The server is unable to create indices on blobs without
      explicit blob key part length. However, this fact was
      ignored for blob function result fields of GROUP BY
      intermediate tables.
      Fixed by disabling GROUP BY index creation for blob
      function result fields like regular blob fields.
      
      
      mysql-test/r/func_time.result:
        Test case for bug #52160.
      mysql-test/r/type_blob.result:
        Test case for bug #52160.
      mysql-test/t/func_time.test:
        Test case for bug #52160.
      mysql-test/t/type_blob.test:
        Test case for bug #52160.
      sql/item_timefunc.h:
        Bug #52160: crash and inconsistent results when grouping
                    by a function and column
        
        TIME_TO_SEC() returns NULL if its argument is invalid (empty
        string for example). Thus its nullability depends not only
        Fixed by (overoptimistically) setting TIME_TO_SEC() to be
        nullable despite the nullability of its arguments.
      sql/sql_select.cc:
        Bug #52160: crash and inconsistent results when grouping
                    by a function and column
        
        The server is unable to create indices on blobs without
        explicit blob key part length. However, this fact was
        ignored for blob function result fields of GROUP BY
        intermediate tables.
        Fixed by disabling GROUP BY index creation for blob
        function result fields like regular blob fields.
      20d70497
  14. 29 Oct, 2010 1 commit
  15. 28 Oct, 2010 2 commits
    • Calvin Sun's avatar
      Bug#52062: Compiler warning in os0file.c on windows 64-bit · 460ad14e
      Calvin Sun authored
      On Windows, the parameter for number of bytes passed into WriteFile()
      and ReadFile() is DWORD. Casting is needed to silence the warning on
      64-bit Windows.
      
      Also, adding several asserts to ensure the variable for number of bytes
      is no more than 32 bits, even on 64-bit Windows.
      
      This is for InnoDB Plugin.
      
      rb://415
      Approved by: Inaam
      460ad14e
    • Calvin Sun's avatar
      Bug#52062: Compiler warning in os0file.c on windows 64-bit · 16feea41
      Calvin Sun authored
      On Windows, the parameter for number of bytes passed into WriteFile()
      and ReadFile() is DWORD. Casting is needed to silence the warning on
      64-bit Windows.
      
      Also, adding several asserts to ensure the variable for number of bytes
      is no more than 32 bits, even on 64-bit Windows.
      
      This is for built-in InnoDB.
      
      rb://415
      Approved by: Inaam
      16feea41
  16. 27 Oct, 2010 2 commits
  17. 26 Oct, 2010 1 commit
  18. 25 Oct, 2010 2 commits
  19. 23 Oct, 2010 1 commit
    • unknown's avatar
      Bug#27606 GRANT statement should be replicated with DEFINER information · 06c49d57
      unknown authored
      "Grantor" columns' data is lost when replicating mysql.tables_priv.
      Slave SQL thread used its default user ''@'' as the grantor of GRANT|REVOKE
      statements executing on it.
      
      In this patch, current user is put in query log event for all GRANT and REVOKE
      statement, SQL thread uses the user in query log event as grantor.
      
      
      mysql-test/suite/rpl/r/rpl_do_grant.result:
        Add test for this bug.
      mysql-test/suite/rpl/t/rpl_do_grant.test:
        Add test for this bug.
      sql/log_event.cc:
        Refactoring THD::current_user_used and related functions.
        current_user_used is used to judge if current user should be
        binlogged in query log event. So it is better to call it m_binlog_invoker.
        The related functions are renamed too.
      sql/sql_class.cc:
        Refactoring THD::current_user_used and related functions.
        current_user_used is used to judge if current user should be
        binlogged in query log event. So it is better to call it m_binlog_invoker.
        The related functions are renamed too.
      sql/sql_class.h:
        Refactoring THD::current_user_used and related functions.
        current_user_used is used to judge if current user should be
        binlogged in query log event. So it is better to call it m_binlog_invoker.
        The related functions are renamed too.
      sql/sql_parse.cc:
        Call binlog_invoker() for GRANT and REVOKE statements.
      06c49d57
  20. 21 Oct, 2010 3 commits
    • Bjorn Munch's avatar
      Follow-up to Bug #55582 which allows checking strings in if · 909f0bf9
      Bjorn Munch authored
        Simplified cases where a select was used to compare variable against ''
      909f0bf9
    • unknown's avatar
      Bug#55478 Row events wrongly apply on the temporary table of the same name · 6646fecc
      unknown authored
      Rows events were applied wrongly on the temporary table with the same name.
      But rows events are generated only for base tables. As temporary
      table's data never be binlogged on row mode. Normally, base table of the
      same name cannot be updated if a temporary table has the same name.
      But there are two cases which can generate rows events on 
      the base table of same name.
            
      Case1: 'CREATE TABLE ... SELECT' statement.
      In mixed format, it will generate rows events if it is unsafe.
            
      Case2: Drop a transactional temporary table in a transaction
             (happens only on 5.5+).
      BEGIN;
      DROP TEMPORARY TABLE t1;       # t1 is a InnoDB table
      INSERT INTO t1 VALUES(rand()); # t1 is a MyISAM table
      COMMIT;
      'DROP TEMPORARY TABLE' will be put in the transaction cache and
      binlogged after the rows events generated by the 'INSERT' statement.
            
      After this patch, slave opens only base table when applying a rows event.
      6646fecc
    • Jimmy Yang's avatar
      Fix Bug #57616 Sig 11 in dict_load_table() when failed to load · e8f228e7
      Jimmy Yang authored
      index or foreign key
      
      Approved by Sunny Bains
      e8f228e7
  21. 20 Oct, 2010 3 commits
    • Davi Arnaut's avatar
      Bug#45288: pb2 returns a lot of compilation warnings · 3e9c5225
      Davi Arnaut authored
      Fix assorted warnings that are generated in optimized builds.
      Most of it is silencing variables that are set but unused.
      
      This patch also introduces the MY_ASSERT_UNREACHABLE macro
      which helps the compiler to deduce that a certain piece of
      code is unreachable.
      
      include/my_compiler.h:
        Use GCC's __builtin_unreachable if available. It allows
        GCC to deduce the unreachability of certain code paths,
        thus avoiding warnings that, for example, accused that a
        variable could be used without being initialized (due to
        unreachable code paths).
      3e9c5225
    • Davi Arnaut's avatar
      Bug#45288: pb2 returns a lot of compilation warnings · b5bb13ec
      Davi Arnaut authored
      Fix assorted compiler warnings.
      
      include/my_pthread.h:
        Like for pthread_cond_timedwait, the abstime is constant.
      mysys/my_gethwaddr.c:
        Instead of using a manual copy that introduce warnings due to
        type mismatch, copy the buffer using memcpy and use memcmp to
        check whether all bytes of the buffer are zeroed.
      mysys/thr_mutex.c:
        Like for pthread_cond_timedwait, the abstime is constant.
      unittest/mytap/tap.h:
        Introduce a ok() variant that does not take a format argument.
        Since ok() is tagged with a printf attribute, GCC complains if
        the fmt argument is NULL.
      b5bb13ec
    • Bjorn Munch's avatar
      e4f9ead1