Edgewall Software
Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#11572 closed defect (cantfix)

Plain text email includes line endings

Reported by: jared.bownds@… Owned by:
Priority: high Milestone:
Component: notification Version: 1.0-stable
Severity: blocker Keywords:
Cc:
Release Notes:
API 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 Changed 3 years ago by Jared Bownds <jared.bownds@…>

Moreover, here is our system information.

System Information

Package	Version
Trac	1.0
Trac	1.0
Babel	0.9.5
Genshi	0.7 (without speedups)
mod_wsgi	3.2 (WSGIProcessGroup trac WSGIApplicationGroup trac.agraquest.int|)
pysqlite	2.4.1
Python	2.6.6 (r266:84292, Sep 4 2013, 07:46:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]
Python	2.6.6 (r266:84292, Sep 4 2013, 07:46:00) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]
pytz	2010h
pytz	2010h
setuptools	0.6c11
setuptools	0.6c11
SQLite	3.6.20
Subversion	1.6.15 (r1038135)
jQuery	1.7.2

comment:2 Changed 3 years ago by Ryan J Ollos

Resolution: cantfix
Status: newclosed

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 Changed 3 years ago by Ryan J Ollos

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 Changed 3 years ago by Ryan J Ollos

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:

  1. Manually change the line endings to LF when preparing the package for release, if necessary for the platform on which the release is prepared.
  2. Change svn:eol-style of branches/1.0-stable/trac/ticket/templates/ticket_notify_email.txt to LF.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted.
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.