Last modified: 2013-09-04 10:36:21 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T30917, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 28917 - Install seems to try to GRANT when not necessary
Install seems to try to GRANT when not necessary
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Installer (Other open bugs)
1.17.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-10 20:46 UTC by Mike Kelly
Modified: 2013-09-04 10:36 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Mike Kelly 2011-05-10 20:46:36 UTC
I've tried testing out installing MediaWiki 1.17.0beta1 in an environment where the database has been created, using a user that already exists with privileges to use the database, but not to grant use to anyone else. I've entered the same username & password for both the "Install" database user and the regular database user (as in, I selected the "use the same user" radio button). However, my install ends up failing with this error:

Granting permission to user "testuser" failed: A database query syntax error has occurred. The last attempted database query was: "GRANT ALL PRIVILEGES ON `testuser_mediawiki`.* TO 'testuser'@'db.example.com'" from within function "MysqlInstaller::setupUser". Database returned error "1044: Access denied for user 'testuser'@'%' to database 'testuser_mediawiki' (db.example.com)" Backtrace:

    0 /www/testuser/mediawiki-test/includes/db/Database.php(751): DatabaseBase->reportQueryError('Access denied f...', 1044, 'GRANT ALL PRIVI...', 'MysqlInstaller:...', false)
    1 /www/testuser/mediawiki-test/includes/installer/MysqlInstaller.php(503): DatabaseBase->query('GRANT ALL PRIVI...', 'MysqlInstaller:...')
    2 [internal function]: MysqlInstaller->setupUser(Object(MysqlInstaller))
    3 /www/testuser/mediawiki-test/includes/installer/Installer.php(1293): call_user_func(Array, Object(MysqlInstaller))
    4 /www/testuser/mediawiki-test/includes/installer/WebInstallerPage.php(1084): Installer->performInstallation(Array, Array)
    5 /www/testuser/mediawiki-test/includes/installer/WebInstaller.php(246): WebInstaller_Install->execute()
    6 /www/testuser/mediawiki-test/mw-config/index.php(46): WebInstaller->execute(Array)
    7 /www/testuser/mediawiki-test/mw-config/index.php(14): wfInstallerMain()
    8 {main}

So, even though it is seeming to use the user that I entered, it seems to want to try to grant privileges to use the database that it's already connected to to itself, which seems silly.

I tried tracing through the code in /includes/installer/MysqlInstaller.php's canCreateAccounts(), but I can't see why it would think this user would be able to create an account.

I think that I might see the problem:

452                 } else {
453                         $grantableNames[] = $this->buildFullUserName( $dbUser, $server );
454                         $tryToCreate = false;
455                 }

So, that means that it will try to grant privileges to itself, in this case, at least as far as I can tell. Maybe the code should specifically check to see if the $this->getVar('_InstallUser') equals $this->getVar('wgDBuser') and just return early from setupUser()
Comment 1 Chad H. 2011-05-10 21:01:57 UTC
I already do check for that case and return early. The first few lines of setupAccounts() are:

$dbUser = $this->getVar( 'wgDBuser' );
if( $dbUser == $this->getVar( '_InstallUser' ) ) {
	return Status::newGood();
}
Comment 2 Chad H. 2011-05-10 21:02:57 UTC
Grrr, my mistake, it never got merged to 1.17 from trunk.
Comment 3 Chad H. 2011-05-10 21:04:07 UTC
See r87512, that should fix it.
Comment 4 Mike Kelly 2011-05-10 21:07:58 UTC
(In reply to comment #3)
> See r87512, that should fix it.

Thanks, I'll give that a try.
Comment 5 Mark A. Hershberger 2011-05-11 19:37:11 UTC
marking this resolved for now, reopen if the diff doesn't fix it

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links