Last modified: 2012-07-18 01:53:50 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 T38987, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36987 - List allpages has endless loop with case-sensitive titles, apfrom broken
List allpages has endless loop with case-sensitive titles, apfrom broken
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
http://wiki.ubuntu.com.cn/api.php?act...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-20 10:48 UTC by Nemo
Modified: 2012-07-18 01:53 UTC (History)
7 users (show)

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


Attachments
XML http://wiki.ubuntu.com.cn/api.php?action=query&list=allpages&apnamespace=101&aplimit=500&apfrom=Wiki/BugReports&format=xml (29.06 KB, application/xml)
2012-05-20 10:48 UTC, Nemo
Details

Description Nemo 2012-05-20 10:48:12 UTC
Created attachment 10629 [details]
XML http://wiki.ubuntu.com.cn/api.php?action=query&list=allpages&apnamespace=101&aplimit=500&apfrom=Wiki/BugReports&format=xml

The URL gives <allpages apfrom="Wiki/BugReports" /> although this is the page I'm supposed to start from: the first row is <p pageid="34776" ns="101" title="UbuntuWiki:Wiki/FrontPage" /> and the last <p pageid="11237" ns="101" title="UbuntuWiki:wiki" />, perhaps a case-sensitivity problem.
Comment 1 Sam Reed (reedy) 2012-05-20 23:05:29 UTC
It's using MediaWiki 1.15.3, which isn't a supported version

Fine on stable releases (1.17 onwards)
Comment 2 Nemo 2012-05-20 23:38:21 UTC
Note (after chat with Reedy): we don't actually know what's the origin of the problem nor if it's actually been fixed or not in later releases.
I'll try divination to reproduce the bug elsewhere. ;)
Comment 3 Brad Jorsch 2012-05-21 00:23:37 UTC
I think this bug may still occur, even in git master. But to see the bug, you need a wiki where namespace 0 is set for case-insensitivity on the first letter (which means titles will automatically be transformed to have an uppercase first letter) and the namespace being processed has pages with a lowercase first letter.

What appears to be happening is that the API is trying to return a continuation for the page "UbuntuWiki:wiki/BugReports" (page id 11238 on that wiki). But the API just passes "wiki/BugReports" without the namespace prefix in the continuation parameter, and it also feeds it through the Title class to "normalize" the title. Title (of course) treats the text as a title in namespace 0 and therefore uppercases the first letter as part of that normalization, so the continuation parameter comes out as "Wiki/BugReports" instead. Which leads to an endless loop, as "Wiki/BugReports" sorts 500 pages earlier than "wiki/BugReports".

This vaguely resembles bug 29290, and if I'm right the fix should be similar: don't try to normalize the value passed through the continue parameter. We should probably review all API continuation parameters to ensure this incorrect normalization is not going on.
Comment 4 Nemo 2012-05-21 05:09:11 UTC
So, if your hypothesis is correct, what would the steps be to reproduce this bug on another wiki?
Comment 5 Brad Jorsch 2012-05-21 12:55:00 UTC
You'd have to somehow set up the conditions I mentioned: have namespace 0 be case-insensitive on the first letter, and the target namespace have titles beginning with a lowercase letter (i.e. the target namespace be case-sensitive, or insert impossible titles into the database for the target namespace). 

Then you construct an API allpages query with an appropriate apfrom and aplimit so that the continuation is supposed to be a page with a lowercase title, and it will be output with an uppercase title instead.


For example, I just created a "Foo" namespace on my local test wiki with this configuration:

$wgExtraNamespaces[500] = "Foo";
$wgExtraNamespaces[501] = "Foo_talk";
$wgCapitalLinkOverrides[500] = false;
$wgCapitalLinkOverrides[501] = false;

Then I created pages Foo:A through Foo:Z and Foo:a through Foo:z, and a query like http://localhost/w/api.php?action=query&list=allpages&apnamespace=500&apfrom=Y&aplimit=4 gives me a continuation of "C" rather than "c".
Comment 6 Nemo 2012-05-21 14:57:19 UTC
Looks confirmed then, what version is your wiki?
Comment 7 Brad Jorsch 2012-05-21 17:05:06 UTC
Git master as of sometime this morning. I'll post a Gerrit changeset that cleans up this issue in something like 14 core API modules in a few hours.
Comment 8 Brad Jorsch 2012-05-21 20:57:19 UTC
Gerrit change #8407

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


Navigation
Links