#9641 closed defect (wontfix)
Trac generates empty diff when description changes from \n line endings to \r\n line endings
Reported by: | 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.
- Trac's email notifier was sending out the diffs, but since they where newlines it was a huge diff with nothing really happening.
- Trac's webUI diff was NOT showing any changes at (https://mytrac.com/ticket/XXX?action=diff&version=X)
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 , 14 years ago
Cc: | added |
---|
comment:2 by , 14 years ago
comment:4 by , 14 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
.
follow-up: 6 comment:5 by , 14 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
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.
comment:6 by , 14 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.
Well, I'd rather see that fixed in the XMLRPC plugin.