Page MenuHomePhabricator

redirect loop error message suggests creating self-redirect instead
Closed, ResolvedPublicBUG REPORT

Description

This one comes out of a deliberate attempt to break the error messages on redirect creation, so is pretty low in priority:

Steps to replicate the issue:

  • Create a page, at [[Bar]].
  • Create a redirect, e.g. [[Foo]] → [[Bar]].
  • Edit [[Bar]], and try to change it to a redirect back to [[Foo]].

What happens?:

An error message is thrown to discourage creation of double redirect (T326056), but that message suggests that the page [[Bar]] be redirected to itself with #REDIRECT [[Bar]]. If you follow these instructions, it will then throw a self-redirect warning. This is potentially confusing.

What should have happened instead?:

  • On redirect creation, the redirect target of the target page ([[Bar]]) in the example above) should be checked to see if it's the page that's being edited (also [[Bar]] in the example above).
  • If this occurs, a different error message should be shown. Suggestion:

You are trying to redirect this page to a redirect back to itself, thus creating a non-functioning redirect loop. Please reconsider what you are doing. If you resubmit this, the redirect will be created anyway.

Software version:

MW ≥1.44

  • Notes**

Need to add an if condition to includes/editpage/Constraint/DoubleRedirectConstraint.php

Event Timeline

I've had a patch for this ready for a few days, however to avoid redundant code and further merge conflicts, it depends on https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1113875 (which refactors how the error message is generated), which itself has a merge conflict that cannot be fixed until another patch it depends on is merged. Is this important enough for me to still create a patch before the others are merged and possibly create merge conflicts or should I wait?

@SomeRandomDeveloper -- I don't think this is super important. I guess the thing to do is set a calendar reminder to look at it in 1-2 months' time.

Also, I've realised that this is also a special case of T385387, which is a different way to create a double redirect. We might need to think about how these fit together.

Change #1125651 had a related patch set uploaded (by SomeRandomDeveloper; author: SomeRandomDeveloper):

[mediawiki/core@master] Show a separate warning when attempting to create a redirect loop

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

Change #1125651 merged by jenkins-bot:

[mediawiki/core@master] Show a separate warning when attempting to create a redirect loop

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

Change #1148997 had a related patch set uploaded (by Bartosz Dziewoński; author: SomeRandomDeveloper):

[mediawiki/core@REL1_44] Show a separate warning when attempting to create a redirect loop

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

Change #1148997 merged by jenkins-bot:

[mediawiki/core@REL1_44] Show a separate warning when attempting to create a redirect loop

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

I backported this, since the warning was a new feature in 1.44.