Page MenuHomePhabricator

Display error when user tries to create a circular redirect (self-redirect)
Closed, ResolvedPublic

Description

I accidentally created a redirect recently at page "Foo" containing the text "#REDIRECT [[Foo]]". I was tired and it took me a few minutes to realize I'd screwed up. Ideally, this type of error would be caught by MediaWiki on page save.

See Also: T12963

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:32 PM
bzimport set Reference to bz27683.
bzimport added a subscriber: Unknown Object (MLST).

jp.posma wrote:

The view that you get when visiting [[Foo]] quite clearly shows the mistake:

Foo

(Redirected from Foo)
-> Foo

I don't think we can and should protect from every possible mistake caused by tiredness. ;)

(In reply to comment #1)

I don't think we can and should protect from every possible mistake caused by
tiredness. ;)

In fact, this one seems to already have adequate protection.

(In reply to comment #2)

(In reply to comment #1)

I don't think we can and should protect from every possible mistake caused by
tiredness. ;)

In fact, this one seems to already have adequate protection.

What do you mean by protection?

I don't think there's a ever a reason to allow this behavior. (The fact that making a redirect needs a proper input form is a separate issue.) There should be a warning at least here, though I don't see any problem with an outright ban.

In general, I'm in favor of MediaWiki being more descriptive about things that don't work. This is already somewhat implemented for things such as broken references (they're categorized and have a visible error message), but there should be a larger set of changes made to make MediaWiki less obscure and confusing. This is part of that.

Perhaps linking this bug to a bug about implementing a proper UI for creating a redirect makes sense. I think any redirect-making input form would catch this type of error, but it makes less sense in the current giant textarea mode.

(In reply to comment #3)

(In reply to comment #2)

In fact, this one seems to already have adequate protection.

What do you mean by protection?

I mean, MW doesn't end up in an infinite loop. It does have a silly redirect, but that is pretty minor.

Perhaps linking this bug to a bug about implementing a proper UI for creating a
redirect makes sense.

I'm not against doing that if you know of such a bug.

(In reply to comment #4)

(In reply to comment #3)

(In reply to comment #2)

In fact, this one seems to already have adequate protection.

What do you mean by protection?

I mean, MW doesn't end up in an infinite loop. It does have a silly redirect,
but that is pretty minor.

Well, yeah. But I think the goal should be a bit loftier than "doesn't completely explode." ;-)

Perhaps linking this bug to a bug about implementing a proper UI for creating a
redirect makes sense.

I'm not against doing that if you know of such a bug.

The closest bug that I know of off-hand is bug 27311, but that is more specific to page creation (i.e., pages with content, not redirects). Perhaps a separate bug is needed for a "create a redirect" UI in core (there are already extensions that can do this).

  • Bug 34932 has been marked as a duplicate of this bug. ***

(In reply to comment #7)

Another example:
<https://meta.wikimedia.org/w/index.
php?title=Wikimedia_user_group&oldid=5413973>.

Just happened to me. The annoying thing about having no error is that it's hard for either the creator (who thought they were doing something else) or a patroller (unless they followed a link to the page and see that it goes nowhere) to catch.

https://en.wikipedia.org/w/index.php?title=National_Labor_Relations_Board_v._Canning&oldid=614106762

I don't think catching self-redirects should be very difficult to do. I've marked this bug with the "easy" keyword accordingly.

We could just append a red error message at the end of the redirect page, like we usually do for invalid constructs.

Another idea to display the error is on page save, like:

  • When you don't provide a edit summary and you have "forceeditsummary" turned on in your preferences.
  • When you get a warning about possible lost session (token mismatch)
  • When your edit matches an Abuse filter rule.

You get a warning, and the page is not saved: you're still in the edit area. But you can press the save button again to save it permanently. That lets you realize about the problem before actually saving the edit.

Just for reference, MediaWiki already contains "don't shoot yourself in the foot" behavior; e.g., https://www.mediawiki.org/wiki/MediaWiki:Ipb-blockingself. :-)

Would the internalAttemptSave() function in includes/EditPage.php be an appropriate place to add this check, with the resulting error being displayed in handleStatus()?

Change 178238 had a related patch set uploaded (by M4tx):
Display error when user tries to create self-redirect

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

Patch-For-Review

matmarex assigned this task to m4tx.
matmarex removed a project: Patch-For-Review.
matmarex set Security to None.
matmarex removed a subscriber: Unknown Object (MLST).

Change 178238 merged by jenkins-bot:
Display error when user tries to create self-redirect

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

Hah, I missed that this task had been resolved. I just tried to create a self-redirect on the English Wikipedia (yet again) and hit this warning. Excellent work, everyone! :D