Closed Bug 1891527 Opened 1 year ago Closed 1 year ago

In Bugmail & Bug History for User Story edits, there's a warning about "\ No newline at end of file" for user-entered values, even though the submitted value included a trailing newline

Categories

(bugzilla.mozilla.org :: Bug Creation/Editing, defect)

Production
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: dholbert, Assigned: dkl)

Details

User Story

abc
def
ghi

Attachments

(6 files)

STR (based on observations so far; haven't directly tested yet)

  1. Expand the User Story section for some bug.
  2. Type in a few lines of text to the User Story, being sure to end with a newline.
  3. Submit your changes.
  4. Look at the bugmail that you receive for the change.

ACTUAL RESULTS:
The bugmail shows \ No newline at end of file at the end of the line that represents the diff for the change to the User Story field.

EXPECTED RESULTS:
No warning about no newline at end of file; that seems to not be an accurate representation of the user-submitted change.

I noticed this most recently for denschub's update on https://bugzilla.mozilla.org/show_bug.cgi?id=1891380#a64528_421268 , where he's sure he copypasted the new User Story value from a tool that includes a newline at the end; and yet, the bugmail has a warning about "No newline at end of file".

Summary: Bugmail for edits to User Story field often warn about "\ No newline at end of file → Bugmail for edits to User Story field often warn about "\ No newline at end of file"

To test this, I'm updating this bug's user story field; I typed in the following (with a trailing newline after def):

abc
def
User Story: (updated)
Attachment #9396700 - Attachment description: screenshot → screenshot of issue from an update that denschub made to another bug

My edit in comment 1 did successfully trigger the bug, as shown in screenshots.

I'm making one further edit (adding ghi[newline]) to see if additional edits to the user story still show the problem, or if it's only the first edit.

User Story: (updated)

This is worse for cases where we edit the User Story in-place; it shows "No newline at end of file twice" (for the field's old contents as well as new contents, I guess).

So:

  • Bugzilla seems to be stripping the newline itself (I did include one in the values that I submitted)
  • And then Bugzilla is warning about a newline not being present.
  • Twice per message, in some cases (as in this screenshot)

This same warning shows up in the bug history (i.e. at https://bugzilla.mozilla.org/show_activity.cgi?id=1891527 ) , as shown in this screenshot, too.

A few possible remedies that come to mind here:
(1) don't strip newlines at the end of the user story; or at least, leave 1 behind when we're stripping them. (Maybe even insert one manually, as part of whatever post-processing we're doing?)

Or:
(2) To generate the diff that we're showing in email and Bug History, use a diff command that ignores trailing newlines.

(remedy #1 is probably preferable, unless there's some important reason that we need that trailing newline to be removed...)

Summary: Bugmail for edits to User Story field often warn about "\ No newline at end of file" → In Bugmail & Bug History for User Story edits, there's a warning about "\ No newline at end of file" for user-entered values, even though the submitted value included a trailing newline
Component: Email Notifications → Bug Creation/Editing
Assignee: nobody → dkl
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: