~ubuntu-branches/ubuntu/natty/mysql-5.1/natty-security

« back to all changes in this revision

Viewing changes to mysql-test/include/check_no_row_lock.inc

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-21 15:31:05 UTC
  • mfrom: (1.2.1 upstream) (2.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100621153105-lv81twvjdgzvzrre
Tags: 5.1.48-1ubuntu1
* Merge from debian unstable, remaining changes:
  + debian/control:
     * Update maintainer according to spec.
     * Move section from "misc" to "database".
     * Added libmysqlclient16-dev an empty transitional package. 
     * Added mysql-client-core-5.1 package.
     * Suggest mailx for mysql-server-5.1
     * Add mysql-testsuite package so you can run the testsuite seperately.
  + debian/additions/my.cnf:
    * Remove language options. Error message files are located in a different directory in Mysql
      5.0. Setting the language option to use /usr/share/mysql/english breaks Mysql 5.0. Both 5.0
      and 5.1 use a different value that works. (LP: #316974)
  + Add apparmor profile:
    + debian/apparmor-profile: apparmor-profile
    + debian/rules, debian/mysql-server-5.1.files: install apparmor profile
    + debian/mysql-server-5.1.dirs: add etc/apparmor.d/fore-complain
    + debian/mysql-server-5.1.postrm: remove symlink in force-complain/ on purge.
    + debian/mysql-server-5.1.README.Debian: add apparmor documentation.
    + debian/additions/my.cnf: Add warning about apparmor. (LP: #201799)
    + debian/mysql-server-5.1.postinst: reload apparmor profiles
  * Convert the package from sysvinit to upstart:
    + debian/mysql-server-5.1.mysql.upstart: Add upstart script.
    + debian/mysql-server-5.1.mysql.init: Dropped, unused now with upstart.
    + debian/additions/mysqld_safe_syslog.cnf: Dropped, unused now with upstart.
    + debian/additons/my.cnf: Remove pid declaration and setup error logging to /var/log/mysql since
      we're not piping anything around logger anymore.
    + debian/rules, debian/mysql-server-5.1.logcheck.ignore.{paranoid,worstation},
      debian/mysql-server-5.1.logcheck.ignore.server: : Remove references to mysqld_safe
    + debian/patches/38_scripts_mysqld_safe.sh_signals.dpatch: Dropped
  * Added -fno-strict-aliasing to CFLAGS to get around mysql testsuite build failures.
  * Add Apport hook (LP: #354188):
    + debian/mysql-server-5.1.py: apport package hook
    + debian/rules: Make it installable
  * debian/mysql-server-5.1.mysql-server.logrotate: Check to see if mysql is running before
    running logrotate. (LP: #513135)
  * Make the testsuite installable. (LP: #530752)
    + debian/mysql-server-5.1.files, debian/rules: install apport package hook
  * debian/mysql-server-5.1.preinst: Set mysql user's home directory
    to /nonexistent to protect against having the /var/lib/mysql
    user-writeable. If an attacker can trick mysqld into creating
    dot files in the home directory, he could do .rhost-like attacks
    on the system. (LP: #293258)
  * debian/control: mysql-client-5.1 should depend on mysql-core-client-5.1.
    (LP: #590952) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# SUMMARY
 
3
#   Check if statement affecting or reading table '$table' doesn't
 
4
#   take any kind of locks on its rows.
 
5
#
 
6
# PARAMETERS 
 
7
#   $table      Table for which presence of row locks should be checked.
 
8
#   $con_aux    Name of auxiliary connection to be used by this script.
 
9
#   $statement  Statement to be checked.
 
10
#
 
11
# EXAMPLE
 
12
#    innodb_mysql_lock2.test
 
13
#
 
14
--disable_result_log
 
15
--disable_query_log
 
16
 
 
17
connection default;
 
18
begin;
 
19
--eval select * from $table for update;
 
20
 
 
21
connection $con_aux;
 
22
begin;
 
23
--send_eval $statement;
 
24
 
 
25
--enable_result_log
 
26
--enable_query_log
 
27
 
 
28
connection default;
 
29
# Wait until statement is successfully executed while
 
30
# all rows in table are X-locked. This means that it
 
31
# does not acquire any row locks.
 
32
# We use wait_condition.inc instead of simply reaping 
 
33
# statement here in order to avoid deadlocks if test
 
34
# fails and to time out gracefully instead.
 
35
let $wait_condition=
 
36
  select count(*) = 0 from information_schema.processlist
 
37
  where info = "$statement";
 
38
--source include/wait_condition.inc
 
39
 
 
40
--disable_result_log
 
41
--disable_query_log
 
42
 
 
43
if ($success)
 
44
{
 
45
# Apparently statement was successfully executed and thus it
 
46
# has not required any row locks.
 
47
# To be safe against wait_condition.inc succeeding due to
 
48
# races let us first reap the statement being checked to
 
49
# ensure that it has been successfully executed.
 
50
connection $con_aux;
 
51
--reap
 
52
rollback;
 
53
connection default;
 
54
rollback;
 
55
--echo Success: '$statement' doesn't take row locks on '$table'.
 
56
}
 
57
if (!$success)
 
58
{
 
59
# Waiting has timed out. Apparently statement was blocked on
 
60
# some row lock. So to be able to continue we need to unlock
 
61
# rows first.
 
62
rollback;
 
63
connection $con_aux;
 
64
--reap
 
65
rollback;
 
66
connection default;
 
67
--echo Error: '$statement' takes some row locks on '$table'!
 
68
}
 
69
 
 
70
--enable_result_log
 
71
--enable_query_log