Bug #13504 CREATE DEFINER=... VIEW causes server failure when run with --skip-grant-tables
Submitted: 26 Sep 2005 21:39 Modified: 19 Oct 2005 14:43
Reporter: Sergey Petrunya Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0-bk OS:Linux (Linux)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[26 Sep 2005 21:39] Sergey Petrunya
Description:
CREATE DEFINER='user'@'host' VIEW .... 
causes server failure if the server is started with --skip-grant-tables option.

How to repeat:
Start the server --skip-grant-tables option
Run the following statements:
create table t1 (a int);
create definer='user'@'host' sql security definer view v1 as select * from t1;

See the server to fail:

Got error 22 when trying to lock mutex at sql_acl.cc, line 1490
Program received signal SIGABRT, Aborted.
  #0  0xb7dff3d1 in kill () from /lib/libc.so.6
  #1  0xb7f5d131 in pthread_kill () from /lib/libpthread.so.0
  #2  0xb7f5d4ab in raise () from /lib/libpthread.so.0
  #3  0xb7dff164 in raise () from /lib/libc.so.6
  #4  0xb7e0063d in abort () from /lib/libc.so.6
  #5  0x084137f2 in safe_mutex_lock (mp=0x8c689bc, file=0x84bc7a0 "sql_acl.cc", line=1490) at thr_mutex.c:122
  #6  0x0823e094 in is_acl_user (host=0x8c8b2f8 "bb", user=0x8c8b2e8 "aa") at sql_acl.cc:1490
  #7  0x082d50b7 in mysql_create_view (thd=0x8c68a50, mode=VIEW_CREATE_NEW) at sql_view.cc:232
  #8  0x081b4063 in mysql_execute_command (thd=0x8c68a50) at sql_parse.cc:4497
  #9  0x081b6a43 in mysql_parse (thd=0x8c68a50, inBuf=0x8c8b260 "create definer='aa'@'bb'sql security definer view v1 as select * from t1", length=73) at sql_parse.cc:5507
  #10 0x081abe5b in dispatch_command (command=COM_QUERY, thd=0x8c68a50, packet=0x8c82571 "create definer='aa'@'bb'sql security definer view v1 as select * from t1", packet_length=74) at sql_parse.cc:1685
  #11 0x081ab648 in do_command (thd=0x8c68a50) at sql_parse.cc:1486
  #12 0x081aa725 in handle_one_connection (arg=0x8c68a50) at sql_parse.cc:1137
  #13 0xb7f5a13d in pthread_start_thread () from /lib/libpthread.so.0
  #14 0xb7f5a2e2 in pthread_start_thread_event () from /lib/libpthread.so.0
  #15 0xb7e8c07a in clone () from /lib/libc.so.6
(gdb)
[26 Sep 2005 21:40] Sergey Petrunya
CREATE VIEW without DEFINER clause fails with an error when the server is started with --skip-grant-tables.
[26 Sep 2005 21:41] Sergey Petrunya
Assinging to Dmitri as he said on IRC he will look into this tomorrow morning.
[14 Oct 2005 12:17] 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/internals/31110
[18 Oct 2005 18:44] 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/internals/31226
[18 Oct 2005 21:24] Oleksandr Byelkin
thank you for bugreport!
pushed to 5.0.15
[19 Oct 2005 14:43] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Documented fix in 5.0.15 changelong. Closed.