#11572 closed defect (cantfix)
Plain text email includes line endings
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | |
Component: | notification | Version: | 1.0-stable |
Severity: | blocker | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
For some reason, our production instance of trac sends plain text emails with line endings IN the email itself. Our development instance (which matches our production instance) does not experience the same issue. Can anyone advise what the problem may be?
Example Email:
\ \ \ Comment (by jbownds): test \ \ \ \ \ \ \ Reporter: jbownds Owner: jbownds Type: Status: closed Keywords: Resolution: Resolved Department: \ Ticket URL: Trac
Copy of ticket_notify_email.txt
{% choose ticket.new %}\ {% when True %}\ Ticket '$ticket.summary' was created by '$ticket.reporter' and assigned to $ticket.owner Description: $ticket.description {% end %}\ {% if change.comment %}\ ${changes_body and _('Comment:') or _('Comment (by %(author)s):', author=change.author)} $change.comment {% end %}\ {% end %}\ {% end %}\ {% otherwise %}\ {% if changes_body %}\ ${_('Changes (by %(author)s):', author=change.author)} $changes_body {% end %}\ {% if changes_descr %}\ {% if not changes_body and not change.comment and change.author %}\ ${_('Description changed by %(author)s:', author=change.author)} {% end %}\ $changes_descr -- {% end %}\ -------------------------------------------------------------------------- {% with pv = [(a[0].strip(), a[1].strip()) for a in [b.split(':') for b in [c.strip() for c in ticket_props.replace('|', '\n').splitlines()[1:-1]] if ':' in b]]; sel = ['Reporter', 'Owner', 'Type', 'Status', 'Department', 'Severity', 'Resolution', 'Keywords', 'DueDate'] %}\ ${'\n'.join('%s\t%s' % (format(p[0]+':', ' <12'), p[1]) for p in pv if p[0] in sel)} {% end %}\ -------------------------------------------------------------------------- -- ${_('Ticket URL: %(link)s', link=ticket.link)} $project.name ${project.url or abs_href()} $project.descr
Attachments (0)
Change History (4)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Resolution: | → cantfix |
---|---|
Status: | new → closed |
We experienced the issue on trac-hacks.org: th:#11159. The issue is seen with Genshi 0.7 (genshi:#569), and the resolution is to downgrade to Genshi 0.6.1, until Genshi 0.7.1 is released.
comment:3 by , 11 years ago
According to genshi:comment:11:ticket:569 and [genshi 1256], changing your line endings from \r\n
to \n
might also fix the issue, but I haven't tried. I did confirm that ticket-notify-email
on trac-hacks.org has CRLF line endings:
file lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/ticket/templates/ticket_notify_email.txt lib/python2.6/site-packages/Trac-1.0.1-py2.6.egg/trac/ticket/templates/ticket_notify_email.txt: ASCII text, with CRLF line terminator
The eol-style
in the repository is native
: tags/trac-1.0.1/trac/ticket/templates/ticket_notify_email.txt, so when checking out the repository on Linux I get:
$ file trac/ticket/templates/ticket_notify_email.txt trac/ticket/templates/ticket_notify_email.txt: ASCII text
However, if make a virtualenv and run easy_install trac==1.0.1
, I get a ticket_notify_email.txt
with CRLF line endings:
$ file lib/python2.7/site-packages/Trac-1.0.1-py2.7.egg/trac/ticket/templates/ticket_notify_email.txt lib/python2.7/site-packages/Trac-1.0.1-py2.7.egg/trac/ticket/templates/ticket_notify_email.txt: ASCII text, with CRLF line terminators
Maybe the issue would be fixed if you changed your line endings to LF using dos2unix
?
comment:4 by , 11 years ago
Following some additional testing, an FAQ has been adding: TracFaq#Q:Whydoticketnotificationemailscontainunexpectedbackslashcharacters
I reproduced the issue on Ubuntu as follows. After installing from PyPI using easy_install
,
$ easy_install trac==1.0.1 Searching for trac==1.0.1 Reading http://pypi.python.org/simple/trac/ Reading http://projects.edgewall.com/trac Reading http://projects.edgewall.com/trac/wiki/TracDownload Reading http://trac.edgewall.com/ Best match: Trac 1.0.1 Downloading https://pypi.python.org/packages/source/T/Trac/Trac-1.0.1.zip#md5=7a2577262fa6dd8bf3136d8377130a90
the backslashes were seen in the email notification, and it was confirmed again that the template has CRLF
line endings:
$ file lib/python2.7/site-packages/Trac-1.0.1-py2.7.egg/trac/ticket/templates/ticket_notify_email.txt lib/python2.7/site-packages/Trac-1.0.1-py2.7.egg/trac/ticket/templates/ticket_notify_email.txt: ASCII text, with CRLF line terminators
The issue was fixed with:
$ dos2unix lib/python2.7/site-packages/Trac-1.0.1-py2.7.egg/trac/ticket/templates/ticket_notify_email.txt dos2unix: converting file lib/python2.7/site-packages/Trac-1.0.1-py2.7.egg/trac/ticket/templates/ticket_notify_email.txt to Unix format ...
I'm guessing that the package was prepared on Windows, and therefore template in the package has CRLF
line endings since svn:eol-style
is native
.
I can think of two workarounds for Trac 1.0.2 since we still need to support Genshi 0.7:
- Manually change the line endings to
LF
when preparing the package for release, if necessary for the platform on which the release is prepared. - Change
svn:eol-style
of branches/1.0-stable/trac/ticket/templates/ticket_notify_email.txt toLF
.
Moreover, here is our system information.
System Information