Bug 200450 - magic open() issue in Mail::Util::read_mbox()
magic open() issue in Mail::Util::read_mbox()
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: perl-MailTools (Show other bugs)
5
All Linux
medium Severity medium
: ---
: ---
Assigned To: Paul Howarth
Fedora Extras Quality Assurance
http://rt.cpan.org//Ticket/Display.ht...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-27 15:18 EDT by Steven Pritchard
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version: 1.74-2
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-08-10 13:08:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch against Mail/Util.pm (412 bytes, patch)
2006-07-27 15:18 EDT, Steven Pritchard
no flags Details | Diff

  None (edit)
Description Steven Pritchard 2006-07-27 15:18:30 EDT
(Duplicating the bug reported upstream:
http://rt.cpan.org//Ticket/Display.html?id=20726 )

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.
Comment 1 Steven Pritchard 2006-07-27 15:18:30 EDT
Created attachment 133187 [details]
Patch against Mail/Util.pm
Comment 2 Paul Howarth 2006-07-27 16:07:35 EDT
I'd like to see what upstream thinks of this, as it might be a feature rather
than a bug. The "perldoc -f open" goes on to say:

One should conscientiously choose between the magic and 3-arguments form of open():

    open IN, $ARGV[0];

    will allow the user to specify an argument of the form "rsh cat file │", but
will not work on a filename which happens to have a trailing space, while

    open IN, ’<’, $ARGV[0];

    will have exactly the opposite restrictions.
Comment 3 Steven Pritchard 2006-07-27 16:24:51 EDT
If you look at the patch, they are already doing open(FH,"< $file"), which
already rules out any of the other magic ("|" for example).  The only magic it
is doing at this point is stripping whitespace, which screams "bug" to me.

There are several other open() calls which don't include a mode ("<"), most of
which are probably security problems waiting to happen, but your argument makes
some sense for them.  :-)
Comment 4 Paul Howarth 2006-07-28 09:39:54 EDT
Given that upstream's only objection to this is the perl version requirement,
which isn't an issue for Extras, I've added your patch in 1.74-2.

Note You need to log in before you can comment on or make changes to this bug.