Skip Menu |
 

This queue is for tickets about the MailTools CPAN distribution.

Report information
The Basics
Id: 20726
Status: resolved
Priority: 0/
Queue: MailTools

People
Owner: Nobody in particular
Requestors: steve [...] silug.org
Cc:
AdminCc:

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



Subject: magic open() issue in Mail::Util::read_mbox()
Download (untitled) / with headers
text/plain 620b
I have a script that uses read_mbox() that is choking on a file that has trailing spaces. Apparently this is expected behavior with the two-argument form of open(): "The filename passed to 2-argument (or 1-argument) form of open() will have leading and trailing whitespace deleted, and the normal redirection characters honored." (Quoting "perldoc -f open".) The attached patch (against 1.74) changes the two-argument open() call to a three-argument open(), which fixes my problem. The only downside is requiring 5.6.1, since in my reading of perldelta561.pod, that's where the three-argument open() was introduced.
Subject: read_mbox.patch
Download read_mbox.patch
text/x-diff 412b
--- Mail/Util.pm.orig 2006-01-21 03:16:10.000000000 -0600 +++ Mail/Util.pm 2006-07-27 14:10:14.000000000 -0500 @@ -13,7 +13,7 @@ use Exporter (); BEGIN { - require 5.000; + require 5.006_001; $VERSION = "1.74"; @@ -102,7 +102,7 @@ local *FH; local $_; - open(FH,"< $file") or + open(FH,'<',$file) or do { require Carp; Carp::croak("cannot open '$file': $!\n");
Subject: Re: [rt.cpan.org #20726] magic open() issue in Mail::Util::read_mbox()
Date: Fri, 28 Jul 2006 06:37:29 +0200
To: via RT <bug-MailTools [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
Download (untitled) / with headers
text/plain 1.2k
* via RT (bug-MailTools@rt.cpan.org) [060727 19:21]: Show quoted text
> I have a script that uses read_mbox() that is choking on a file that has > trailing spaces. Apparently this is expected behavior with the > two-argument form of open():
Yes 2-arg open is dangerous. Show quoted text
> The attached patch (against 1.74) changes the two-argument open() call > to a three-argument open(), which fixes my problem. The only downside > is requiring 5.6.1, since in my reading of perldelta561.pod, that's > where the three-argument open() was introduced.
MailTools as a whole sucks: the origins are from even before MIME mail, and you can feel that. It runs on zillions of old systems, and that is the only reason to support it. Perl 5.6.1 is by far not sufficient. Use MailBox If you want a module which does everything right. Is it an option for you to auto-remove the blanks from the filename? Or link to the files with a good name, and open that one? Just as work-around. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
From: paul [...] city-fan.org
Download (untitled) / with headers
text/plain 1.1k
On Fri Jul 28 00:37:45 2006, Mark@Overmeer.net wrote: Show quoted text
> * via RT (bug-MailTools@rt.cpan.org) [060727 19:21]:
> > I have a script that uses read_mbox() that is choking on a file that has > > trailing spaces. Apparently this is expected behavior with the > > two-argument form of open():
> > Yes 2-arg open is dangerous. >
> > The attached patch (against 1.74) changes the two-argument open() call > > to a three-argument open(), which fixes my problem. The only downside > > is requiring 5.6.1, since in my reading of perldelta561.pod, that's > > where the three-argument open() was introduced.
> > MailTools as a whole sucks: the origins are from even before MIME mail, > and you can feel that. It runs on zillions of old systems, and that is > the only reason to support it. Perl 5.6.1 is by far not sufficient. > > Use MailBox If you want a module which does everything right. Is it > an option for you to auto-remove the blanks from the filename? Or > link to the files with a good name, and open that one? Just as
work-around. Now that MailTools requires perl >= 5.8.1, will you please reconsider changing to the 3-argument version of open?
Download (untitled) / with headers
text/plain 564b
On Thu Nov 29 10:19:50 2007, paul@city-fan.org wrote: Show quoted text
> On Fri Jul 28 00:37:45 2006, Mark@Overmeer.net wrote:
> > * via RT (bug-MailTools@rt.cpan.org) [060727 19:21]:
> > > I have a script that uses read_mbox() that is choking on a file
that has Show quoted text
> > > trailing spaces. Apparently this is expected behavior with the > > > two-argument form of open():
> > > > Yes 2-arg open is dangerous.
Show quoted text
> Now that MailTools requires perl >= 5.8.1, will you please reconsider > changing to the 3-argument version of open?
Yes, of course. Thanks for the hint. Changes in 2.02
Implemented in 2.02


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.