Bug #4678 mysql-test-run fails on grant_cache
Submitted: 21 Jul 2004 17:24 Modified: 12 Aug 2004 13:19
Reporter: Arne Hüggenberg Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:mysql-4.1.4-beta-nightly-20040721 OS:Linux (gentoo amd64)
Assigned to: Guilhem Bichot CPU Architecture:Any

[21 Jul 2004 17:24] Arne Hüggenberg
Description:
System: 
Dual Opteron, Gentoo AMD64, gcc 3.3.4 
 
Configure Flags: --with-openssl --with-ndbcluster --with-ndb-shm --with-extra-charsets=complex 
 
Compiles sucessfully, but  
 
db2a mysql-test # ./mysql-test-run --force --with-ndbcluster 
<SNIP> 
grant_cache                    [ fail ] 
Errors are (from 
/usr/local/src/mysql-4.1.4-beta-nightly-20040721/mysql-test/var/log/mysqltest-time) : 
/usr/local/src/mysql-4.1.4-beta-nightly-20040721/client/.libs/mysqltest: At line 145: Result 
length mismatch 
(the last lines may be the most important ones) 
Below are the diffs between actual and expected results: 
------------------------------------------------------- 
*** r/grant_cache.result        Wed Jul 21 07:14:57 2004 
--- r/grant_cache.reject        Wed Jul 21 17:49:12 2004 
*************** 
*** 112,119 **** 
  Variable_name Value 
  Qcache_not_cached     1 
  show grants for current_user(); 
! Grants for @localhost 
! GRANT USAGE ON *.* TO ''@'localhost' 
  select "user2"; 
  user2 
  user2 
--- 112,119 ---- 
  Variable_name Value 
  Qcache_not_cached     1 
  show grants for current_user(); 
! Grants for root@localhost 
! GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION 
  select "user2"; 
  user2 
  user2 
<SNIP> 
 
 

How to repeat:
run mysql-test-run 
happens every time 
happens with nightly-20040719 too 
 

Suggested fix:
seems to me like the expected results are a bit off and the results file needs to be updated
[30 Jul 2004 10:46] Andrew Liles
I can confirm I get the same using mysql-4.1.3-beta on FreeBSD 5.2.1
[7 Aug 2004 22:27] Hartmut Holzgraefe
Can't reproduce this with latest 4.1 bitkeeper source on SuSE 9.0,
do you still experience this problem?
[9 Aug 2004 2:50] tomokazu hamada
I experience this problem using mysql-4.1.4-beta-nightly-20040808 on solaris9x86 with gcc 3.3.4
[9 Aug 2004 3:07] Carsten Beck
hello, I could reproduce the error reported testing a 4.1.3 compile: 

build: 4.1.3 beta

configure flags:
	--default-prefix=... 
	--enable-thread-safe-client
	--enable-assembler
	--with-comment
	--with-extra-charsets=all
	--with-openssl
	--with-openssl-includes=...
	--with-openssl-libs=...
	--with-vio

compiler: gcc 2.95.4

hardware: i686 (p2-400)

platform: debian 3 w/ kernel 2.4.25 #9

best ragards, carsten beck.
[10 Aug 2004 15:56] Arne Hüggenberg
still present with latest snapshot 
 
gentoo amd64, gcc 3.3.4 
 
 
grant_cache                    [ fail ] 
 
Errors are (from 
/usr/local/src/mysql-4.1.4-beta-nightly-20040809/mysql-test/var/log/mysqltest-time) : 
/usr/local/src/mysql-4.1.4-beta-nightly-20040809/client/.libs/mysqltest: At line 145: Result 
length mismatch 
(the last lines may be the most important ones) 
Below are the diffs between actual and expected results: 
------------------------------------------------------- 
*** r/grant_cache.result        Mon Aug  9 07:17:53 2004 
--- r/grant_cache.reject        Tue Aug 10 16:53:06 2004 
*************** 
*** 112,119 **** 
  Variable_name Value 
  Qcache_not_cached     1 
  show grants for current_user(); 
! Grants for @localhost 
! GRANT USAGE ON *.* TO ''@'localhost' 
  select "user2"; 
  user2 
  user2 
--- 112,119 ---- 
  Variable_name Value 
  Qcache_not_cached     1 
  show grants for current_user(); 
! Grants for root@localhost 
! GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION 
  select "user2"; 
  user2 
  user2
[11 Aug 2004 10:18] Guilhem Bichot
Hi,
any of you who have the failing test, could you please do, in the source tree where it fails:
tar cvzf bug4678.tar.gz mysql-test/var/master-data/mysql
and upload the tar.gz here (using the "Files" link) ?
Thanks!
[11 Aug 2004 10:19] Guilhem Bichot
I mean: run the tests, and when grant_cache fails and test suite stops, make the tar.gz and upload it.
This way we'll be able to verify if something is wrong in the 'mysql' system database used by  grant_cache.
[12 Aug 2004 8:06] Christopher Everett
Same problem, using a 4.1.3-beta on Debian unstable, linux 2.6.7, gcc 3.4.4, libc 2.3.2, AMD Athlon XP 2600+, compiled with --march=athlon-xp
[12 Aug 2004 8:10] Christopher Everett
I have the tar file you want, but clicking on the link to add a file in the Files tab puts me back in the View
tab.  Maddening!
[12 Aug 2004 10:15] Guilhem Bichot
Hi,
No worry, I got the file you uploaded; thanks.
I guess you are running mysql-test-run (or 'make test') as Unix user root ?
For your curiosity ;) here's what's happening: the test does
connect (unkuser,localhost,,,,$MASTER_MYPORT,master.sock);
connection unkuser;
show grants for current_user();
the first line says "connect as user '' ". In this case, the MySQL C API replaces the '' by the system user which is running the client (that's documented in our manual); in your case that's 'root'. And the grant tables indeed contain a user named 'root'. So MySQL finds it and assigns MySQL user root to the connection.
Usually when the test is run by another system user as 'root', for example 'guilhem', as the grant tables does not contain a MySQL user 'guilhem', MySQL does not find it and assigns the default user to the connection, i.e. '', so test succeeds.
To sum up, our test is a bit wrong so I'll apply this patch:
===== mysql-test/t/grant_cache.test 1.9 vs edited =====
70c70
< connect (unkuser,localhost,,,,$MASTER_MYPORT,master.sock);
---
> connect (unkuser,localhost,unkuser,,,$MASTER_MYPORT,master.sock);
I hope this will fix the failure at your site. Please let me know if it does not.
Thank you very much for your help.
[12 Aug 2004 13:19] Guilhem Bichot
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:

Fixed in
ChangeSet@1.1909.31.1, 2004-08-12 13:12:09+02:00, guilhem@mysql.com
[18 Aug 2004 14:27] Arne Hüggenberg
confirm fixed in latest snapshot