Page MenuHomePhabricator

Text area insertion after clicking "reply" link in Bugzilla has weird line wrapping
Closed, ResolvedPublic

Description

Following the recent Bugzilla upgrade, sometimes when you click "reply" in Bugzilla, it inserts the text into the text area with quote markers (">") as expected, but it sometimes wraps the lines strangely (with one or two words on their own line inexplicably). I'm not sure why. I guess there were changes to Bugzilla's comments.js or something?

You can see an example of the strange line wrapping at bug 42734 comment 4.


Version: wmf-deployment
Severity: minor

Details

Reference
bz42850

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:57 AM
bzimport set Reference to bz42850.
bzimport added a subscriber: Unknown Object (MLST).

richardg_uk wrote:

Clicking "reply" no longer works for me at all (on Chrome/Linux). The text area remains completely empty.

Expected result would be to insert "(In reply to comment #..." and the ">" quoted text in the Additional Comments box.

JavaScript reports Uncaught ReferenceError: wrapReplyText is not defined in replyToComment().

Might be a side-effect of https://bugzilla.mozilla.org/show_bug.cgi?id=551468 . Related issues are 810801,524915.

Richard: Different problem, see bug 42763: Check your cache.

It seems to break lines weirdly whenever a line has 74 or 75 "real" characters (means: 76 or 77 with the preceding "> ").

Bugzilla/Constants.pm defines

use constant COMMENT_COLS => 80;

and in js/comments.js , function wrapReplyText(text) defines:

// This is -3 to account for "\n> "
var maxCol = BUGZILLA.constant.COMMENT_COLS - 3;

https://bug551468.bugzilla.mozilla.org/attachment.cgi?id=486205 might be handy to have related code "in a nutshell".

Happens only with 78 characters in a line of unquoted text.

I cannot reproduce on boogs.wmflabs.org nor my local Bugzilla instance.

So I downloaded the HTML of https://bugzilla.wikimedia.org/show_bug.cgi?id=42850 to my local harddisk as comment 0 also triggers the problem.
I can reproduce the problem locally in my browser (no Bugzilla involved) so I started to wonder if the wrapping which is done by Perl in order to display comments in HTML has an issue (comments are stored non-wrapped in the database. For displaying wrap_comment() in Bugzilla/Util.pm uses Perl's $Text::Wrap::).

boogs.wmflabs.org: Perl 5.14.2-6ubuntu2.3 (Ubuntu Lucid)
bugzilla.wikimedia.org / kaulen: Perl 5.10.1-8ubuntu2.3 (Ubuntu Precise)
My local Bugzilla: Perl 5.16.3-265.fc19.i686 (Fedora 19)

Not sure if this was really the best use of the last two hours, but at least interesting.
So the problem might go away when updating the distribution on kaulen (bugzilla.wikimedia.org's server) / moving bugzilla.wikimedia.org onto a different machine which runs a newer distribution.
Or not, if I was wrong.

This problem will automatically be fixed once we have moved to the new server which runs a newer distro and Bugzilla 4.4 (I just tested it there).

Fixed by moving to a new server with more recent distro. Probably the newer Perl in the stack.