Last modified: 2009-02-28 19:16:21 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 T12266, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 10266 - rebuildLanguage.php bug with newlines
rebuildLanguage.php bug with newlines
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
Depends on:
Blocks: 12170
  Show dependency treegraph
 
Reported: 2007-06-15 00:05 UTC by Huji
Modified: 2009-02-28 19:16 UTC (History)
2 users (show)

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


Attachments
Update to rebuildLanguage system (522 bytes, patch)
2007-06-15 00:05 UTC, Huji
Details
Update to rebuildLanguage system (523 bytes, patch)
2007-06-15 00:07 UTC, Huji
Details
Fixed the issues in previous patch (521 bytes, patch)
2007-06-15 07:15 UTC, Huji
Details

Description Huji 2007-06-15 00:05:19 UTC
Created attachment 3771 [details]
Update to rebuildLanguage system

I experienced this bug a few times today, when I edited a MessagesXX.php file in Windows environment, then used rebuildLanguage.php and after that, the final messages file contained both Linux (\n) and Windows (\r\n) line endings in it. Because of this, svn could not create a patch file.

I figured that I can create a very tiny PHP file for myself, that would replace all \r\n combinations with \n (that is to convert all line endings to Linux type). This way, the above problem was sovled.

I believed there would be no harm in updating rebuildLangauges system in a way that it would perform that operation prior to writing the messages to the file, so I created a patch for that.
Comment 1 Huji 2007-06-15 00:07:13 UTC
Created attachment 3772 [details]
Update to rebuildLanguage system

fixed a typo
Comment 2 Huji 2007-06-15 07:15:20 UTC
Created attachment 3774 [details]
Fixed the issues in previous patch

Fixed the issues in previous patch. It still needs being reviewed.
Comment 3 Brion Vibber 2007-06-15 18:09:31 UTC
The sensible thing is probably to:
a) Normalize \r\n to \n on input
b) Normalize \n to the local newline sequence on output

You could use the PHP_EOL constant (available since PHP 5.0.2), or try detecting it from the source file for consistency.
Comment 4 Huji 2007-06-16 08:25:27 UTC
Well I didn't understand what you are concerned about in the (b) section. Could you please give an example?
Comment 5 Raimond Spekking 2007-07-30 16:24:43 UTC
Fixed with r24423 by Rotem.
Comment 6 Huji 2007-07-30 16:49:36 UTC
Raimond,

I'm not sure if r24423 is what I actually meant here. I think what Brion said is a better idea: To change all \r\n to \n. Then to change them back to the local newline sequence (this second part is not necessary). The benefit is, if the file contains a mixture of \n newlines and \r\n newlines, they will be all made similar.
Comment 7 Raimond Spekking 2007-07-30 16:55:21 UTC
Hmmm maybe...

In the past I got SVN commit errors after running rebuildLanguage.php due to a mixture of newlines. With r24423 SVN doesn't whine anymore :)

Ok, let's check again :)
Comment 8 Huji 2007-07-30 17:03:50 UTC
Good idea. I may test it later on as well, when I manage to translate some of the new messages for MessagesFa.
Comment 9 Raimond Spekking 2009-02-28 19:16:21 UTC
seems fixed a while ago.

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


Navigation
Links