Last modified: 2013-07-25 07:07:08 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 T43689, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 41689 - Internal error when changing a user talk page
Internal error when changing a user talk page
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Echo (Other open bugs)
unspecified
All All
: High normal (vote)
: ---
Assigned To: Erik Bernhardson
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-02 13:33 UTC by Alex Monk
Modified: 2013-07-25 07:07 UTC (History)
5 users (show)

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


Attachments

Description Alex Monk 2012-11-02 13:33:59 UTC
When trying to edit a user talk page I'm getting an error.
I've never actually run this on a Windows machine until now, so that might be part of the issue.

(I got a very similar error last night which I pasted here: http://pastebin.com/raw.php?i=mz5HGjMf )

Right offset consistency error.
Offset: 60
Expected: 
Actual: 
Backtrace:
#0 C:\xampp\htdocs\MediaWiki\Git\extensions\Echo\includes\DiscussionParser.php(133): EchoDiscussionParser::getMachineReadableDiff('== Test ==??Tes...', '== Test ==??Tes...')
#1 C:\xampp\htdocs\MediaWiki\Git\extensions\Echo\includes\DiscussionParser.php(16): EchoDiscussionParser::getChangeInterpretationForRevision(Object(Revision))
#2 C:\xampp\htdocs\MediaWiki\Git\extensions\Echo\Hooks.php(196): EchoDiscussionParser::generateEventsForRevision(Object(Revision))
#3 [internal function]: EchoHooks::onArticleSaved(Object(WikiPage), Object(User), '== Test ==??Tes...', '/* Test */ new ...', 0, NULL, NULL, 98, Object(Revision), Object(Status), false)
#4 C:\xampp\htdocs\MediaWiki\Git\core\includes\Hooks.php(253): call_user_func_array('EchoHooks::onAr...', Array)
#5 C:\xampp\htdocs\MediaWiki\Git\core\includes\GlobalFunctions.php(3811): Hooks::run('ArticleSaveComp...', Array)
#6 C:\xampp\htdocs\MediaWiki\Git\core\includes\content\ContentHandler.php(1081): wfRunHooks('ArticleSaveComp...', Array)
#7 C:\xampp\htdocs\MediaWiki\Git\core\includes\WikiPage.php(1898): ContentHandler::runLegacyHooks('ArticleSaveComp...', Array)
#8 [internal function]: WikiPage->doEditContent(Object(WikitextContent), '/* Test */ new ...', 98, false, NULL, 'text/x-wiki')
#9 C:\xampp\htdocs\MediaWiki\Git\core\includes\Article.php(1937): call_user_func_array(Array, Array)
#10 C:\xampp\htdocs\MediaWiki\Git\core\includes\EditPage.php(1608): Article->__call('doEditContent', Array)
#11 C:\xampp\htdocs\MediaWiki\Git\core\includes\EditPage.php(1608): Article->doEditContent(Object(WikitextContent), '/* Test */ new ...', 98, false, NULL, 'text/x-wiki')
#12 C:\xampp\htdocs\MediaWiki\Git\core\includes\EditPage.php(1115): EditPage->internalAttemptSave(Array, false)
#13 C:\xampp\htdocs\MediaWiki\Git\core\includes\EditPage.php(396): EditPage->attemptSave()
#14 C:\xampp\htdocs\MediaWiki\Git\core\includes\actions\EditAction.php(51): EditPage->edit()
#15 C:\xampp\htdocs\MediaWiki\Git\core\includes\actions\EditAction.php(71): EditAction->show()
#16 C:\xampp\htdocs\MediaWiki\Git\core\includes\Wiki.php(429): SubmitAction->show()
#17 C:\xampp\htdocs\MediaWiki\Git\core\includes\Wiki.php(305): MediaWiki->performAction(Object(Article), Object(Title))
#18 C:\xampp\htdocs\MediaWiki\Git\core\includes\Wiki.php(555): MediaWiki->performRequest()
#19 C:\xampp\htdocs\MediaWiki\Git\core\includes\Wiki.php(448): MediaWiki->main()
#20 C:\xampp\htdocs\MediaWiki\Git\core\index.php(59): MediaWiki->run()
#21 {main}
Comment 1 Alex Monk 2012-11-02 15:11:09 UTC
It looks like "actual" always seem to begin with a space which is not in "expected"... Changing $added_line and $subtracted_line to substr with 2 instead of 1 appears to fix it. (subtracted_line to fix basically the same problem but with line removal)
Comment 2 Alex Monk 2012-11-03 20:20:08 UTC
This fix needs to be tested on other machines, I can't do so at the moment:

diff --git a/includes/DiscussionParser.php b/includes/DiscussionParser.php
index d8694ea..0064135 100644
--- a/includes/DiscussionParser.php
+++ b/includes/DiscussionParser.php
@@ -481,7 +481,7 @@ abstract class EchoDiscussionParser {
                                list( $right_pos ) = explode( ',', $rhs_pos );
                                $change_run = false;
                        } elseif ( $line_type == '-' ) {
-                               $subtracted_line = substr( $line, 1 );
+                               $subtracted_line = substr( $line, 2 );

                                if ( trim( $subtracted_line ) === '' ) {
                                        ++$left_pos;
@@ -508,7 +508,7 @@ abstract class EchoDiscussionParser {
                                }
                                ++$left_pos;
                        } elseif ( $line_type == '+' ) {
-                               $added_line = substr( $line, 1 );
+                               $added_line = substr( $line, 2 );

                                if ( $change_run !== false && $changes[$change_run]['action'] == 'add' ) {
                                        $changes[$change_run]['content'] .= "\n" . $added_line;
Comment 3 bsitu 2012-11-05 18:11:23 UTC
This change would cause the same error on linux machine. I am wondering if it has something to do with the diffutils in window machine.
Comment 4 Alex Monk 2012-11-05 18:17:36 UTC
Hm yep, confirmed that the patch makes the previously working machine break with a similar error. -.-
Comment 5 Nischay Nahata 2013-04-14 10:19:10 UTC
Was about to post a duplicate bug. I can help testing on Windows.

Increasing some priority as this prevents me from testing other bugs on Win.
Comment 6 Ryan Kaldari 2013-04-15 17:39:12 UTC
Thanks Nischay! Since I'm on OSX, I can't help much here.
Comment 7 Erik Bernhardson 2013-04-24 23:19:05 UTC
Dug through this today, the problem is actually only tangentially related to windows.

Basically the most likely thing on windows is the gnu diff is not installed.  MediaWiki contains Diff and UnifiedDiffFormatter classes to perform the diff in pure php.  The output of UnifiedDiffFormatter does not match the output of gnu diff on my linux box, specifically:

GNU diffutils 3.2:

@@ -1,4 +1,4 @@
 line 1
-line 2
+line b
 line 3
 line 4



MediaWiki Internal Diff:

@@ -1,4 +1,4 @@
  line 1
- line 2
+ line b
  line 3
  line 4


I see two possible solutions, but not sure which is more appropriate:

1) Update UnifiedDiffFormatter to match the output of GNU diffutils 3.2.  I worry that wfDiff() which calls the formatter is used in a variety of places, could break other things

Really option 1 seems like the only appropriate solution, but if we dont want to change UnifiedDiffFormatter we can:

2) apply some heuristics to assume that if the second character of every line is a space, that it came from UnifiedDiffFormatter in which case we would strip that line out before processing further.  Thats a horrible hack

I can code up either solution, but need some guidence on which is appropriate
Comment 8 Erik Bernhardson 2013-04-24 23:33:26 UTC
Also the temporary fix until we decide on the right solution is for anyone on windows is to install GNU diff ( see http://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_Windows#Diffutils ) for windows.  I've tested on windows and as long as its using GNU diff windows works just fine.
Comment 9 Gerrit Notification Bot 2013-04-29 23:31:18 UTC
Related URL: https://gerrit.wikimedia.org/r/61514 (Gerrit Change Ib83cacab41adfbdfa8e122c0494b266d4caefc83)
Comment 10 Alex Monk 2013-05-20 20:06:36 UTC
Merged by Kaldari.

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


Navigation
Links