[MDEV-11533] Roles with trailing white spaces are not cleared correctly Created: 2016-12-10  Updated: 2016-12-10  Resolved: 2016-12-10

Status: Closed
Project: MariaDB Server
Component/s: Authentication and Privilege System
Affects Version/s: 10.1
Fix Version/s: 10.0.29

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Vicențiu Ciorbaru
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-7069 Fix buildbot failures in main server ... Stalled

 Description   

http://buildbot.askmonty.org/buildbot/builders/kvm-deb-precise-x86/builds/4325/steps/test_5/logs/stdio

roles.create_and_grant_role              w2 [ fail ]
        Test ended at 2016-11-25 17:38:48
 
CURRENT_TEST: roles.create_and_grant_role
--- /usr/share/mysql/mysql-test/suite/roles/create_and_grant_role.result	2016-11-25 13:01:58.000000000 +0200
+++ /run/shm/var/2/log/create_and_grant_role.reject	2016-11-25 17:38:47.911410836 +0200
@@ -16,6 +16,7 @@
 GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
 GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
 GRANT USAGE ON *.* TO 'r1'
+GRANT foo   TO 'root'@'localhost' WITH ADMIN OPTION
 GRANT r1 TO 'root'@'localhost' WITH ADMIN OPTION
 drop role r1;
 select * from mysql.roles_mapping;
@@ -24,3 +25,4 @@
 Grants for root@localhost
 GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
 GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
+GRANT foo   TO 'root'@'localhost' WITH ADMIN OPTION
 
mysqltest: Result length mismatch

create role 'foo  ';
select concat(user, '__'), host from mysql.user;
select * from mysql.roles_mapping;
drop role foo;
select concat(user, '__'), host from mysql.user;
select * from mysql.roles_mapping;
--sorted_result
show grants;
 
 
-- Here we see
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
GRANT foo   TO 'root'@'localhost' WITH ADMIN OPTION

The tables are cleared correctly. The problem only lies within the internal data structures. Running flush privileges will fix the problem.



 Comments   
Comment by Vicențiu Ciorbaru [ 2016-12-10 ]

There is a dependency on a previous test:

With the commit hash 83f7151da5259fa07ab2c26600009d53adef50f3:

./mtr create_and_drop_role create_and_grant_role

the failure is reproduced.

Comment by Vicențiu Ciorbaru [ 2016-12-10 ]

Fixed with:
https://github.com/mariadb/server/commit/eb4f2e063c341d9f3644339c68cb01679e782001

Generated at Thu Feb 08 07:50:41 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.