Page MenuHomePhabricator

InconsistentTitleError when calling isRedirectPage on IPv6 anon user talk pages
Closed, ResolvedPublicBUG REPORT


Code snippet to reproduce

def repro_ipv6_crash() -> None:
    user = pywikibot.User(pywikibot.Site(), '2600:1700:5b20:da0:98b2:b6b4:c36e:62bf')
    page_usertalk = user.getUserTalkPage()

List of steps to reproduce (step by step, including full links if applicable):

  1. Run the above code snippet with a bot setup for English Wikipedia

What happens?: Crash

  File "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/page/", line 768, in isRedirectPage
  File "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/site/", line 1318, in page_isredirect
  File "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/site/", line 1228, in loadpageinfo
    self._update_page(page, query)
  File "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/site/", line 1201, in _update_page
    raise InconsistentTitleError(page, pageitem['title'])
pywikibot.exceptions.InconsistentTitleError: Query on [[en:User talk:2600:1700:5b20:da0:98b2:b6b4:c36e:62bf]] returned data on 'User talk:2600:1700:5B20:DA0:98B2:B6B4:C36E:62BF'
CRITICAL: Exiting due to uncaught exception <class 'pywikibot.exceptions.InconsistentTitleError'>

What should have happened instead?: No crash.

Event Timeline

Xqt triaged this task as High priority.Apr 16 2022, 5:30 AM

Change 783444 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [bugfix] use uppercased IP user titles

Change 783444 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] use uppercased IP user titles

This reminds me of T326996.

I took a quick look at the patch. As a general comment, I'd rather see all IP address comparisons done by creating IPv4Address or IPv6Address objects from the stdlib and comparing those. That would be simpler and more future-proof than scattering textual manipulations like t.upper() around the pywiki code.