Page MenuHomePhabricator

DRTRIGON-112 subster_irc bot forgets wiki login when accessing other mediawiki project
Closed, ResolvedPublic

Description

This issue was converted from https://jira.toolserver.org/browse/DRTRIGON-112.
Summary: subster_irc bot forgets wiki login when accessing other mediawiki project
Issue type: Bug - A problem which impairs or prevents the functions of the product.
Priority: Major
Status: Closed
Assignee: drtrigon <dr.trigon@surfeu.ch>


From: drtrigon <dr.trigon@surfeu.ch>

Date: Tue, 17 Jan 2012 19:06:41

When looking at the logfile from 2012-01-17 for following comments and later:

2012-01-17 19:44:36,744 bot_control INFO Password for user DrTrigonBot on wikipedia:de:

the subster bot (may be just when used by subster_irc...?!?) asks for the wiki password.
(look also at difflink in URL - which triggered the error in the logfile)

We have to protect the bot from logging out when accessing foreign wikis!


Version: unspecified
Severity: major

Details

Reference
bz59507

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:35 AM
bzimport set Reference to bz59507.

From: drtrigon <dr.trigon@surfeu.ch>

Date: Fri, 20 Jan 2012 10:09:29

This does not apply when accessing the same external wikis by API, as can be seen in [1].

[1] http://de.wikipedia.org/w/index.php?title=Benutzer:DrTrigon/Spielwiese&diff=98597085&oldid=98597019&diffonly=0


From: drtrigon <dr.trigon@surfeu.ch>

Date: Sat, 28 Jan 2012 14:06:11

A possible solution or work-a-round for this problem is to use 'site._load(force=True)' to re-login e.g.

external_buffer = self.site.getUrl(param['url'], no_hostname = True)
if self.site.loggedInAs() is None: self.site._load(force=True)

From: drtrigon <dr.trigon@surfeu.ch>

Date: Sat, 28 Jan 2012 14:42:47

This (work-a-round) was implemented in r259.


From: drtrigon <dr.trigon@surfeu.ch>

Date: Sat, 28 Jan 2012 15:06:39

Critical -> Major

The bug is solved (work-a-round) but since subster_irc runs multi-threaded it is still possible that on thread tries to write in between 'getUrl' and '_load' from other thread and thus will raise and error. Thus the whole logout should be prevented and not happen at all!


From: drtrigon <dr.trigon@surfeu.ch>

Date: Mon, 30 Jan 2012 10:33:23

Started the discussion on the list, look at http://lists.wikimedia.org/pipermail/pywikipedia-l/2012-January/007182.html

From that it seems to be hard to find a consensus since in fact I am "abusing" the function here. But a very slight modification to the function would solve all problems... Thus there has to be a useful consensus...


From: drtrigon <dr.trigon@surfeu.ch>

Date: Wed, 01 Feb 2012 16:32:36

Re-merge with pywikipedia framework (increase to v1.2) and solve the problem as worked out on maillist. Create a new generic getUrl function (from old one in site class) and specialize it into the one in site class. Similar to the solution in rewrite.

May be this has to be discussed further with Merlijn (valhallasw) since from rewrite it seams to me that it could be impossible to separate into the whished 2 functions... but let's solve this later... ![][1]

[1]: https://jira.toolserver.org/images/icons/emoticons/wink.gif

From: drtrigon <dr.trigon@surfeu.ch>

Date: Sun, 05 Feb 2012 02:19:57

Another issue - may be related, may be not (but can be solved in same session, since hast to be done upstream) is the fact that the framework seems to have trouble handling e.g. arwiki. 'live_version' has a bug there (raises an error) and also login seems to be problematic because of:

2012-02-05 02:11:17,512 bot_control          INFO     WARNING: Your account on wikipedia:ar is blocked by False.
2012-02-05 02:11:17,512 bot_control          INFO     Reason: أيبي التول سيرفر
2012-02-05 02:11:17,512 bot_control          INFO     Editing using this account will stop the run.

The first issue was worked-a-round by skipping this request for 'ar' in r261.


From: drtrigon <dr.trigon@surfeu.ch>

Date: Thu, 16 Feb 2012 20:49:55

The work-a-round was removed because of fix of 'live_version' upstream in r8900. Done in r269.


From: drtrigon <dr.trigon@surfeu.ch>

Date: Thu, 16 Feb 2012 22:58:18

updated analogue to rewrite; 'getUrl' moved/splitted to 'pywikibot.comms.http.request'
the generic one does not attempt to (re)login on the target if it is a wiki

upstream r9901.

Ported and done in r270.

This bug was imported as RESOLVED. The original assignee has therefore not been
set, and the original reporters/responders have not been added as CC, to
prevent bugspam.

If you re-open this bug, please consider adding these people to the CC list:
Original assignee: dr.trigon@surfeu.ch
CC list: dr.trigon@surfeu.ch