Bug #46261 Plugins can be installed with --skip-grant-tables
Submitted: 17 Jul 2009 12:29 Modified: 18 Jun 2010 1:52
Reporter: Andrew Hutchings Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Staale Smedseng CPU Architecture:Any

[17 Jul 2009 12:29] Andrew Hutchings
Description:
When in --skip-grant-tables mode UDFs block you from installing them.  With plugins this does not happen.  But it still stops them starting upon server start-up.

How to repeat:
With these examples hello_world is a daemon plugin which simply spits out some text.  Example 2 shows the potential problems this causes.

Example 1:
* started with --skip-grant-tables:
mysql> install plugin hello_world soname 'hello_world.so';
Hello World: This is a static text daemon example plugin!
Query OK, 0 rows affected (0.00 sec)

mysql> show plugins;
+-------------+----------+----------------+----------------+---------+
| Name        | Status   | Type           | Library        | License |
+-------------+----------+----------------+----------------+---------+
...
| MRG_MYISAM  | ACTIVE   | STORAGE ENGINE | NULL           | GPL     | 
| hello_world | ACTIVE   | DAEMON         | hello_world.so | GPL     | 
+-------------+----------+----------------+----------------+---------+
11 rows in set (0.01 sec)

Example 2:
1. Install plugin
2. Shutdown MySQL
3. Start with --skip-grant-tables

mysql> install plugin hello_world soname 'hello_world.so';
Hello World: This is a static text daemon example plugin!
ERROR 1062 (23000): Duplicate entry 'hello_world' for key 'PRIMARY'
mysql> uninstall plugin hello_world;
ERROR 1305 (42000): PLUGIN hello_world does not exist
mysql> show plugins;
+------------+----------+----------------+---------+---------+
| Name       | Status   | Type           | Library | License |
+------------+----------+----------------+---------+---------+
| binlog     | ACTIVE   | STORAGE ENGINE | NULL    | GPL     | 
| partition  | ACTIVE   | STORAGE ENGINE | NULL    | GPL     | 
| ARCHIVE    | ACTIVE   | STORAGE ENGINE | NULL    | GPL     | 
| BLACKHOLE  | ACTIVE   | STORAGE ENGINE | NULL    | GPL     | 
| CSV        | ACTIVE   | STORAGE ENGINE | NULL    | GPL     | 
| FEDERATED  | DISABLED | STORAGE ENGINE | NULL    | GPL     | 
| MEMORY     | ACTIVE   | STORAGE ENGINE | NULL    | GPL     | 
| InnoDB     | ACTIVE   | STORAGE ENGINE | NULL    | GPL     | 
| MyISAM     | ACTIVE   | STORAGE ENGINE | NULL    | GPL     | 
| MRG_MYISAM | ACTIVE   | STORAGE ENGINE | NULL    | GPL     | 
+------------+----------+----------------+---------+---------+
10 rows in set (0.00 sec)

Suggested fix:
Show error when doing plugin operations and --skip-grant-tables similar to UDFs such as:

ERROR xxxx (HY000): Can't initialize function 'hello_world'; plugins are unavailable with the --skip-grant-tables option
[22 Apr 2010 13:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/106364

3356 Staale Smedseng	2010-04-22
      Bug#46261 Plugins can be installed with --skip-grant-tables
      
      Previously installed dynamic plugins are explicitly not loaded
      on startup with --skip-grant-tables enabled. However, INSTALL
      PLUGIN/UNINSTALL PLUGIN commands are allowed, and result in
      inconsistent error messages (reporting duplicate plugin or
      plugin does not exist).
      
      This patch adds a check for --skip-grant-tables mode, and
      returns error ER_OPTION_PREVENTS_STATEMENT to the user when
      the above commands are attempted.
[5 May 2010 15:11] Bugs System
Pushed into 5.1.47 (revid:joro@sun.com-20100505145753-ivlt4hclbrjy8eye) (version source revid:staale.smedseng@sun.com-20100422135200-zve31ij6915adygk) (merge vers: 5.1.47) (pib:16)
[13 May 2010 0:25] Paul DuBois
Noted in 5.1.47 changelogs.

If the server is started with --skip-grant-tables, plugin loading and
unloading should be disallowed, but the server failed to reject
INSTALL PLUGIN and UNINSTALL PLUGIN statements.
[28 May 2010 5:48] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100524190136-egaq7e8zgkwb9aqi) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (pib:16)
[28 May 2010 6:18] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100524190941-nuudpx60if25wsvx) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[28 May 2010 6:45] Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100524185725-c8k5q7v60i5nix3t) (version source revid:alexey.kopytov@sun.com-20100429203306-tg0wz4y2xyx8edrl) (merge vers: 5.5.5-m3) (pib:16)
[29 May 2010 2:38] Paul DuBois
Noted in 5.5.5, 6.0.14 changelogs.
[17 Jun 2010 11:49] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 12:26] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 13:13] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)