Edgewall Software
Modify

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#9641 closed defect (wontfix)

Trac generates empty diff when description changes from \n line endings to \r\n line endings

Reported by: jorge.vargas@… Owned by:
Priority: normal Milestone:
Component: general Version:
Severity: normal Keywords:
Cc: lists@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

We have a system that uses the XMLRPC API to create tickets. This system was creating description fields with the body having \n new lines. The first time some human did a comment in the system we where getting a "description changed" message.

After digging into trac's db with

select oldvalue,newvalue from ticket_change where ticket=XXX and field='description';

'newvalue' had \r\n as newlines.

Therefore I came to the conclusion trac itself was modifying the content of the field.

We noticed two things not working properly.

I believe these behaviors should be the opposite, email notifier should ignore differences in line endings while the webui should point out they are the same except for the line endings.

Attachments (0)

Change History (6)

comment:1 by Thijs Triemstra <lists@…>, 12 years ago

Cc: lists@… added

comment:2 by Christian Boos, 12 years ago

Well, I'd rather see that fixed in the XMLRPC plugin.

comment:3 by jorge.vargas@…, 12 years ago

comment:4 by osimons, 12 years ago

Fixed? See th:#2482

Web forms post data as multipart/form-data, which according to specification rfc:2388 says "The media-type multipart/form-data follows the rules of all multipart MIME data streams as outlined in rfc:2046". Looking at that specification you find: "The canonical form of any MIME "text" subtype MUST always represent a line break as a CRLF sequence"

That is why the th:XmlRpcPlugin now converts your input. Any old, wrong entries you have in your db I suggest you fix using SQL. Trac should not need to add code in order to accommodate an old plugin bug.

Suggesting wontfix.

Last edited 12 years ago by osimons (previous) (diff)

comment:5 by Christian Boos, 12 years ago

Resolution: wontfix
Status: newclosed

Ok for wontfix.

I'm curious however what happens with wiki pages, when we import them on Unix (with LF presumably), and later edit them. Some kind of normalization must happen at some point, because I don't remember having seen whole page differences after a small edit on such pages.

in reply to:  5 comment:6 by Remy Blank, 12 years ago

Replying to cboos:

Some kind of normalization must happen at some point, because I don't remember having seen whole page differences after a small edit on such pages.

The imported files are opened in text mode, and should therefore be normalized to LF line endings. Which exactly contradicts RFC:2388 if it mentions CRLF line endings :)

We probably don't see huge diffs because .splitlines() is used to split the text into lines, which strips line endings.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.