Another minor problem with T326056: Show a warning on creating double redirect:
Steps to replicate the issue:
- Wait until T395768: DoubleRedirectConstraint fails to re-validate when redirect target changes between redirect pages has been fixed (a patch has been submitted for review).
- Create a chain of redirects, [[Foo]] → [[Bar]] → [[Qux]]. Ignore any error messages that are thrown when doing this.
- The chain can loop back on itself.
- This is an extreme example, but is possible in a poorly-maintained wiki.
- Try to create a redirect to [[Foo]].
What happens?:
- Because Foo is a redirect, T326056: Show a warning on creating double redirect is thrown, and suggests redirect target of [[Bar]].
- If you follow the recommendation, then because Bar is also a redirect, but different, T395768: DoubleRedirectConstraint fails to re-validate when redirect target changes between redirect pages revalidates the checker, and now recommends a target of [[Qux]].
- This will continue until either.
- The end of the chain is reached
- The recommendations loops back on itself and produces an infinite loop.
Note that there's the potential (not yet realised, but wait for it) for a Javascript userscript/gadget automatically updating the target as recommended.
What should have happened instead?:
When [[Foo]] is a redirect to [[Bar]], DoubleRedirectConstraint needs to check that Bar is also not a redirect. If it is, the following error can be thrown:
You are attempting to create a redirect to a double redirect, which would create a redirect chain from {{1}} [i.e. this page] to {{2}} [in e.g. foo] to {{3}} [in e.g. bar] (and potentially further). Please reconsider your edit.
Note there is a similar problem when the target is a broken redirect. Another ticket: T396229: DoubleRedirectConstraint suggests non-existent target if first target was broken redirect.