Page MenuHomePhabricator

grabText.php - actor creation failure on invalid username
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):
Operating System Ubuntu 20.04
Software installed: Apache, MariaDB

  • Install mediawiki 1.39.5
  • Install Grabbers
  • run grabText.php on remote wiki

Per remote wiki's hostile policy, unable to disclose remote wiki's url until migrated wiki formally announces

What happens?:
ERROR: CannotCreateActorException from line 622 of ActorStore.php: Cannot create an actor for a user with no name: user_id=0 user_name="3403151"

What should have happened instead?:
This should not have occurred and all text revisions should have copied correctly without error.
Compliance to erase accounts under GDPR is possibly causing unintended corruption.

Software version (skip for WMF-hosted wikis like Wikipedia): 1.39.5

Event Timeline

Change 991976 had a related patch set uploaded (by Martineznovo; author: Martineznovo):

[mediawiki/tools/grabbers@master] Check for invalid user names with id

https://gerrit.wikimedia.org/r/991976

Ciencia_Al_Poder changed the task status from Open to In Progress.Jan 21 2024, 8:32 PM
Ciencia_Al_Poder claimed this task.
Ciencia_Al_Poder triaged this task as Medium priority.

tested the patch, unfortunately did not resolve issue. The failure occurs on namespace 2 [User].

Inserting revision 298805
CannotCreateActorException from line 622 of /var/www/html/w/includes/user/ActorStore.php: Cannot create an actor for a user with no name: user_id=0 user_name="
        3403151"
#0 /var/www/html/w/includes/user/ActorStore.php(400): MediaWiki\User\ActorStore->validateActorForInsertion()
#1 /var/www/html/w/grabbers/includes/ExternalWikiGrabber.php(196): MediaWiki\User\ActorStore->acquireActorId()
#2 /var/www/html/w/grabbers/includes/TextGrabber.php(157): ExternalWikiGrabber->getUserIdentity()
#3 /var/www/html/w/grabbers/grabText.php(283): TextGrabber->processRevision()
#4 /var/www/html/w/grabbers/grabText.php(131): GrabText->processPage()
#5 /var/www/html/w/grabbers/grabText.php(94): GrabText->processPagesFromNamespace()
#6 /var/www/html/w/maintenance/includes/MaintenanceRunner.php(309): GrabText->execute()
#7 /var/www/html/w/maintenance/doMaintenance.php(85): MediaWiki\Maintenance\MaintenanceRunner->run()
#8 /var/www/html/w/grabbers/grabText.php(344): require_once('/var/www/html/w...')
#9 {main}

I did discover a workaround for this bug, make modifications to includes/user/ActorStore.php
import use MediaWiki\User\UserRigorOptions ;

within public function normalizeUserName on line 601: $normalized = $this->userNameUtils->getCanonical( $name, UserRigorOptions::RIGOR_NONE );

I've updated the patch and it should catch those corner cases, because I'm using the same logic as normalizeUserName from ActorStore

I can confirm the updated patch worked without error. You can issue a request to merge the patch. Thanks again for taking a second look.

Change 991976 merged by Martineznovo:

[mediawiki/tools/grabbers@master] Check for invalid user names with id

https://gerrit.wikimedia.org/r/991976