Skip Menu |

This queue is for tickets about the Mail-Box CPAN distribution.

Report information
The Basics
Id: 49362
Status: resolved
Priority: 0/
Queue: Mail-Box

People
Owner: Nobody in particular
Requestors: nobull67 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.090
Fixed in: (no value)



Subject: Mail::Message::Body::eol does not normalise missing EOL
The eol() method replaces existing EOL sequences at the end of lines but does not insert one where it is absent. Under some circumstances a body object can arise from decode() where the last line lacks an EOL. If the substitutions in eol() were to replace /[\015\012]*$/ rather than /[\015\012]+$/ then it would normalize missing EOLs and as far as I can see would have no ill effect.
Subject: Re: [rt.cpan.org #49362] Mail::Message::Body::eol does not normalise missing EOL
Date: Wed, 2 Sep 2009 13:00:43 +0200
To: Brian McCauley via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Brian McCauley via RT (bug-Mail-Box@rt.cpan.org) [090902 09:10]: Show quoted text
> Wed Sep 02 05:10:20 2009: Request 49362 was acted upon. > Transaction: Ticket created by NOBULL > Queue: Mail-Box > Subject: Mail::Message::Body::eol does not normalise missing EOL > Broken in: 2.090 > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=49362 > > > The eol() method replaces existing EOL sequences at the end of lines but > does not insert one where it is absent. Under some circumstances a body > object can arise from decode() where the last line lacks an EOL.
Under windows that is valid, under UNIX it is not. So, should we add a missing trailing new-line on all non-Windows systems? -- MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #49362] Mail::Message::Body::eol does not normalise missing EOL
Date: Sat, 5 Sep 2009 14:38:19 +0200
To: Brian McCauley via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
Hi Brian, I am looking forward to your opinion on this subject. Are we DWIMing smartly or over smart with the proposed change? * Mark Overmeer (mark@overmeer.net) [090902 13:00]: Show quoted text
> * Brian McCauley via RT (bug-Mail-Box@rt.cpan.org) [090902 09:10]:
> > Wed Sep 02 05:10:20 2009: Request 49362 was acted upon. > > Transaction: Ticket created by NOBULL > > Queue: Mail-Box > > Subject: Mail::Message::Body::eol does not normalise missing EOL > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=49362 > > > > > The eol() method replaces existing EOL sequences at the end of lines but > > does not insert one where it is absent. Under some circumstances a body > > object can arise from decode() where the last line lacks an EOL.
> > Under windows that is valid, under UNIX it is not. So, should we add > a missing trailing new-line on all non-Windows systems?
Subject: Re: [rt.cpan.org #49362] Mail::Message::Body::eol does not normalise missing EOL
Date: Sat, 5 Sep 2009 14:19:49 +0100
To: bug-Mail-Box [...] rt.cpan.org
From: Brian McCauley <nobull67 [...] gmail.com>
Sorry, I was still undecided. After length consideration I think I come down on the side of saying that adding the terminal EOL where the body lacks it * is* valid DWIM. Also the documentation for the eol() method should mention that it *may *modify the object as it does when applied to a MM::Message::Body::Lines object. 2009/9/5 Mark Overmeer via RT <bug-Mail-Box@rt.cpan.org> Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=49362 > > > Hi Brian, > > I am looking forward to your opinion on this subject. Are we DWIMing > smartly or over smart with the proposed change? > > * Mark Overmeer (mark@overmeer.net<https://mail.google.com/mail?view=cm&tf=0&to=mark@overmeer.net>) > [090902 13:00]:
> > * Brian McCauley via RT (bug-Mail-Box@rt.cpan.org<https://mail.google.com/mail?view=cm&tf=0&to=bug-Mail-Box@rt.cpan.org>)
> [090902 09:10]:
> > > Wed Sep 02 05:10:20 2009: Request 49362 was acted upon. > > > Transaction: Ticket created by NOBULL > > > Queue: Mail-Box > > > Subject: Mail::Message::Body::eol does not normalise missing EOL > > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=49362 > > > > > > > The eol() method replaces existing EOL sequences at the end of lines
> but
> > > does not insert one where it is absent. Under some circumstances a
> body
> > > object can arise from decode() where the last line lacks an EOL.
> > > > Under windows that is valid, under UNIX it is not. So, should we add > > a missing trailing new-line on all non-Windows systems?
> >
Subject: Re: [rt.cpan.org #49362] Mail::Message::Body::eol does not normalise missing EOL
Date: Sat, 5 Sep 2009 15:31:19 +0200
To: Brian McCauley via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Brian McCauley via RT (bug-Mail-Box@rt.cpan.org) [090905 13:20]: Show quoted text
> Queue: Mail-Box > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=49362 > >
I have changed the ::eol() routine with: my $lines = $self->lines; + if(@$lines) + { # sometimes texts lack \n on last line + $lines->[-1] .= "\n"; if($eol eq 'CR') {s/[\015\012]+$/\015/ for @$lines} elsif($eol eq 'LF') {s/[\015\012]+$/\012/ for @$lines} elsif($eol eq 'CRLF') {s/[\015\012]+$/\015\012/ for @$lines} else { $self->log(WARNING => "Unknown line terminator $eol ignored"); return $self->eol('NATIVE'); } + } Satisfied? -- Regards, Met vriendelijke groet, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions drs Mark A.C.J. Overmeer MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #49362] Mail::Message::Body::eol does not normalise missing EOL
Date: Sun, 6 Sep 2009 19:36:01 +0100
To: bug-Mail-Box [...] rt.cpan.org
From: Brian McCauley <nobull67 [...] gmail.com>
Yes, that's great thanks! 2009/9/5 Mark Overmeer via RT <bug-Mail-Box@rt.cpan.org> Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=49362 > > > * Brian McCauley via RT (bug-Mail-Box@rt.cpan.org<https://mail.google.com/mail?view=cm&tf=0&to=bug-Mail-Box@rt.cpan.org>) > [090905 13:20]:
> > Queue: Mail-Box > > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=49362 > > >
> > I have changed the ::eol() routine with: > > my $lines = $self->lines; > + if(@$lines) > + { # sometimes texts lack \n on last line > + $lines->[-1] .= "\n"; > > > if($eol eq 'CR') {s/[\015\012]+$/\015/ for @$lines} > elsif($eol eq 'LF') {s/[\015\012]+$/\012/ for @$lines} > elsif($eol eq 'CRLF') {s/[\015\012]+$/\015\012/ for @$lines} > else > { $self->log(WARNING => "Unknown line terminator $eol ignored"); > return $self->eol('NATIVE'); > } > + } > > Satisfied? > -- > Regards, > Met vriendelijke groet, > > MarkOv > > ------------------------------------------------------------------------ > Mark Overmeer MSc MARKOV Solutions > drs Mark A.C.J. Overmeer MARKOV Solutions > Mark@Overmeer.net solutions@overmeer.net<https://mail.google.com/mail?view=cm&tf=0&to=solutions@overmeer.net> > http://Mark.Overmeer.net http://solutions.overmeer.net > > >
just release 2.091 with the fix